[Bio-software] transeq

don gilbert via bio-soft%40net.bio.net (by gilbertd from indiana.edu)
Tue Mar 27 21:58:22 EST 2007


#!/usr/bin/perl
# from Bioperl scripts bp_translate.pl, at http://bioperl.org/

use Bio::SeqIO;
use Getopt::Long;

my ($format) = 'fasta';

GetOptions(
            'format:s'  => \$format,
            );

my $oformat = 'fasta';

# this implicity uses the <> file stream
my $seqin = Bio::SeqIO->new( -format => $format, -file => shift);
my $seqout = Bio::SeqIO->new( -format => $oformat, -file => ">-" );


while( (my $seq = $seqin->next_seq()) ) {
         my ($frame)= $seq->desc() =~ m/frame=([+-]\d)/;
         my $pseq = $seq->translate(-frame => $frame % 3);# only  
0,1,2 valid values for frame
         $seqout->write_seq($pseq);
}

__END__
> I have a list of nucleotide sequences (in fasta format) that I want to
> translate to protein using frames specified by me.  Is there any
> software that can do this.
>
> ..
> eg:
>
> >ABCD frame=+1
> ATCTCTCTCTCTCTTCTCTTC
>
> >CDEF frame=-3
> ATGTCTCTCTCTCTCTCT
>
> etc...
>
> I tried to write a perl program to do this.

> ...
> Any help will be greatly appreciated.
>
> Thank you,
> Priya



More information about the Bio-soft mailing list