Hi all! I am new to perl, and this is my first post ever!
I am trying to translate nucleic acid sequences into amino acid sequences. I create a script (below). When I run the script with only the translate frames 0 & 1, then the script runs fine. Upon adding in the translate frame 2, the script stops working and I receive errors (below). Also, I tried running the translate frame 2 by itself, but receive the same errors.
I've tried searching these errors/message individually to troubleshoot myself, but I can't figure it out. Any guidance is much appreciated!
Script:
Errors: substr outside of string at /sw/lib/perl5/5.16.2/Bio/PrimarySeqI.pm line 644, <GEN0> line 5013. ------------- EXCEPTION: Bio::Root::Exception ------------- MSG: Calling translate without a seq argument! STACK: Error::throw STACK: Bio::Root::Root::throw /sw/lib/perl5/5.16.2/Bio/Root/Root.pm:472 STACK: Bio::Tools::CodonTable::translate /sw/lib/perl5/5.16.2/Bio/Tools/CodonTable.pm:411 STACK: Bio::PrimarySeqI::translate /sw/lib/perl5/5.16.2/Bio/PrimarySeqI.pm:648 STACK: translateframe.pl:11 -----------------------------------------------------------#!bin/perl -w use strict; use warnings; use Bio::SeqIO; #script to translate nucleotide sequences to amino acid sequences in f +irst three frames my $in = Bio::SeqIO->new(-file => "sequence.fasta", -format => "fasta" +); my $out = Bio::SeqIO->new(-file => ">Frame1.fasta", -format => "fasta" +); my $out2 = Bio::SeqIO->new(-file => ">Frame2.fasta", -format => "fasta +"); my $out3 = Bio::SeqIO->new(-file => ">Frame3.fasta", -format => "fasta +"); while ( my $seq = $in->next_seq() ) { my $prot = $seq->translate(); $out->write_seq($prot); my $prot2 = $seq->translate(-frame => 1); $out2->write_seq($prot2); my $prot3 = $seq->translate(-frame => 2); $out3->write_seq($prot3); }
In reply to Error with Bio::Seq Translate by dmbNEWB
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |