[Bioperl-l] Will subseq give complement?

Jason Stajich jason at cgt.duhs.duke.edu
Fri Aug 8 15:18:04 EDT 2003


Where does the API doc say you can pass in 4 arguments to subseq?

For what you want to do you need to either pass in a Bio::Location which
is the subseq you want, like this which will respect the strand

my $intronloc = new Bio::Location::Simple(-start => $end[$j] +1,
                                          -end   => $start[$j+1]-1,
                                          -strand => $strand);
# get the string back
my $subseq = $seq->subseq($intronloc);

OR

you can do it all explicitly.

my $subseq;
# get a sequence object back, not a string
my $subobj = $seq->trunc($end[$j]+1,$start[$j+1]-1);
if( $strand < 0 ) {
  $subseq = $subobj->revcom->revcom;
} else {
  $subseq = $subobj->seq();
}


FYI
An undocumented (and experimental) part of the API is that you can pass in
3 arguments - start,end,replace and replace sequence in the underlying
sequence just like you can with substr in perl.

-jason

On Fri, 8 Aug 2003, Gray, John wrote:

> I am trying to write a script which pull only intron sequences from
> genomic contigs, and I am having trouble making subseq give me the
> complement of the sequence in the file.  First I import the file into
> the bioperl object $seq using SeqIO, and then I process the features.
> When the feature is an 'mRNA', with a 'SplitLocation', then I put all
> the exon stop and start positions into @start and @end arrays.  I then
> pull the intron sequence with the following command:
>
>                     $sequence = $seq->subseq($end[$j]+1,$start[$j+1]-1,
>                     ' ', $strand);
>
> This whole process works great, except that I always only get the top strand, regardless of the orientation of the feature.  I have confirmed that in fact the $strand variable properly reflects the strand of the feature.
>
> Am I using this method properly?  Can anyone help me?
>
>
>
> John T. Gray, Ph.D.
> Director, Vector Development & Production
> Experimental Hematology Division
> Hematology-Oncology
> St. Jude Children's Research Hospital
>  
> (901) 495-4729 phone
> (901) 495-2176 fax
> John.Gray at stjude.org
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu



More information about the Bioperl-l mailing list