Think about Loose Coupling | |
PerlMonks |
Re: how do i obtain blast result from the given fileby rjt (Curate) |
on Jun 17, 2013 at 19:15 UTC ( [id://1039449]=note: print w/replies, xml ) | Need Help?? |
You can print the matching lines with a regular expression that matches only the lines you're interested in:
The above will also handle arbitrarily large files, as it reads one line at a time into memory. There are many hits, but if I want the top ten only, what do i do? I'm not sure what you mean by top ten, exactly (highest "Score"? "E Value"? Order within the file?), but a likely approach to this would be to modify the above while loop and instead of printing, place each line in a hash. My regular expression already does basic parsing of the input line into capture variables $1 through $5, so you can try something like this:
Then, after the loop finishes, you can sort and display the results however you like. For example:
Outputs:
In Section
Seekers of Perl Wisdom
|
|