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:

  • NameValueType
  • Extendable
  • Identifiable
  • Describable

πŸ’… 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 complete Bio::MAGE class hierarchy. iykyk 🫢
  • $obj = class->new(%parameters) β€” the new() 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() β€” the get_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 are Association objects 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, the new() 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) β€” the set_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) β€” the get_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) β€” 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 undef if the slot has not been initialized. πŸ™ˆ
    • Side effects: none 🌸
  • $val = $mage->objects() / $inval = $mage->objects($inval) β€” this is the unified setter/getter method for the objects slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the objects slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $val = $mage->tagname() / $inval = $mage->tagname($inval) β€” this is the unified setter/getter method for the tagname slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the tagname slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $val = $mage->identifier() / $inval = $mage->identifier($inval) β€” this is the unified setter/getter method for the identifier slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the identifier slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $val = $mage->registered_objects() / $inval = $mage->registered_objects($inval) β€” this is the unified setter/getter method for the registered_objects slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the registered_objects slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $val = $mage->identifiers() / $inval = $mage->identifiers($inval) β€” this is the unified setter/getter method for the identifiers slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the identifiers slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $val = $mage->packages() / $inval = $mage->packages($inval) β€” this is the unified setter/getter method for the packages slot. πŸ’…
    • If $inval is specified, the setter method is invoked; with no parameters, the getter method is invoked. πŸŽ€
    • Input parameters: the optional $inval will invoke the setter method. ✨
    • Return value: for both setter and getter, the current value of the packages slot πŸ’–
    • Side effects: none 🌈
    • Exceptions: none 🌸
  • $mage->add_objects(@list) β€” the objects in @list are added to the MAGE object. this method will recursively descend that association hierarcy of each object and place all Identifiable objects 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 the Bio::MAGE::HigherLevelAnalysis 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->getBioEvent_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::BioEvent 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->getBioMaterial_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::BioMaterial 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->getBioSequence_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::BioSequence 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->getAuditAndSecurity_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::AuditAndSecurity 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->getBioAssayData_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::BioAssayData 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->getBQS_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::BQS 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->getArray_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::Array 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->getQuantitationType_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::QuantitationType 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->getExperiment_package() β€” this method manages the handling of the singleton class object for the Bio::MAGE::Experiment 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. ✨

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 $writer to actually do the XML formatting.
    • Input parameters: $writer must be an XML writer, e.g. an instance of Bio::MAGE::XML::Writer. It must have methods: write_start_tag() and write_end_tag().
    • Return value: none
    • Side effects: all writing is delegated to the $writer - it's write_start_tag() and write_end_tag() methods are invoked with the appropriate data, and all package sub-objects of the "Bio::MAGE" instance will have their obj2xml() methods invoked in turn. By allowing the $writer to 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.
  • $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 $obj needs 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_var in 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 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:

$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 🌸

perl(1).


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. πŸ’…βœ¨