This is a test version of Biostars. For the public version, visit https://www.biostars.org.
miRanda target information extraction

Hello,

I have the output generated from miRanda. My question is as follows:

I want to extract the line ( protein information) After the "Read Sequence:" part. I tried grep with -A1 option but that generates information after every single "Read Sequence:" in the ENTIRE output file. But I only want this info from the ones with the hits (miRNA-target Sequence Alignment), like entry #1 in the example below and NOT entry #2. There are several hundred entries in this output file generated, but I only want to extract the info associated right after "Read Sequence:" for ONLY THOSE ENTRIES , where a miRNA-target hit has been found.

Any help is most appreciated !

Thanks and regards

**1st Entry**   

 Read Sequence:CDS_01952812::tryptophan rich basic protein (WRB), transcript variant X2, mRNA"(2218 nt)
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Performing Scan: miRNA-XYZ vs CDS_01952812::tryptophan
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

       Forward: Score: 163.000000  Q:2 to 22  R:1405 to 1427 Align Len (20) (75.00%) (80.00%)

    ----------------miRNA-target Sequence Alginment shown here------------

       Energy:  -23.299999 kCal/Mol


    Scores for this hit:
    > miRNA-XYZ CDS_01952812::tryptophan    163.00  -23.30  2 22    1405 1427   20  75.00%  80.00%

    Score for this Scan:
    Seq1,Seq2,Tot Score,Tot Energy,Max Score,Max Energy,Strand,Len1,Len2,Positions
    >> miRNA-XYZ    CDS_01952812::tryptophan    163.00  -23.30  163.00  -23.30  479 24  2218     1405
    Complete

**2nd entry**    

    Read Sequence:"CDS_111111::SH3 domain-binding glutamic acid-rich protein-like, mRNA"(273 nt)
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Performing Scan: miRNA-ABCD vs " CDS_111111::SH3
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Score for this Scan:
    No Hits Found above Threshold
    Complete
sequence

1 answer

But I only want this info from the ones with the hits (miRNA-target Sequence Alignment), like entry #1

grep -A 1 -m 1

entry #2

grep -A 1 -m 2 | tail -1

Thanks Pierre ! But I as I have over hundred of entries in the output file (above is a snippet of that file) is there any way I could extract all the entries matching entry #1 from above?

Thanks and regards !

Log in to answer this question.