MAGE(3pm)
π NAME π
Bio::MAGE β bestie, this is the container module for all the classes in the MAGE package: MAGE π
(also, for the record, this page lives in section 3pm of the manual, and it's a User Contributed Perl Documentation page π)
β¨ SYNOPSIS β¨
use Bio::MAGE;
π¦ DESCRIPTION π¦
Okay so here's the tea: this is a package module, and it's the lil' container that wraps up a whole bunch of classes in the Bio::MAGE hierarchy. Those classes all belong to the MAGE package of the MAGE-OM object model. That's it, that's the vibe. π
πΈ CLASSES πΈ
The Bio::MAGE module is home to these Bio::MAGE classes:
NameValueTypeExtendableIdentifiableDescribable
π CLASS METHODS π
@class_list = Bio::MAGE::classes();β gimme the list, bestie. This one returns a list of class names that are not fully qualified (meaning: they do not have'Bio::MAGE::'slapped on the front as a prefix) that live in this package. π@list_names = Bio::MAGE::xml_packages();β returns an ordered list of the MAGE-ML packages that exist in the top level MAGE-ML element. β¨$hash_ref = Bio::MAGE::class2fullclass();β this returns a hash table (a hash ref, okay) that maps the fully qualified class name of a class, given the abbreviated name, for the completeBio::MAGEclass hierarchy. iykyk π«Ά$obj = class->new(%parameters)β thenew()method is literally the class constructor. periodt.- Parameters: if you hand it a list of name/value parameters, the corresponding slots, attributes, or associations get 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()β theget_slot_names()method is how you retrieve the name of all slots defined in a given class.
NOTE: the list of names does not include attribute or association names. don't be fooled, bestie π
- 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. β¨@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. the ancestors, the OGs π@class_list = get_subclasses()β returns the list of subclasses for this class. the lil' ones π₯Ί$name = class_name()β returns the full class name for this class. π$package_name = package_name()β returns the base package name (i.e. no'namespace::'up in there) 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 areAssociationobjects that provide the meta-information for the association. iconic. β¨
π«Ά INSTANCE METHODS π«Ά
$obj_copy = $obj->new()β when you invoke this on an existing object reference instead of a class name, thenew()method acts as a copy constructor β the new object's initial values get set to be exactly those of the existing object. so basically a clone, slay. π§¬- 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)β theset_slots()method is used to set a number of slots at the same time. it has two different invocation methods, bestie: the first one takes a named parameter list, and the second one takes two array references. pick your fighter π- Return value: none π
- Side effects: will call
croak()if a slot_name is used that the class does not define. so like... don't do that. π¨
@obj_list = $obj->get_slots(@name_list)β theget_slots()method is used to get the values of a number of slots at the same time. multitasking queen. π- Return value: a list of instance objects πΈ
- Side effects: none β¨
$val = $obj->set_slot($name,$val)β theset_slot()method sets the slot$nameto the value$val. π- Return value: the new value of the slot, i.e.
$valπ - Side effects: none π
- Return value: the new value of the slot, i.e.
$val = $obj->get_slot($name)β theget_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 πΈ
- Return value: a single slot value, or
$val = $mage->objects()/$inval = $mage->objects($inval)β this is the unified setter/getter method for theobjectsslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
objectsslot π - Side effects: none π
- Exceptions: none πΈ
- If
$val = $mage->tagname()/$inval = $mage->tagname($inval)β this is the unified setter/getter method for thetagnameslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
tagnameslot π - Side effects: none π
- Exceptions: none πΈ
- If
$val = $mage->identifier()/$inval = $mage->identifier($inval)β this is the unified setter/getter method for theidentifierslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
identifierslot π - Side effects: none π
- Exceptions: none πΈ
- If
$val = $mage->registered_objects()/$inval = $mage->registered_objects($inval)β this is the unified setter/getter method for theregistered_objectsslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
registered_objectsslot π - Side effects: none π
- Exceptions: none πΈ
- If
$val = $mage->identifiers()/$inval = $mage->identifiers($inval)β this is the unified setter/getter method for theidentifiersslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
identifiersslot π - Side effects: none π
- Exceptions: none πΈ
- If
$val = $mage->packages()/$inval = $mage->packages($inval)β this is the unified setter/getter method for thepackagesslot. π- If
$invalis specified, the setter method is invoked; with no parameters, the getter method is invoked. π - Input parameters: the optional
$invalwill invoke the setter method. β¨ - Return value: for both setter and getter, the current value of the
packagesslot π - Side effects: none π
- Exceptions: none πΈ
- If
$mage->add_objects(@list)β the objects in@listare added to the MAGE object. this method will recursively descend that association hierarcy of each object and place allIdentifiableobjects in their appropriate lists for writing as MAGE-ML. it's giving organizational queen π$pkg_obj = $mage->getHigherLevelAnalysis_package()β this method manages the handling of the singleton class object for theBio::MAGE::HigherLevelAnalysisclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getBioEvent_package()β this method manages the handling of the singleton class object for theBio::MAGE::BioEventclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getBioMaterial_package()β this method manages the handling of the singleton class object for theBio::MAGE::BioMaterialclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getBioSequence_package()β this method manages the handling of the singleton class object for theBio::MAGE::BioSequenceclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getAuditAndSecurity_package()β this method manages the handling of the singleton class object for theBio::MAGE::AuditAndSecurityclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getBioAssayData_package()β this method manages the handling of the singleton class object for theBio::MAGE::BioAssayDataclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getBQS_package()β this method manages the handling of the singleton class object for theBio::MAGE::BQSclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getArray_package()β this method manages the handling of the singleton class object for theBio::MAGE::Arrayclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getQuantitationType_package()β this method manages the handling of the singleton class object for theBio::MAGE::QuantitationTypeclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
$pkg_obj = $mage->getExperiment_package()β this method manages the handling of the singleton class object for theBio::MAGE::Experimentclass. when called it will return the object, creating one if it has not already been created. π- this is useful when retrieving data from parsed MAGE-ML file. β¨
and bestieβ¦ there's more π keep scrolling, part 2 is coming and we are NOT done slaying this manual π
$pkg_obj = $mage->getBioAssay_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::BioAssay"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. π$pkg_obj = $mage->getDesignElement_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::DesignElement"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. β¨$pkg_obj = $mage->getProtocol_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::Protocol"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. π$pkg_obj = $mage->getDescription_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::Description"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. π¦$pkg_obj = $mage->getArrayDesign_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::ArrayDesign"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. πΈ$pkg_obj = $mage->getMeasurement_package()β This method manages the handling of the singleton class object for the"Bio::MAGE::Measurement"class. When called it will return the object, creating one if it has not already been created. This is useful when retrieving data from parsed MAGE-ML file. π$mage->obj2xml($writer)β Write out this object, and all sub-objects, as XML using the supplied$writerto actually do the XML formatting.- Input parameters:
$writermust be an XML writer, e.g. an instance ofBio::MAGE::XML::Writer. It must have methods:write_start_tag()andwrite_end_tag(). - Return value: none
- Side effects: all writing is delegated to the
$writer- it'swrite_start_tag()andwrite_end_tag()methods are invoked with the appropriate data, and all package sub-objects of the"Bio::MAGE"instance will have theirobj2xml()methods invoked in turn. By allowing the$writerto do the actual formatting of the output XML, it enables the user to precisely control the format. - Exceptions: will call
"croak()"if no identifier has been set for the"Bio::MAGE"instance.
- Input parameters:
$mage->register($obj)β Store an object for later writing as XML.- Input parameters: object to be added to the list of registered objects.
- Return value: none
- Side effects: if
$objneeds to be stored by this class, a reference will be stored in the correct XML list for this class. - Exceptions:
die()will be called if the object does not have it's identifier set, or if the object has incorrectly set an association of list cardinality to a single object.
𧬠SLOTS, ATTRIBUTES, AND ASSOCIATIONS π§¬
In the Perl implementation of MAGE-OM classes, there are three types of class data members: "slots", "attributes", and "associations".
β¨ SLOTS β¨
This API uses the term "slot" to indicate a data member of the class that was not present in the UML model and is used for mainly internal purposes - use only if you understand the inner workings of the API. Most often slots are used by generic methods such as those in the XML writing and reading classes.
Slots are implemented using unified getter/setter methods:
$var = $obj->slot_name();β Retrieves the current value of the slot.$new_var = $obj->slot_name($new_var);β Store$new_varin the slot - the return value is also$new_var.@names = $obj->get_slot_names()β Returns the list of all slots in the class.
DATA CHECKING: No data type checking is made for these methods.
π ATTRIBUTES AND ASSOCIATIONS π
The terms "attribute" and "association" indicate data members of the class that were specified directly from the UML model.
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. NOTE: For associations, if the association has list cardinality, the argument must be an array reference. Because of this, you probably should be using theadd*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:
$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.
π BUGS π
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 πΈ
That's the whole iconic MAGE(3pm) manual, bestie. This page is from perl v5.32.0, dated 2020-11-27. Now go forth and keep your identifiers set and your list cardinalities correct. π
β¨
π¦ 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