[Bioperl-l] Bio::SeqFeature::Generic unexpected behavior

Jonathan Flowers jonathanmflowers at gmail.com
Wed Oct 7 18:13:46 EDT 2009


I am building Bio::SeqFeature::Gene::Transcript objects to facilitate easy
parsing of cds and intron sequences.  I ran across an unexpected problem
when creating two or more Transcript objects and attaching independent
Bio::Seq objects to them. In the following code, 2 transcript objects are
constructed independently (not cloned).  However, extracting the cds for one
transcript gives an errant (and unexpected result).  Curiously, extracting
the introns from the same transcript objects gives the correct result.  I
have highlighted the unexpected outcome below.  Finally, I noticed that
reversing the order of the attach_seq commands determines which cds is

The following example illustrates the problem.

Can someone explain this?


#! usr/bin/env perl
use strict;
use warnings;
use Bio::FeatureIO::gff;
use Bio::SeqFeature::Annotated;
use Bio::SeqFeature::Gene::Transcript;
use Bio::SeqFeature::Gene::Exon;
#use Bio::SeqFeature::Gene::UTR;
#use Bio::SeqFeature::Gene::Intron;

#Build the objects...
my $seq1 = Bio::Seq->new(-seq => 'AAAAA');
my $seq2 = Bio::Seq->new(-seq => 'TTTTT');

my $tscript1 = Bio::SeqFeature::Gene::Transcript->new(-start => 1, -end =>
5, -strand => +1);
my $tscript2 = Bio::SeqFeature::Gene::Transcript->new(-start => 1, -end =>
5, -strand => +1);

my $exon1 = Bio::SeqFeature::Gene::Exon->new(-start => 1 , -end => 2,
-strand => +1);
my $exon2 = Bio::SeqFeature::Gene::Exon->new(-start => 4 , -end => 5,
-strand => +1);




#now extract the desired features and print
print $tscript1->cds->seq,"\n"; #prints 'TTTT' <- unexpected !!!
print $tscript2->cds->seq,"\n"; #prints 'TTTT' <- as expected

    print $_->seq->seq,"\n";     #prints 'A'   <- as expected

    print $_->seq->seq,"\n";    #prints 'T'  <- as expected

More information about the Bioperl-l mailing list