BioPerl
view release on metacpan or search on metacpan
Bio/SeqFeature/Lite.pm view on Meta::CPAN
All methods are as described in L<Bio::SeqFeatureI> with the following additions:
=head2 The new() Constructor
$feature = Bio::SeqFeature::Lite->new(@args);
This method creates a new feature object. You can create a simple
feature that contains no subfeatures, or a hierarchically nested object.
Arguments are as follows:
-seq_id the reference sequence
-start the start position of the feature
-end the stop position of the feature
-stop an alias for end
-name the feature name (returned by seqname())
-type the feature type (returned by primary_tag())
-primary_tag the same as -type
-source the source tag
-score the feature score (for GFF compatibility)
-desc a description of the feature
-segments a list of subfeatures (see below)
-subtype the type to use when creating subfeatures
-strand the strand of the feature (one of -1, 0 or +1)
-phase the phase of the feature (0..2)
-seq a dna or protein sequence string to attach to feature
-id an alias for -name
-seqname an alias for -name
-display_id an alias for -name
-display_name an alias for -name (do you get the idea the API has changed?)
-primary_id unique database ID
-url a URL to link to when rendered with Bio::Graphics
-attributes a hashref of tag value attributes, in which the key is the tag
and the value is an array reference of values
-factory a reference to a feature factory, used for compatibility with
more obscure parts of Bio::DB::GFF
The subfeatures passed in -segments may be an array of
Bio::SeqFeature::Lite objects, or an array of [$start,$stop]
pairs. Each pair should be a two-element array reference. In the
latter case, the feature type passed in -subtype will be used when
creating the subfeatures.
If no feature type is passed, then it defaults to "feature".
=head2 Non-SeqFeatureI methods
A number of new methods are provided for compatibility with
Ace::Sequence, which has a slightly different API from SeqFeatureI:
=over 4
=item url()
Get/set the URL that the graphical rendering of this feature will link to.
=item add_segment(@segments)
Add one or more segments (a subfeature). Segments can either be
Feature objects, or [start,stop] arrays, as in the -segments argument
to new(). The feature endpoints are automatically adjusted.
=item segments()
An alias for sub_SeqFeature().
=item get_SeqFeatures()
Alias for sub_SeqFeature()
=item get_all_SeqFeatures()
Alias for sub_SeqFeature()
=item merged_segments()
Another alias for sub_SeqFeature().
=item stop()
An alias for end().
=item name()
An alias for seqname().
=item exons()
An alias for sub_SeqFeature() (you don't want to know why!)
=back
=cut
use strict;
use base qw(Bio::Root::Root Bio::SeqFeatureI Bio::LocationI Bio::SeqI);
*stop = \&end;
*info = \&name;
*seqname = \&name;
*exons = *sub_SeqFeature = *merged_segments = \&segments;
*get_all_SeqFeatures = *get_SeqFeatures = \&segments;
*method = \&primary_tag;
*source = \&source_tag;
*get_tag_values = \&each_tag_value;
*add_SeqFeature = \&add_segment;
*get_all_tags = \&all_tags;
*abs_ref = \&ref;
# implement Bio::SeqI and FeatureHolderI interface
sub primary_seq { return $_[0] }
sub annotation {
my ($obj,$value) = @_;
if( defined $value ) {
$obj->throw("object of class ".ref($value)." does not implement ".
"Bio::AnnotationCollectionI. Too bad.")
unless $value->isa("Bio::AnnotationCollectionI");
$obj->{'_annotation'} = $value;
} elsif( ! defined $obj->{'_annotation'}) {
( run in 0.641 second using v1.01-cache-2.11-cpan-39bf76dae61 )