MAGE::...Defect(3pm)
π Bio::MAGE::Array::FeatureDefect β the MAGE::...Defect(3pm) page, but make it cute π
okay bestie, sit down, we're learning a Perl class together and honestly? it's giving iconic. This is from the User Contributed Perl Documentation, and the class we're stanning today is Bio::MAGE::Array::FeatureDefect.
β¨ NAME β¨
Bio::MAGE::Array::FeatureDefect β a whole class for the MAGE-OM API. no cap, that's literally it, that's the name. π
πΈ SYNOPSIS πΈ
here's the vibe. you pull the class in, you make a lil object, and you set some stuff:
use Bio::MAGE::Array::FeatureDefect
# creating an empty instance
my $featuredefect = Bio::MAGE::Array::FeatureDefect->new();
# creating an instance with existing data
my $featuredefect = Bio::MAGE::Array::FeatureDefect->new(
defectType=>$ontologyentry_ref,
propertySets=>\@namevaluetype_list,
positionDelta=>$positiondelta_ref,
feature=>$feature_ref,
);
# 'defectType' association
my $ontologyentry_ref = $featuredefect->defectType(); # getter
$featuredefect->defectType($ontologyentry_ref); # setter
# 'propertySets' association
my $namevaluetype_array_ref = $featuredefect->propertySets(); # getter
$featuredefect->propertySets(\@namevaluetype_list); # setter
# 'positionDelta' association
my $positiondelta_ref = $featuredefect->positionDelta(); # getter
$featuredefect->positionDelta($positiondelta_ref); # setter
# 'feature' association
my $feature_ref = $featuredefect->feature(); # getter
$featuredefect->feature($feature_ref); # setter
getter and setter, one method, doing both jobs. multitasking queen behavior fr fr. π
π DESCRIPTION π
straight from the MAGE-OM documentation for the "FeatureDefect" class, and I quote:
Stores the defect information for a feature.
that's it. that's the whole personality. it stores defect info for a feature. short, sweet, knows what it's about. π¦
π INHERITANCE π
Bio::MAGE::Array::FeatureDefect has exactly one superclass, and it's:
Bio::MAGE::Extendable
so yeah, it got its inheritance from up the family tree. respect the lineage. π«Ά
π CLASS METHODS π
here's the good part. every single method below can be called without even having an instance first β just go straight in with the Bio::MAGE::Array::FeatureDefect->methodname() syntax. no object required, she's independent like that. β¨
new()
new(%args)
the object constructor new() takes these optional named-value style arguments. all optional, all named-value, all cute:
defectTypeβ sets the value of the"defectType"association. the value must be of type: instance of"Bio::MAGE::Description::OntologyEntry". πpropertySetsβ sets the value of the"propertySets"association (and btw this association was inherited from class"Bio::MAGE::Extendable", so it's not even originally hers, she's just holding it). the value must be of type: array of"Bio::MAGE::NameValueType". β¨featureβ sets the value of the"feature"association. the value must be of type: instance of"Bio::MAGE::DesignElement::Feature". πpositionDeltaβ sets the value of the"positionDelta"association. the value must be of type: instance of"Bio::MAGE::Array::PositionDelta". π¦
$obj = class->new(%parameters)
the "new()" method is the class constructor. the main character, honestly.
- Parameters: if given a list of name/value parameters, the corresponding slots, attributes, or associations will have their initial values set by the constructor. so it does the work for you. slay.
- 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. sneaky lil extra step, but we love her.
@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. so don't come for her about missing stuff, that's intentional. π
- Return value: a list of the names of all slots defined for this class.
- Side effects: none. clean. no chaos. we love a low-maintenance method.
@name_list = get_attribute_names()
returns the list of attribute data members for this class. that's the whole thing, bestie. πΈ
@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. (remember her one superclass from up top? yeah, this is the method that tells you.) π
@class_list = get_subclasses()
returns the list of subclasses for this class. π
$name = class_name()
returns the full class name for this class. full government name, no nicknames. π
$package_name = package_name()
returns the base package name (i.e. no 'namespace::') of the package that contains this class. so just the base, she's not giving you the whole address. π
%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. meta-info about the meta-info. very meta of her. πͺβ¨
okay that's part one bestie, don't go anywhere, there's more. π
β¨ INSTANCE METHODS β¨
$obj_copy = $obj->new()
ok so when you call new() on an actual object reference instead of on a class name, it turns into a copy constructor β the brand-new object gets its initial values straight-up copied from the old one. it's giving photocopier but make it iconic π
- Parameters: literally none, bestie β the copy constructor doesn't take any input parameters, the initial values just get yoinked directly from the object you're copying.
- Return value: a reference to an object of the class. π«Ά
- Side effects: it invokes the
initialize()method if the class defines one.
$obj->set_slots(%parameters) and $obj->set_slots(\@name_list, \@value_list)
the set_slots() method is your girl for setting a whole bunch of slots at once. she's flexible like that β two different ways to call her:
- the first flavor takes a named parameter list
- the second flavor takes two array references
- Return value: none (she's doing the work, not the talking π )
- Side effects: she will call
croak()if you use a slot_name that the class doesn't even define. so like, don't do that.
@obj_list = $obj->get_slots(@name_list)
the get_slots() method grabs the values of a bunch of slots all at the same time. efficiency queen. π
- 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. one slot, one value, no drama.
- 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.
Bio::MAGE::Array::FeatureDefect has the following attribute accessor methods:
π¦ 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:
- 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::Array::FeatureDefect has the following association accessor methods:
defectType
Methods for the defectType association.
From the MAGE-OM documentation:
Indicates the type of defect (e.g. a missing feature or a moved feature).
$val = $featuredefect->setDefectType($val)
The restricted setter method for the defectType association.
- Input parameters: the value to which the
defectTypeassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
defectTypeassociation : one of the accepted enumerated values. - Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified, or if$valis not an instance of classBio::MAGE::Description::OntologyEntry
$val = $featuredefect->getDefectType()
The restricted getter method for the defectType association.
- Input parameters: none
- Return value: the current value of the
defectTypeassociation : an instance of typeBio::MAGE::Description::OntologyEntry. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
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.
$array_ref = $featuredefect->setPropertySets($array_ref)
The restricted setter method for the propertySets association.
- Input parameters: the value to which the
propertySetsassociation will be set : a reference to an array of objects of typeBio::MAGE::NameValueType - Return value: the current value of the
propertySetsassociation : a reference to an array of objects of typeBio::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 classBio::MAGE::NameValueTypeinstances
$array_ref = $featuredefect->getPropertySets()
The restricted getter method for the propertySets association.
- Input parameters: none
- Return value: the current value of the
propertySetsassociation : a reference to an array of objects of typeBio::MAGE::NameValueType - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
$val = $featuredefect->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.
- Input parameters: the list of values
@valsto add to the propertySets association. NOTE: submitting a single value is permitted. (she accepts a party of one, we love a flexible queen π ) - 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 classBio::MAGE::NameValueType
feature
Methods for the feature association.
From the MAGE-OM documentation:
The feature that was manufactured defectively.
$val = $featuredefect->setFeature($val)
The restricted setter method for the feature association.
- Input parameters: the value to which the
featureassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
featureassociation : one of the accepted enumerated values. - Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified, or if$valis not an instance of classBio::MAGE::DesignElement::Feature
$val = $featuredefect->getFeature()
The restricted getter method for the feature association.
- Input parameters: none
- Return value: the current value of the
featureassociation : an instance of typeBio::MAGE::DesignElement::Feature. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
positionDelta
Methods for the positionDelta association.
From the MAGE-OM documentation:
How the feature deviates in position from the ArrayDesign.
$val = $featuredefect->setPositionDelta($val)
The restricted setter method for the positionDelta association.
- Input parameters: the value to which the
positionDeltaassociation will be set : one of the accepted enumerated values. - Return value: the current value of the
positionDeltaassociation : one of the accepted enumerated values. - Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if too many input parameters are specified, or if$valis not an instance of classBio::MAGE::Array::PositionDelta
$val = $featuredefect->getPositionDelta()
The restricted getter method for the positionDelta association.
- Input parameters: none
- Return value: the current value of the
positionDeltaassociation : an instance of typeBio::MAGE::Array::PositionDelta. - Side effects: none
- Exceptions: will call
croak()if any input parameters are specified
and then there's this lil guy just vibing at the bottom of the association list, no cap:
sub initialize {
my $self = shift;
return 1;
}
β¨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS β¨
Okay bestie, real talk: in the Perl implementation of MAGE-OM classes, there are literally three flavors of class data members, and they are slots, attributes, and associations. That's the whole vibe check.
πΈ SLOTS πΈ
So in this API, a slot is a data member that was not in the UML model, and it's mainly for internal stuff. The manual is like: use only if you understand the inner workings of the API, bestie. Most often slots get used by generic methods, like the ones in the XML writing and reading classes. No cap.
Slots are implemented using unified getter/setter methods:
$var = $obj->slot_name();β retrieves the current value of the slot. It's giving "just look at it."$new_var = $obj->slot_name($new_var);β stores$new_varin the slot, and the return value is also$new_var. Iconic little mirror moment.@names = $obj->get_slot_names()β returns the list of all slots in the class. Slay.
DATA CHECKING: No data type checking is made for these methods. So yeah, no gatekeeping, no safety net, fr fr.
π ATTRIBUTES AND ASSOCIATIONS π
The terms attribute and association indicate data members of the class that were specified directly from the UML model. Main character data, basically.
In the Perl implementation of MAGE-OM classes, association and attribute accessors are implemented using three separate methods:
get*β retrieves the current value.
NOTE: For associations, if the association has list cardinality, an array reference is returned.
DATA CHECKING: Ensure that no argument is provided.
set*β sets the current value, replacing any existing value. It's giving "out with the old, in with the new."
NOTE: For associations, if the association has list cardinality, the argument must be an array reference. Because of this, you probably should be using the add* methods.
DATA CHECKING: For attributes, ensure that a single value is provided as the argument. For associations, if the association has list cardinality, ensure that the argument is a reference to an array of instances of the correct MAGE-OM class, otherwise ensure that there is a single argument of the correct MAGE-OM class.
add*β
NOTE: Only present in associations with list cardinality.
Appends a list of objects to any values that may already be stored in the association. DATA CHECKING: Ensure that all arguments are of the correct MAGE-OM class.
π GENERIC METHODS π
The unified base class of all MAGE-OM classes, Bio::MAGE::Base, provides a set of generic methods that will operate on slots, attributes, and associations. She's versatile, okay?
$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. Iykyk, go scroll.
π BUGS π
Please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net). Not me being dramatic, but bugs are not the vibe.
π 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:
- Around line 356:
'=item' outside of any '=over'
- Around line 441:
You forgot a '=back' before '=head2'
- Around line 469:
Expected '=item 2'
- Around line 474:
Expected '=item 3'
- Around line 479:
Expected '=item 4'
This little legend was served up by perl v5.32.0, dated 2020-11-27, for MAGE::...Defect(3pm). Stay iconic, bestie πβ¨
π¦ 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