Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thanks for your answers. I would like to thank Daveorg for his explanation and highlighting my problem. I'm still having some problem in solving my problem. I have sent the structure of the file am dealing with and the code I have so far come up with using a REGEX that captures only the first line in the file.

The structure of the text file is as follows:

FT CDS complement(7216..17805) FT /locus_tag="TP01_0003" FT /codon_start=1 FT /protein_id="XP_765530.1" FT /db_xref="GI:71031777" FT /db_xref="GeneID:3502673" FT gene complement(<7216..>17805) FT /locus_tag="TP01_0003" FT /db_xref="GeneID:3502673" FT mRNA complement(<7216..>17805) FT /locus_tag="TP01_0003" FT /product="hypothetical telomeric SfiI fragment 20 protein FT 3" FT /transcript_id="XM_760437.1" FT /db_xref="GI:71031776" FT /db_xref="GeneID:3502673" FT CDS complement(join(18028..18116,19351..20668)) FT /locus_tag="TP01_0004" FT /note="go_function: nutrient reservoir activity [goid FT 0045735]" FT /codon_start=1 FT /protein_id="XP_765531.1" FT /db_xref="GI:71031779" FT /db_xref="GeneID:3503550" FT gene complement(<18028..>20668) FT /locus_tag="TP01_0004" FT /db_xref="GeneID:3503550" FT mRNA complement(join(<18028..18116,19351..>20668)) FT /locus_tag="TP01_0004" FT /product="hypothetical protein" FT /transcript_id="XM_760438.1" FT /db_xref="GI:71031778" FT /db_xref="GeneID:3503550" FT CDS complement(20951..21967) FT /locus_tag="TP01_0005" FT /codon_start=1 FT /protein_id="XP_765532.1" FT /db_xref="GI:71031781" FT /db_xref="GeneID:3503551" FT gene complement(<20951..>21967) FT /locus_tag="TP01_0005" FT /db_xref="GeneID:3503551" FT mRNA complement(<20951..>21967) FT /locus_tag="TP01_0005" FT /product="hypothetical protein" FT /transcript_id="XM_760439.1" FT /db_xref="GI:71031780" FT /db_xref="GeneID:3503551"

This is my code

#!/usr/bin/perl $file = 'Muguga.embl '; open (F, $file) || die ("Could not open $file!"); while ($line = <F>) { ($field1,$field2,$field3,$field4) = split( "\t" , $line); print "$field1 $field2 $field3 $field4 \n"; my $string = (FT CDS complement(join(18028..18116,19351..20668))); # s +tring to be searched if ($string = ~ m/^FT \s+ CDS \s+ complement\(join\([0-9]+\)\)$/) #search for the first line highlighted in bold { print 'match' } else{ print 'no match'; } } close (F);

My wish is to able to search for the lines that are in bold and print them out.

I will be grateful if you are able to help my code though am still a perl newbie.

Thanks in advance.

20090716 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

In reply to REGEX malfunction by rayken

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2022-08-13 08:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found