Bio::FeatureHolderI - the base interface an object with features must implement
use Bio::SeqIO;
# get a feature-holding object somehow: for example, Bio::SeqI objects
# have features
my $seqio = Bio::SeqIO->new(-fh => \*STDIN, -format => 'genbank');
while (my $seq = $seqio->next_seq()) {
# $seq is-a Bio::FeatureHolderI, hence:
my @feas = $seq->get_SeqFeatures();
# each element is-a Bio::SeqFeatureI
foreach my $fea (@feas) {
# do something with the feature objects
}
}
This is the base interface that all feature-holding objects must implement.
Popular feature-holders are for instance Bio::Seq objects. Since
Bio::SeqFeatureI defines a
sub_SeqFeature() method, most
Bio::SeqFeatureI implementations like Bio::SeqFeature::Generic will implement
the feature holder interface as well.
User feedback is an integral part of the evolution of this and other Bioperl
modules. Send your comments and suggestions preferably to the Bioperl mailing
list. Your participation is much appreciated.
[email protected] - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Please direct usage questions or support issues to the mailing list:
[email protected]
rather than to the module maintainer directly. Many experienced and reponsive
experts will be able look at the problem and quickly address it. Please
include a thorough description of the problem with code and data examples if
at all possible.
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs
and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
Email hlapp at gmx.net
Steffen Grossmann [SG], grossman-at-molgen.mpg.de Mark A. Jensen, maj -at-
fortinbras -dot- us
The rest of the documentation details each of the object methods. Internal
methods are usually preceded with a _
Usage : @feats = $obj->get_SeqFeatures()
Function: Get the feature objects held by this feature holder.
Example :
Returns : an array of Bio::SeqFeatureI implementing objects
if tag specified, return features having that tag
Args : [optional] scalar string (feature tag)
Usage : $feat->add_SeqFeature($subfeat);
$feat->add_SeqFeature($subfeat,'EXPAND')
Function: Add 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 and the object implements Bio::RangeI
(which is not guaranteed), the parent''s start/end/strand
will be extended so that the new subFeature can be accomodated.
Example :
Returns : nothing
Args : a Bio::SeqFeatureI object
Usage : $obj->remove_SeqFeatures
Function: Removes all sub SeqFeatures. If you want to remove only a subset,
remove that subset from the returned array, and add back the rest.
Returns : The array of Bio::SeqFeatureI implementing sub-features that was
deleted from this feature.
Args : none
Title : feature_count
Usage : $obj->feature_count()
Function: Return the number of SeqFeatures attached to a feature holder.
This is before flattening a possible sub-feature tree.
We provide a default implementation here that just counts
the number of objects returned by get_SeqFeatures().
Implementors may want to override this with a more
efficient implementation.
Returns : integer representing the number of SeqFeatures
Args : None
At some day we may want to expand this method to allow for a feature filter to
be passed in.
Our default implementation allows for any number of additional arguments and
will pass them on to
get_SeqFeatures(). I.e., in order to support
filter arguments, just support them in
get_SeqFeatures().
Title : get_all_SeqFeatures
Usage :
Function: Get the flattened tree of feature objects held by this
feature holder. The difference to get_SeqFeatures is that
the entire tree of sub-features will be flattened out.
We provide a default implementation here, so implementors
don''t necessarily need to implement this method.
Example :
Returns : an array of Bio::SeqFeatureI implementing objects
Args : none
At some day we may want to expand this method to allow for a feature filter to
be passed in.
Our default implementation allows for any number of additional arguments and
will pass them on to any invocation of
get_SeqFeatures(), wherever a
component of the tree implements FeatureHolderI. I.e., in order to support
filter arguments, just support them in
get_SeqFeatures().