XP is just a number | |
PerlMonks |
Re: How to get non-redundant DNA sequences from a FASTA file?by Athanasius (Archbishop) |
on Sep 13, 2014 at 09:08 UTC ( [id://1100477]=note: print w/replies, xml ) | Need Help?? |
Hello supriyoch_2008, Same approach as choroba, except that I read the data into a hash mapping headers to sequences, and then reverse that hash to get the non-redundant sequences:
Output:
Note: on hash reversal, see How-do-I-look-up-a-hash-element-by-value of perlfaq4. If you really don’t care which header is output when there are redundant sequences, you can just say:
When your code starts to get too complicated, it’s usually a good idea to step back and look for a simpler approach. Remember, less is more. ;-) Hope that helps,
In Section
Seekers of Perl Wisdom
|
|