[Bioperl-l] Coordinates of sub SeqFeatures

Florent Angly florent.angly at gmail.com
Mon Mar 5 23:18:17 UTC 2012


Hi all,

Could anyone provide clarifications regarding the coordinates of sub 
SeqFeatures?
Consider this script, that has a sequence with a feature, which itself 
contains a (sub) seqfeature:
> #! /usr/bin/env perl
>
> use strict;
> use warnings;
> use Bio::Seq;
> use Bio::SeqFeature::Generic;
>
> select(STDERR);
> $| = 1;
> select(STDOUT);
> $| = 1;
>
> my $seq = Bio::Seq->new(
>    -seq => 'AAAAAAAAAAAAAAAAAAAACCCCCCTTTT',
> );
>
> # A feature of the sequence spanning the 'CCCCCCTTTT' region
> my $feat = Bio::SeqFeature::Generic->new(
>     -start       => 21,
>     -end         => 30,
>     -strand      => 1,
> );
> print "Attaching feature to sequence... ";
> $seq->add_SeqFeature($feat);
> print "done!\n\n";
>
> # A subfeature of the feature, spanning 'CCCCCC'
> my $subfeat = Bio::SeqFeature::Generic->new(
>     -start      => 1,
>     -end        => 6,
> #    -start       => 21,
> #    -end         => 26,
> );
> print "Attaching subfeature to feature... ";
> $feat->add_SeqFeature($subfeat);
> print "done!\n\n";

Here, I gave the sub SeqFeature coordinates relative to the feature it 
is attached to, i.e. position 1..6 of the SeqFeature. However, I get the 
exception "Bio::SeqFeature::Generic=HASH(0x15fa150) is not contained 
within parent feature, and expansion is not valid". Now, if I provide 
the sub SeqFeature coordinates relative to the sequence instead of the 
feature it is attached to, i.e. 21..26, everything goes well. Obviously, 
add_SeqFeature expects coordinates to be relative to the sequence.

All the documentation I have looked at does not talk about what the 
coordinates are relative too. The problem to me is that this seems 
counter-intuitive to not being able to provide coordinates relative to 
the object a feature is attached too.

Can anyone clarify how the coordinate system for features and sub 
features is intended to work?

Thanks,

Florent





More information about the Bioperl-l mailing list