Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Genbank file parsing

by TedPride (Priest)
on Jan 12, 2005 at 00:54 UTC ( #421471=note: print w/ replies, xml ) Need Help??


in reply to Genbank file parsing

There's no need to use regex for most of that, since you aren't searching case insensitive anyway.

use strict; use warnings; my ($features, $count, @seq); while (<DATA>) { if (index($_, 'FEATURES') != -1) { ($features) = m/\s(\S+)/; } elsif (index($_, 'COUNT') != -1) { ($count) = m/\s(\d+)/; } elsif (index($_, 'ORIGIN') != -1) { push @seq, $_ until index($_ = <DATA>, '//') != -1; } } print "$features\n$count\n",@seq; __DATA__ # extract of file: #=============== FEATURES Location/Qualifiers /note="blah blah" COUNT 200 ORIGIN 1 lots of nice info 61 lots of nice info 121 lots of nice info //


Comment on Re: Genbank file parsing
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://421471]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-07 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls