If you're planning on using Perl for bioinformatics, you might be better off installing
BioPerl rather than hand-rolling FASTA parsers and translation codon tables.
use Bio::SeqIO;
my $sequences = Bio::SeqIO->new(
-file => "sequence.fasta",
-format => "fasta",
);
while ( my $dna = $sequences->next_seq ){
my $protein = $dna->translate(
-codontable_id => 1, # standard genetic code
-frame => 0, #reading-frame offset 0
);
print $dna->display_id, "\n";
print $protein->seq, "\n\n";
}
Having said that, installing BioPerl (1.6.901) on Windows seems to be more difficult than I was expecting: I had to resort to
force with Strawberry and CPAN, having simply given up trying to get it to install with ActivePerl and PPM.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.