Bio::S...eneric(3pm)
πΈ Bio::SeqFeature::Generic β Generic SeqFeature π
okay bestie, welcome to the manual page for Bio::SeqFeature::Generic (that's the 3pm one, perl module, you know the drill). it's giving "the humble little object that runs the whole feature game." let's get into it β¨
β¨ NAME β¨
Bio::SeqFeature::Generic β literally just a Generic SeqFeature, no cap π¦
π SYNOPSIS π
bestie here's how you actually make one:
$feat = Bio::SeqFeature::Generic->new(
-start => 10,
-end => 100,
-strand => -1,
-primary => 'repeat', # -primary_tag is a synonym
-source_tag => 'repeatmasker',
-display_name => 'alu family',
-score => 1000,
-tag => { new => 1,
author => 'someone',
sillytag => 'this is silly!' } );
$feat = Bio::SeqFeature::Generic->new( -gff_string => $string );
# if you want explicitly GFF1
$feat = Bio::SeqFeature::Generic->new( -gff1_string => $string );
# add it to an annotated sequence
$annseq->add_SeqFeature($feat);
yes the sillytag is real, i love that for us ππ
π DESCRIPTION π
so Bio::SeqFeature::Generic is a generic implementation of the Bio::SeqFeatureI interface β it's a simple little object that carries all the info you need for a feature sitting on a sequence. one job, does it well, iconic behavior honestly π
for lots of features, this is genuinely all you need. like, repeats in DNA sequence? domains in protein sequence? yeah, this class carries it, done, periodt. π
but for the features that have more structure going on, this is a great base class to extend via inheritance and add your own stuff. that's literally what Bio::SeqFeature::Gene, Bio::SeqFeature::Transcript and Bio::SeqFeature::Exon do β they give you well coordinated classes for representing genes on DNA sequence (like, for example, you can pull the protein sequence out of a transcript class. slay π₯).
now here's the tea β β for tons of features you wanna attach a little extra info. a super common one: this feature is 'new' while other features are 'old'. enter the tag system, which here is implemented using a hash. you can use the tag system to extend Bio::SeqFeature::Generic programmatically β meaning you know you read more info into the tag 'mytag' and you can go grab it back later. the way this saves you: you do not need to know how to write inherited Perl just to slap more complex info on a feature. and/or, if you do know how but you're not tryna write a whole new class every single time you need one extra piece of info β just use the tag system to store and retrieve that info. easy. no drama. π«Ά
the tag system can be written in/out of GFF format, and also into EMBL format via the Bio::SeqIO system β¨
π Implemented Interfaces π
this class implements the following interfaces, bestie:
Bio::SeqFeatureIβ note that this includes implementingBio::RangeI. it's giving range-queen energy.Bio::AnnotatableIBio::FeatureHolderIβ features held by a feature are essentially sub-features. feature-ception fr fr π
π FEEDBACK π
π¬ Mailing Lists π¬
user feedback is an integral part of the evolution of this and other Bioperl modules. send your comments and suggestions preferably to one of the Bioperl mailing lists. your participation is much appreciated, truly π₯Ή
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
π«Ά Support π«Ά
please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. there are so many experienced and responsive experts who will be able to look at the problem and quickly address it. and please include a thorough description of the problem with code and data examples if at all possible β context is everything bestie π
π Reporting Bugs π
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
π AUTHOR - Ewan Birney π
Ewan Birney <birney@sanger.ac.uk>
π οΈ DEVELOPERS π οΈ
this class has been written with an eye out for inheritance. the fields in the actual object hash are:
_gsf_tag_hash = reference to a hash for the tags
_gsf_sub_array = reference to an array for subfeatures
π APPENDIX π
the rest of the documentation details each of the object methods. internal methods are usually preceded with a _ (iykyk π)
π set_attributes π
Title : set_attributes
Usage :
Function: Sets a whole array of parameters at once.
Example :
Returns : none
Args : Named parameters, in the form as they would otherwise be passed
to new(). Currently recognized are:
-start start position
-end end position
-strand strand
-phase the phase of the feature (0..2)
-primary_tag primary tag
-primary (synonym for -primary_tag)
-source_tag source tag
-source (synonym for -source_tag)
-frame frame
-score score value
-tag a reference to a tag/value hash
-gff_string GFF v.2 string to initialize from
-gff1_string GFF v.1 string to initialize from
-seq_id the display name of the sequence
-annotation the AnnotationCollectionI object
-location the LocationI object
π direct_new π
Title : direct_new
Usage : my $feat = Bio::SeqFeature::Generic->direct_new;
Function: create a blessed hash - for performance improvement in
object creation
Returns : Bio::SeqFeature::Generic object
Args : none
π location π
Title : location
Usage : my $location = $feat->location();
Function: returns a location object suitable for identifying location
of feature on sequence or parent feature
Returns : Bio::LocationI object
Args : [optional] Bio::LocationI object to set the value to.
π start π
Title : start
Usage : my $start = $feat->start;
$feat->start(20);
Function: Get/set on the start coordinate of the feature
Returns : integer
Args : none
π end π
Title : end
Usage : my $end = $feat->end;
$feat->end($end);
Function: get/set on the end coordinate of the feature
Returns : integer
Args : none
π length π
Title : length
Usage : my $len = $feat->length;
Function: Get the feature length computed as:
$feat->end - $feat->start + 1
Returns : integer
Args : none
π strand π
Title : strand
Usage : my $strand = $feat->strand();
$feat->strand($strand);
Function: get/set on strand information, being 1,-1 or 0
Returns : -1,1 or 0
Args : none
π score π
Title : score
Usage : my $score = $feat->score();
$feat->score($score);
Function: get/set on score information
Returns : float
Args : none if get, the new value if set
π frame π
Title : frame
Usage : my $frame = $feat->frame();
$feat->frame($frame);
Function: get/set on frame information
Returns : 0,1,2, '.'
Args : none if get, the new value if set
π primary_tag π
Title : primary_tag
Usage : my $tag = $feat->primary_tag();
$feat->primary_tag('exon');
Function: get/set on the primary tag for a feature,
eg 'exon'
Returns : a string
Args : none
π source_tag π
Title : source_tag
Usage : my $tag = $feat->source_tag();
$feat->source_tag('genscan');
Function: Returns the source tag for a feature,
eg, 'genscan'
Returns : a string
Args : none
π has_tag π
Title : has_tag
Usage : my $value = $feat->has_tag('some_tag');
Function: Tests whether a feature containings a tag
Returns : TRUE if the SeqFeature has the tag,
and FALSE otherwise.
Args : The name of a tag
π add_tag_value π
Title : add_tag_value
Usage : $feat->add_tag_value('note',"this is a note");
Returns : TRUE on success
Args : tag (string) and one or more values (any scalar(s))
π get_tag_values π
Title : get_tag_values
Usage : my @values = $feat->get_tag_values('note');
Function: Returns a list of all the values stored
under a particular tag.
Returns : A list of scalars
Args : The name of the tag
π get_all_tags π
Title : get_all_tags
Usage : my @tags = $feat->get_all_tags();
Function: Get a list of all the tags in a feature
Returns : An array of tag names
Args : none
and then there's this little dev note, preserved for the culture:
# added a sort so that tags will be returned in a predictable order # I
still think we should be able to specify a sort function # to the object
at some point # -js
π remove_tag π
Title : remove_tag
Usage : $feat->remove_tag('some_tag');
Function: removes a tag from this feature
Returns : the array of values for this tag before removing it
Args : tag (string)
π attach_seq π
Title : attach_seq
Usage : $feat->attach_seq($seq);
Function: Attaches a Bio::Seq object to this feature. This
Bio::Seq object is for the *entire* sequence: ie
from 1 to 10000
Example :
Returns : TRUE on success
Args : a Bio::PrimarySeqI compliant object
π seq π
Title : seq
Usage : my $tseq = $feat->seq();
Function: returns the truncated sequence (if there) for this
Example :
Returns : sub seq (a Bio::PrimarySeqI compliant object) on attached sequence
bounded by start & end, or undef if there is no sequence attached.
If the strand is defined and set to -1, the returned sequence is
the reverse-complement of the region
Args : none
π entire_seq π
Title : entire_seq
Usage : my $whole_seq = $feat->entire_seq();
Function: gives the entire sequence that this seqfeature is attached to
Example :
Returns : a Bio::PrimarySeqI compliant object, or undef if there is no
sequence attached
Args :
π seq_id π
Title : seq_id
Usage : $feat->seq_id($newval)
Function: There are many cases when you make a feature that you
do know the sequence name, but do not know its actual
sequence. This is an attribute such that you can store
the ID (e.g., display_id) of the sequence.
This attribute should *not* be used in GFF dumping, as
that should come from the collection in which the seq
feature was found.
Returns : value of seq_id
Args : newvalue (optional)
β οΈ bestie listen β that seq_id one says it should not be used in GFF dumping, okay? that info comes from the collection where the seq feature was found. don't do it. i'm looking at you. π«΅
π display_name π
Title : display_name
Usage : my $featname = $feat->display_name;
Function: Implements the display_name() method, which is a human-readable
name for the feature.
Returns : value of display_name (a string)
Args : Optionally, on set the new value or undef
okay and that's where part 1 wraps, but don't go anywhere bestie β there's more coming β¨
π Methods for implementing Bio::AnnotatableI π
π annotation
- Title:
annotation - Usage:
$feat->annotation($annot_obj); - Function: get/set the annotation collection object that's annotating this feature, bestie π
- Example: (none given, we're keeping it mysterious)
- Returns: a Bio::AnnotationCollectionI object
- Args: newvalue (optional)
π¦ Methods to implement Bio::FeatureHolderI π¦
okay so this is the whole feature-holding situation: grabbing features, adding features, yeeting features. And because this thing is already a feature, the features it holds are basically its sub-features. it's giving nesting. it's giving family tree. π«Ά
πΈ get_SeqFeatures
- Title:
get_SeqFeatures - Usage:
my @feats = $feat->get_SeqFeatures(); - Function: returns an array of sub Sequence Features
- Returns: an array
- Args: none
β¨ add_SeqFeature
- Title:
add_SeqFeature - Usage:
$feat->add_SeqFeature($subfeat);
$feat->add_SeqFeature($subfeat,'EXPAND');
- Function: adds a SeqFeature into the subSeqFeature array.
With no 'EXPAND' qualifier, subfeat gets vibe-checked to see whether it lies inside the parent, and it throws an exception if it doesn't. no cap, it will absolutely throw.
If EXPAND is used, the parent's start/end/strand get adjusted so that it grows to accommodate the new subFeature. glow-up via expansion π¦
!IMPORTANT! The coordinates of the subfeature should not be relative to the parent feature it is attached to β they should be relative to the sequence the parent feature is located on. do not come for me on this one, it matters so much.
- Returns: nothing
- Args: an object which has the SeqFeatureI interface
π remove_SeqFeatures
- Title:
remove_SeqFeatures - Usage:
$feat->remove_SeqFeatures; - Function: removes all SeqFeatures. all of them. gone. β¨
If you want to remove only a subset of features, then remove that subset from the returned array, and add back the rest. (yes it's a lil manual but that's the way, iykyk)
- Example: (none given)
- Returns: the array of Bio::SeqFeatureI implementing features that was deleted
- Args: none
π GFF-related methods π
π gff_format
- Title:
gff_format - Usage:
# get:
my $gffio = $feat->gff_format();
# set (change the default version of GFF2):
$feat->gff_format(Bio::Tools::GFF->new(-gff_version => 1));
- Function: get/set the GFF format interpreter. This object is supposed to format and parse GFF. See Bio::Tools::GFF for the interface π
If this method is called as a class method, the default for all newly created instances will be changed. Otherwise only this instance will be affected. class-method call = everyone gets the new vibe. periodt.
- Example: (none given)
- Returns: a Bio::Tools::GFF compliant object
- Args: on set, an instance of Bio::Tools::GFF or a derived object
π§ gff_string
- Title:
gff_string - Usage:
my $str = $feat->gff_string;
my $str = $feat->gff_string($gff_formatter);
- Function: provides the feature information in GFF format. π
We override this here from Bio::SeqFeatureI in order to use the formatter returned by gff_format().
- Returns: a string
- Args: optionally, an object implementing
gff_string()
π slurp_gff_file
- Title:
slurp_file
(yes, the title says slurp_file and the method is slurp_gff_file. iconic. we don't edit the lore, we just report it π
)
- Usage:
my @features = Bio::SeqFeature::Generic::slurp_gff_file(\*FILE); - Function: sneaky little function to load an entire file as in-memory objects.
Beware of big files. π«£ like, actually. it slurps everything.
This method is deprecated. Use Bio::Tools::GFF instead, which can also handle large files. please bestie, it's for your own good.
- Example: (none given)
- Returns: (none given)
- Args: (none given)
β _from_gff_string
- Title:
_from_gff_string - Usage: (none given)
- Function: set feature properties from a GFF string.
This method uses the object returned by gff_format() for the actual interpretation of the string. Set a different GFF format interpreter first if you need a specific version, like GFF1. (The default is GFF2.)
- Example: (none given)
- Returns: (none given)
- Args: a GFF-formatted string
π _expand_region
- Title:
_expand_region - Usage:
$feat->_expand_region($feature); - Function: expand the total region covered by this feature so it can accommodate the given feature. π±
May be called whenever any kind of subfeature is added to this feature. add_SeqFeature() already does this.
- Returns: (none given)
- Args: a Bio::SeqFeatureI implementing object
π _parse
- Title:
_parse - Usage: (none given)
- Function: parsing hints
- Example: (none given)
- Returns: (none given)
- Args: (none given)
π₯ _tag_value
- Title:
_tag_value - Usage: (none given)
- Function: for internal use only. convenience method for those tags that may only have a single value.
- Returns: the first value under the given tag as a scalar (string)
- Args: the tag as a string. Optionally, the value on set.
and that's the whole page, bestie, we made it to the end together π₯Ήπ this lil doc drop is perl v5.32.1, dated 2021-08-15, and it lives under the Bio::S...eneric(3pm) banner in the User Contributed Perl Documentation. go forth and annotate responsibly πβ¨
π¦ where this page comes from
- debian bookworm: libbio-perl-perl 1.7.8-1 Β· Perl
- debian trixie: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu jammy: libbio-perl-perl 1.7.8-1 Β· Perl
- ubuntu noble: libbio-perl-perl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms