[Bioperl-l] Compliance of Bio::Seq add_SeqFeature() method
hlapp at drycafe.net
Sun Mar 4 14:27:34 EST 2012
It does need to comply - the interface is the contract. That being said, any implementation can go *beyond* the contract in what it supports - it just can't fall short of it. So an implementation can always implement more than the contract requires, but never less or it is out of compliance.
It seems from the documentation you quote that Bio::Seq does support a single feature to be added, so that part is fine. However, there is no mention of the EXPAND option, so if that's indeed not supported (can't look at the code right now) then it is not compliant, and that should be fixed.
Sent with a tap.
On Mar 5, 2012, at 2:39 AM, Florent Angly <florent.angly at gmail.com> wrote:
> Hi all,
> I have just been burned by a problem with the Bio::Seq add_SeqFeature() method. Bio::Seq is a class which implements Bio::SeqI, which itselt implements Bio::FeatureHolderI, which defines an add_SeqFeature() method as:
>> Usage : $feat->add_SeqFeature($subfeat);
>> Function: adds a SeqFeature into the subSeqFeature array.
>> with no 'EXPAND' qualifer, subfeat will be tested
>> as to whether it lies inside the parent, and throw
>> an exception if not.
>> If EXPAND is used, the parent''s start/end/strand will
>> be adjusted so that it grows to accommodate the new
>> Example :
>> Returns : nothing
>> Args : a Bio::SeqFeatureI object
> In comparison, the add_SeqFeature method implemented by Bio::Seq is:
>> Title : add_SeqFeature
>> Usage : $seq->add_SeqFeature($feat);
>> Function: Adds the given feature object (or each of an array of feature
>> objects to the feature array of this
>> sequence. The object passed is required to implement the
>> Bio::SeqFeatureI interface.
>> Returns : 1 on success
>> Args : A Bio::SeqFeatureI implementing object, or an array of such objects.
> As you can see, there is a discrepancy. While the Bio::Seq method takes an array of features, Bio::FeatureHolderI states that it should take a single feature and the optional 'EXPAND' scalar.
> It would not be very hard to modify Bio::Seq so that it complies with Bio::FeatureHolderI. One would have to make sure that the Bio::Seq feature takes the 'EXPAND' option and to have a deprecation message for any call with more than one feature.
> First, I am missing something here or does Bio::Seq need to comply with Bio::FeatureHolderI?
> Then, if Bio::Seq needs to be changed, I wanted to have some feedback from other wise Bioperl-ers to see if the course of action I described is adapted.
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
More information about the Bioperl-l