#!/usr/bin/perl use Bio::Seq; use Bio::SeqIO; use Bio::SeqUtils; my $counter=0; #================================= #Script to translate sequences in 3 or 6 frames #briandotoakleyatarsdotusdadotgov #k.purdy at warwick.ac dot uk #================================= #---define input file---- $usage = "\n\nUsage: $0 filename\n\n"; my $input_file = $ARGV[0] or die $usage; print "\nDo you want to see 3 forward frames or all 6 frames? \n\nEnter 3 or 6: "; chomp ($frame=); $seqio = Bio::SeqIO->new( '-format' => 'fasta' , -file => $input_file); while ($seqobj = $seqio->next_seq() ) { $counter++; my $line_counter=0; print "\n\nSequence number ",$counter," ",$seqobj->id,"\n", $seqobj->seq(),"\n\n"; if ($frame==3) {@prot = Bio::SeqUtils->translate_3frames($seqobj)}; if ($frame==6) {@prot = Bio::SeqUtils->translate_6frames($seqobj)}; foreach $line(@prot) { $line_counter++; print "Frame $line_counter: ",$line->seq(),"\n"; } }