MAGE::...osition(3pm)
π NAME π
Bio::MAGE::BioSequence::SequencePosition β the class for the MAGE-OM API, bestie. This page is MAGE::...osition(3pm), from the User Contributed Perl Documentation corner of the universe. π¦
β¨ SYNOPSIS β¨
Okay so here's the whole vibe of how you actually use this thing:
use Bio::MAGE::BioSequence::SequencePosition
# creating an empty instance
my $sequenceposition = Bio::MAGE::BioSequence::SequencePosition->new();
# creating an instance with existing data
my $sequenceposition = Bio::MAGE::BioSequence::SequencePosition->new(
end=>$end_val,
start=>$start_val,
propertySets=>\@namevaluetype_list,
);
# 'end' attribute
my $end_val = $sequenceposition->end(); # getter
$sequenceposition->end($value); # setter
# 'start' attribute
my $start_val = $sequenceposition->start(); # getter
$sequenceposition->start($value); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $sequenceposition->propertySets(); # getter
$sequenceposition->propertySets(\@namevaluetype_list); # setter
No cap, that's the entire personality of this module right there. π
πΈ DESCRIPTION πΈ
Straight from the MAGE-OM documentation for the "SequencePosition" class:
Designates the position of the Feature in its BioSequence.
That's it, that's the whole job. It's giving "I know exactly where you are in the sequence" energy. π
π INHERITANCE π
Bio::MAGE::BioSequence::SequencePosition has the following superclasses:
Bio::MAGE::Extendable
Bio::MAGE::BioSequence::SequencePosition has the following subclasses:
Bio::MAGE::DesignElement::ReporterPositionBio::MAGE::DesignElement::CompositePosition
So it's got ancestors and it's got children. Literally the main character of a family tree. π
β CLASS METHODS β
Okay so these ones? You can call them without even making an instance first. Just go straight in with the Bio::MAGE::BioSequence::SequencePosition->methodname() syntax. Iconic behavior, honestly.
new()
new(%args)
The object constructor "new()" accepts the following optional named-value style arguments:
endβ sets the value of the"end"attributestartβ sets the value of the"start"attributepropertySetsβ sets the value of the"propertySets"association (and yes, this association was inherited from class"Bio::MAGE::Extendable", so shoutout to the parent class π). The value must be of type: array of"Bio::MAGE::NameValueType".
$obj = class->new(%parameters)
The "new()" method is the class constructor. The whole blueprint. ποΈ
- Parameters: if you hand it a list of name/value parameters, the corresponding slots, attributes, or associations will have their initial values set by the constructor.
- Return value: it returns a reference to an object of the class.
- Side effects: it invokes the
"initialize()"method if it is defined by the class.
@names = class->get_slot_names()
The "get_slot_names()" method is used to retrieve the name of all slots defined in a given class.
NOTE: the list of names does not include attribute or association names. Like, don't come for it, it said what it said.
- Return value: a list of the names of all slots defined for this class.
- Side effects: none
@name_list = get_attribute_names()
Returns the list of attribute data members for this class. Slay. β¨
@name_list = get_association_names()
Returns the list of association data members for this class.
@class_list = get_superclasses()
Returns the list of superclasses for this class.
@class_list = get_subclasses()
Returns the list of subclasses for this class.
$name = class_name()
Returns the full class name for this class.
$package_name = package_name()
Returns the base package name (i.e. no 'namespace::') of the package that contains this class.
%assns = associations()
Returns the association meta-information in a hash where the keys are the association names and the values are "Association" objects that provide the meta-information for the association.
π«Ά INSTANCE METHODS π«Ά
Now we're in the part where you actually have an object in your hands. Let's go. π
$obj_copy = $obj->new()
When invoked with an existing object reference and not a class name, the "new()" method acts as a copy constructor β with the new object's initial values set to be those of the existing object. It's giving clone saga, but make it legal. π―
- Parameters: no input parameters are used in the copy constructor, the initial values are taken directly from the object to be copied.
- Return value: it returns a reference to an object of the class.
- Side effects: it invokes the
"initialize()"method if it is defined by the class.
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
The "set_slots()" method is used to set a number of slots at the same time. It has two different invocation methods: the first takes a named parameter list, and the second takes two array references. Choose your fighter. π₯
- Return value: none
- Side effects: will call
"croak()"if a slot_name is used that the class does not define.
@obj_list = $obj->get_slots(@name_list)
The "get_slots()" method is used to get the values of a number of slots at the same time.
- Return value: a list of instance objects
- Side effects: none
$val = $obj->set_slot($name,$val)
The "set_slot()" method sets the slot $name to the value $val.
- Return value: the new value of the slot, i.e.
$val - Side effects: none
$val = $obj->get_slot($name)
The "get_slot()" method is used to get the values of a number of slots at the same time.
- Return value: a single slot value, or
undefif the slot has not been initialized. - Side effects: none
π ATTRIBUTES π
Attributes are simple data types that belong to a single instance of a class. In the Perl implementation of the MAGE-OM classes, the interface to attributes is implemented using separate setter and getter methods for each attribute. Two methods, one attribute, very demure. π
"Bio::MAGE::BioSequence::SequencePosition" has the following attribute accessor methods:
end
Methods for the "end" attribute.
From the MAGE-OM documentation:
The location of the base, for nucleotides, that the SeqFeature ends.
$val = $sequenceposition->setEnd($val)
The restricted setter method for the "end" attribute.
- Input parameters: the value to which the
"end"attribute will be set - Return value: the current value of the
"end"attribute - Side effects: none
- Exceptions: will call
"croak()"if no input parameters are specified, or if too many input parameters are specified
$val = $sequenceposition->getEnd()
The restricted getter method for the "end" attribute.
- Input parameters: none
- Return value: the current value of the
"end"attribute - Side effects: none
- Exceptions: will call
"croak()"if any input parameters are specified
start
Methods for the "start" attribute.
From the MAGE-OM documentation:
The location of the base, for nucleotides, that the SeqFeature starts.
$val = $sequenceposition->setStart($val)
The restricted setter method for the "start" attribute.
- Input parameters: the value to which the
"start"attribute will be set - Return value: the current value of the
"start"attribute - Side effects: none
- Exceptions: will call
"croak()"if no input parameters are specified, or if too many input parameters are specified
$val = $sequenceposition->getStart()
The restricted getter method for the "start" attribute.
- Input parameters: none
- Return value: the current value of the
"start"attribute - Side effects: none
- Exceptions: will call
"croak()"if any input parameters are specified
π ASSOCIATIONS π
Associations are references to other classes. Associations in MAGE-OM have a cardinality that determines the minimum and maximum number of instances of the 'other' class that maybe included in the association. Here's the whole breakdown, bestie β memorize it, it comes up:
- There must be exactly one item in the association, i.e. this is a mandatory data field.
0..1
There may be one item in the association, i.e. this is an optional data field.
1..N
There must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.
0..N
There may be one or more items in the association, i.e. this is an optional data field, with list cardinality.
Bio::MAGE::BioSequence::SequencePosition has the following association accessor methods:
propertySets
Methods for the "propertySets" association.
From the MAGE-OM documentation:
Allows specification of name/value pairs. Meant to primarily help in-house, pipeline processing of instances by providing a place for values that aren't part of the specification proper.
It's the little junk drawer of the class, and honestly? Respect it. π
$array_ref = $sequenceposition->setPropertySets($array_ref)
The restricted setter method for the "propertySets" association.
- Input parameters: the value to which the
"propertySets"association will be set : a reference to an array of objects of type"Bio::MAGE::NameValueType" - Return value: the current value of the
"propertySets"association : a reference to an array of objects of type"Bio::MAGE::NameValueType" - Side effects: none
- Exceptions: will call
"croak()"if no input parameters are specified, or if too many input parameters are specified, or if$array_refis not a reference to an array class"Bio::MAGE::NameValueType"instances
$array_ref = $sequenceposition->getPropertySets()
The restricted getter method for the "propertySets" association.
- Input parameters: none
- Return value: the current value of the
"propertySets"association : a reference to an array of objects of type"Bio::MAGE::NameValueType" - Side effects: none
- Exceptions: will call
"croak()"if any input parameters are specified
$val = $sequenceposition->addPropertySets(@vals)
Because the propertySets association has list cardinality, it may store more than one value. This method adds the current list of objects in the propertySets association. Go off, add as many as you want. π₯
- Input parameters: the list of values
@valsto add to the propertySets association. NOTE: submitting a single value is permitted. - Return value: the number of items stored in the slot after adding
@vals - Side effects: none
- Exceptions: will call
"croak()"if no input parameters are specified, or if any of the objects in@valsis not an instance of class"Bio::MAGE::NameValueType"
sub initialize {
my $self = shift;
return 1;
}
π SLOTS, ATTRIBUTES, AND ASSOCIATIONS π
Okay so bestie, in the Perl implementation of MAGE-OM classes there are literally three flavours of class data members, and you need to know which is which or you're gonna have a bad time:
- slots
- attributes
- associations
β¨ SLOTS β¨
So the tea on "slots" π β this API uses the word slot for a data member that was not in the UML model at all. They're mainly for internal purposes, so likeβ¦ only touch these if you genuinely understand the inner workings of the API, no cap. Most of the time slots are what the generic methods use β think the stuff in the XML writing and reading classes.
Slots run on unified getter/setter methods, one method doing both jobs:
$var = $obj->slot_name();β grabs the current value of the slot. that's it, that's the whole vibe π$new_var = $obj->slot_name($new_var);β stashes$new_varin the slot, and the return value is also$new_var(yes, same thing, iconic behaviour honestly).@names = $obj->get_slot_names()β hands you back the list of all the slots in the class. every single one. π«Ά
DATA CHECKING: nope. zero. none. No data type checking is made for these methods. so like, be careful bestie π
π ATTRIBUTES AND ASSOCIATIONS π
Now "attribute" and "association" mean something different β these are data members of the class that were specified directly from the UML model. the real ones. the main characters. π
In the Perl implementation of MAGE-OM classes, association and attribute accessors get implemented as three separate methods:
get*β Retrieves the current value.
NOTE: for associations, if the association has list cardinality, you get back an array reference. that's the deal.
DATA CHECKING: make sure you pass no argument. zero args. don't even think about it.
set*β Sets the current value, replacing whatever was already there. out with the old π
NOTE: for associations, if the association has list cardinality, the argument must be an array reference. which is exactly why you probably should be using the add* methods instead β like, fr fr, just use add*.
DATA CHECKING: for attributes, make sure a single value is provided as the argument. for associations, if the association has list cardinality, make sure the argument is a reference to an array of instances of the correct MAGE-OM class β otherwise make sure there's a single argument of the correct MAGE-OM class. got it? got it. β¨
add*β NOTE: this one's only present in associations with list cardinality, so don't go looking for it everywhere.
It appends a list of objects to any values that may already be stored in the association β so it adds, it doesn't nuke what's there. sooo much safer than set* for lists.
DATA CHECKING: make sure all the arguments are of the correct MAGE-OM class. all of them. every last one.
π¦ GENERIC METHODS π¦
The unified base class of all MAGE-OM classes, Bio::MAGE::Base, serves up a whole set of generic methods that will operate on slots, attributes, and associations. equal opportunity methods honestly:
$val = $obj->get_slot($name)
\@list_ref = $obj->get_slots(@name_list);
$val = $obj->set_slot($name,$val)
$obj->set_slots(%parameters)
$obj->set_slots(\@name_list, \@value_list)
See elsewhere in this page for a detailed description of these methods. π go look, bestie, it's all there.
π BUGS π
Found something cursed? Please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net)
π AUTHOR π
Jason E. Stewart (jasons 'at' cpan 'dot' org)
π SEE ALSO π
π POD ERRORS π
Hey! The above document had some coding errors, which are explained below. not me snitching on the docs but here we are π
- Around line 288:
'=item' outside of any '=over'
- Around line 373:
- You forgot a
'=back'before a'=head2'
- You forgot a
- Around line 545:
- Expected
'=item 2'
- Expected
- Around line 550:
- Expected
'=item 3'
- Expected
- Around line 555:
- Expected
'=item 4'
- Expected
okay that's the whole page bestie, you made it to the end and I'm so proud of you π₯Ήπ this lil doc is perl v5.32.0, dated 2020-11-27, and it's the MAGE::...osition(3pm) page β now go forth and slot responsibly, mwah π
β¨
π¦ where this page comes from
- debian bookworm: libbio-mage-perl 20030502.3-6 Β· MIT
- debian trixie: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu jammy: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu noble: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu resolute: libbio-mage-perl 20030502.3-6 Β· MIT
- ubuntu stonking: libbio-mage-perl 20030502.3-6 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms