My overall goal is converting DNA to AMINO ACIDS (protein). (DNA to RNA is transcription, not translation).

Here is information from BioPerl for using this function:

http://search.cpan.org/~cjfields/BioPerl-1.6.924/Bio/PrimarySeqI.pm#translate

"Function: Provides the translation of the DNA sequence using full IUPAC ambiguities in DNA/RNA and amino acid codes."

Here is the code example from the Beginner's guidelines:

$prot_obj = $my_seq_object->translate(-frame => 1);

And here is an example code I found online in which they call using Bio::SeqIO

#!/usr/bin/perl -w use strict; use Bio::Seq; use Bio::SeqIO; my $input = $ARGV[0]; my $seqio_obj = Bio::SeqIO->new(-file => $input, -format => "fasta" ); my $line_count; # process multi-fasta sequences while(my $seq_obj = $seqio_obj->next_seq){ $line_count++; # print "===========================================================\ +n"; # obtain id of the nt sequence my $id = $seq_obj->display_id; # print id of nt sequence # print "SEQ ID\t>\t", $id, "\n"; # print "===========================================================\ +n"; # use translate to convert amino acid squence to protein sequence fr +om frame 0 (default) # 'complete' - do some checks for ORF # print ">>>>>>>> Frame 0 <<<<<<<\n"; print ">", $id, "-0", "\n"; my $prot_obj = $seq_obj->translate(); # print the protein sequence print $prot_obj->seq,"\n"; # print "\n"; # print ">>>>>>>> Frame 1 <<<<<<<\n"; # translation starting from the second nucleotide (frame 1) print ">", $id, "-1", "\n"; $prot_obj = $seq_obj->translate(-frame => 1); # print the protein sequence print $prot_obj->seq,"\n"; # print "\n";

My script is working fine for the default frame, for the 1st frame, and until line 5401 for the 2nd frame. The part that messes up is when it gets to the (-frame => 2) file, but even that file works until line 5401. So I don't think it is an input issue.

And thank you for the above code, but I am translating to amino acids.


In reply to Re^4: Error with Bio::Seq Translate by dmbNEWB
in thread Error with Bio::Seq Translate by dmbNEWB

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.