[Bioperl-l] Help with reversing a sequence

Paul St. Amand pst at ksu.edu
Mon Feb 23 12:58:36 EST 2004


Hi,

I am using the following script to get a subsequence and reverse it. 
Note that I do NOT want the "reverse complement" of the sequence here, 
just the actual reverse. BioPerl has a method to get the revcom of a 
seq, such as:

print $outputfh "Reverse complemented sequence 5 to 10  is 
",$seqobj->trunc(5,10)->revcom->seq, "  \n";

Does BioPerl have a similar/better way to get the reverse (not revcom) 
of a sequence?

This is how I am doing it and it is slow. Is there a way that is faster 
or "better" using BioPerl???


use strict;
use warnings;
use Bio::SeqIO;
my $outputfh = *STDOUT;

     my ($infile, $in, $out, $seqobj);
     $infile = shift or die;

     $in  = Bio::SeqIO->new('-file' => $infile ,
                            '-format' => 'Fasta');
     $seqobj = $in->next_seq();

     $out = Bio::SeqIO->newFh('-format'   => 'fasta',
			     '-noclose'  => 1,
			     '-fh'       => $outputfh);

print $outputfh ">MyReversedSeq29856-29862\n",scalar 
reverse($seqobj->subseq(29856,29862)),"\n";





Thanks,
Paul



More information about the Bioperl-l mailing list