[Bioperl-l] Bio::SeqFeature::Gene::Exon throws exception when encountering split location (Bio::Location::Split)
Mark Johnson
johnsonm at gmail.com
Tue Jun 12 00:45:13 UTC 2007
This bit in Bio::SeqFeature::Gene::Exon is causing me some
problems trying to extend Bio::Tools::Glimmer to handle 'wraparound'
genes (circular genomes):
sub location {
my ($self,$value) = @_;
if(defined($value) && $value->isa('Bio::Location::SplitLocationI')) {
$self->throw("split or compound location is not allowed ".
"for an object of type " . ref($self));
}
return $self->SUPER::location($value);
}
That seems to be there all the way back to the initial revision
(checked in by Hilmar). I presume it's there because of code like
this ( from the seq() method in Bio::SeqFeature::Generic):
# assumming our seq object is sensible, it should not have to yank
# the entire sequence out here.
my $seq = $self->{'_gsf_seq'}->trunc($self->start(), $self->end());
That's not going to work too well with a feature that has a
Bio::Location::Split location. Fixing it up seems straightforward, if
a bit hackish. Something like:
my $seq;
if (ref($self->location()) eq 'Bio::Location::Split')) {
my $seqstring;
my @sublocs = $self->location()->sub_Location();
foreach my $subloc (@sublocs) {
$seqstring .= $self->{'_gsf_seq'}->trunc($subloc->start(),
$subloc->end())->seq();
}
my $seq = Bio::Seq->new(
-id =>
$self->{'_gsf_seq'}->display_id(),
-seq => $seqstring
);
}
else {
$seq = $self->{'_gsf_seq'}->trunc($self->start(), $self->end());
}
I don't see any companion to trunc() in Bio::PrimarySeqI for
joining sequences. A join() would be handy, and make the above
cleaner.
Comments, suggestions, rotten fruit?
More information about the Bioperl-l
mailing list