MAGE::...Element(3pm)
# π MAGE::...Element π
bestie, welcome to MAGE::...Element(3pm) β straight out of the User Contributed Perl Documentation section. pull up a chair, we're doing MAGE today. π
# β¨ NAME β¨
Bio::MAGE::DesignElement β the container module for the classes in the MAGE package: DesignElement. it's giving "one module to hold them all" energy. π
# β¨ SYNOPSIS β¨
use Bio::MAGE::DesignElement;
that's it. that's the whole synopsis. iconic minimalism. π
# β¨ DESCRIPTION β¨
so this is a package module β a lil container β that encapsulates a whole bunch of classes in the Bio::MAGE hierarchy. π«Ά
and those classes? they all belong to the DesignElement package of the MAGE-OM object model. no cap. that's the whole description. periodt. πΈ
# β¨ CLASSES β¨
the Bio::MAGE::DesignElement module is home to the following Bio::MAGE classes, and bestie there are thirteen of them, she's thriving:
DesignElementPositionReporterReporterPositionCompositePositionCompositeSequenceFeatureMismatchInformationFeatureInformationCompositeCompositeMapFeatureReporterMapReporterCompositeMapFeatureLocation
# β¨ CLASS METHODS β¨
these are the ones you call on the class itself. let's get into it. β¨
@class_list = Bio::MAGE::DesignElement::classes();β hands you back a list of the non-fully qualified class names in this package, meaning they do not have'Bio::MAGE::'glued on the front. lowkey cleaner that way.$obj = class->new(%parameters)β this is the class constructor, the birth of an object, main character origin story. π- Parameters: if you feed it a list of name/value parameters, the matching slots, attributes, or associations get their initial values set by the constructor.
- Return value: a reference to an object of the class.
- Side effects: it invokes the
initialize()method, but only if the class actually defines one.
@names = class->get_slot_names()β used to retrieve the name of all the slots defined in a given class.- NOTE: the list of names does not include attribute or association names. just slots. don't get it twisted. π
- 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.@class_list = get_subclasses()β returns the list of subclasses for this class.$name = class_name()β returns the full class name for this class. the whole thing, no abbreviations. π€$package_name = package_name()β returns the base package name of the package that contains this class β i.e. no'namespace::'prefix. just the base.%assns = associations()β returns the association meta-information in a hash, where the keys are the association names and the values areAssociationobjects that carry the meta-information for that association. π§
# β¨ INSTANCE METHODS β¨
now the ones you call on an actual object you already have. buckle up. π¦
$obj_copy = $obj->new()β plot twist: when you invokenew()on an existing object reference instead of a class name, it acts as a copy constructor, and the new object's initial values are set to be those of the existing object. clone era. π―- Parameters: no input parameters are used in the copy constructor β the initial values are taken directly from the object being copied.
- Return value: 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)β sets a bunch of slots all at once. it's got two different invocation methods: the first takes a named parameter list, the second takes two array references. versatile queen. π- Return value: none.
- Side effects: will call
croak()if a slot_name is used that the class does not define. so don't try it. π
@obj_list = $obj->get_slots(@name_list)β gets the values of a bunch of slots all at once.- Return value: a list of instance objects.
- Side effects: none.
$val = $obj->set_slot($name,$val)β 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)β 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 = $designelement->xml_lists()$inval = $designelement->xml_lists($inval)β the unified setter/getter for thexml_listsslot.- 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
xml_listsslot. - Side effects: none.
- Exceptions: none.
- if
$val = $designelement->tagname()$inval = $designelement->tagname($inval)β the unified setter/getter 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 = $designelement->compositesequence_list()$inval = $designelement->compositesequence_list($inval)β the unified setter/getter for thecompositesequence_listslot.- 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
compositesequence_listslot. - Side effects: none.
- Exceptions: none.
- if
$val = $designelement->reporter_list()$inval = $designelement->reporter_list($inval)β the unified setter/getter for thereporter_listslot.- 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
reporter_listslot. - Side effects: none.
- Exceptions: none.
- if
$val = $designelement->compositecompositemap_list()$inval = $designelement->compositecompositemap_list($inval)β the unified setter/getter for thecompositecompositemap_listslot.- 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
compositecompositemap_listslot. - Side effects: none.
- Exceptions: none.
- if
$val = $designelement->reportercompositemap_list()$inval = $designelement->reportercompositemap_list($inval)β the unified setter/getter for thereportercompositemap_listslot.- 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
reportercompositemap_listslot. - Side effects: none.
- Exceptions: none.
- if
$val = $designelement->featurereportermap_list()$inval = $designelement->featurereportermap_list($inval)β the unified setter/getter for thefeaturereportermap_listslot.- 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
featurereportermap_listslot. - Side effects: none.
- Exceptions: none.
- if
$array_ref = $designelement->getCompositeSequence_list()β handles the list for theBio::MAGE::DesignElement::CompositeSequenceclass. returns a reference to an array of the class objects that have been associated with the package instance. π- super handy when you're retrieving data from a parsed MAGE-ML file. iykyk.
$designelement->addCompositeSequence(@vals)β an interface for addingBio::MAGE::DesignElement::CompositeSequenceobjects to thecompositesequence_listlist. it's generally used by generic methods, like the ones in the XMLWriter.- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted. π - Return value: none.
- Side effects: none.
- Exceptions: will call
croak()if no input parameters are specified, or if any of the objects in@valsis not a subclass of classBio::MAGE::DesignElement::CompositeSequence.
- Input parameters: the list of values
$array_ref = $designelement->getReporter_list()β handles the list for theBio::MAGE::DesignElement::Reporterclass. returns a reference to an array of the class objects that have been associated with the package instance.- again, useful when retrieving data from a parsed MAGE-ML file. π§
$designelement->addReporter(@vals)β an interface for addingBio::MAGE::DesignElement::Reporterobjects to thereporter_listlist. generally used by generic methods such as those in the XMLWriter.- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted. - Return value: none.
- Side effects: none.
- Exceptions: will call
croak()if no input parameters are specified, or if any of the objects in@valsis not a subclass of classBio::MAGE::DesignElement::Reporter.
- Input parameters: the list of values
$array_ref = $designelement->getCompositeCompositeMap_list()β handles the list for theBio::MAGE::DesignElement::CompositeCompositeMapclass. returns a reference to an array of the class objects that have been associated with the package instance.- yes bestie, once again this is useful when retrieving data from a parsed MAGE-ML file. π
$designelement->addCompositeCompositeMap(@vals)β an interface for addingBio::MAGE::DesignElement::CompositeCompositeMapobjects to thecompositecompositemap_listlist. generally used by generic methods such as those in the XMLWriter.- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted. - Return value: none.
- Side effects: none.
- Input parameters: the list of values
Exceptions: (yeah this is the tail end of that last method's whole deal, keep scrolling bestie π
) will call croak() if no input parameters are specified, or if any of the objects in @vals is not a subclass of class Bio::MAGE::DesignElement::CompositeCompositeMap
πΈ $array_ref = $designelement->getReporterCompositeMap_list()
This one handles the list for the Bio::MAGE::DesignElement::ReporterCompositeMap class. It hands you back a reference to an array of the class objects that have been associated with the package instance.
Lowkey so useful when you're retrieving data from a parsed MAGE-ML file. π§
π¦ $designelement->addReporterCompositeMap(@vals)
This method is the interface for adding Bio::MAGE::DesignElement::ReporterCompositeMap objects to the reportercompositemap_list list. It's generally used by generic methods, like the ones hanging out in the XMLWriter.
- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted. - Return value: none
- Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if any of the objects in@valsis not a subclass of classBio::MAGE::DesignElement::ReporterCompositeMap
π $array_ref = $designelement->getFeatureReporterMap_list()
Handles the list for the Bio::MAGE::DesignElement::FeatureReporterMap class. Returns a reference to an array of the class objects that have been associated with the package instance.
Again β chef's kiss when you're pulling data out of a parsed MAGE-ML file. β¨
π $designelement->addFeatureReporterMap(@vals)
The interface for adding Bio::MAGE::DesignElement::FeatureReporterMap objects to the featurereportermap_list list. Generally used by generic methods such as those in the XMLWriter.
- Input parameters: the list of values
@valsto add to the owner association. NOTE: submitting a single value is permitted. - Return value: none
- Side effects: none
- Exceptions: will call
croak()if no input parameters are specified, or if any of the objects in@valsis not a subclass of classBio::MAGE::DesignElement::FeatureReporterMap
π₯ $designelement->obj2xml($writer)
Writes out this object, and all its sub-objects, as XML β using the $writer you hand it to actually do the XML formatting. Main character does the object, the writer does the glow-up. π
- Input parameters:
$writermust be an XML writer, e.g. an instance of Bio::MAGE::XML::Writer. It must have methods:write_start_tag(),write_end_tag(), andobj2xml(). - Return value: none
- Side effects: all writing is delegated to the
$writerβ itswrite_start_tag()andwrite_end_tag()methods are invoked with the appropriate data, and all class sub-objects of theBio::MAGE::DesignElementinstance 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 theBio::MAGE::DesignElementinstance.
bestie. set your identifier. don't make it croak. π
π $designelement->register($obj)
Stores an object for later writing as XML. Save it for the group chat, basically.
- 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: none
π« SLOTS, ATTRIBUTES, AND ASSOCIATIONS π«
okay so in the Perl implementation of MAGE-OM classes, there are exactly three types of class data members, and you will be learning all of them: "slots", "attributes", and "associations". Sit down, hydrate, let's go. π«Ά
π SLOTS
This API uses the term "slot" to mean a data member of the class that was not present in the UML model, and it's used for mainly internal purposes β so only touch it if you genuinely understand the inner workings of the API. No cap. Most often, slots get used by generic methods, like the ones 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);β stores$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. None. Zero. It simply does not check. π
π ATTRIBUTES AND ASSOCIATIONS
The terms "attribute" and "association" mean data members of the class that were specified directly from the UML model. (Yes, that's the difference. That's it. That's the tea. β)
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.
- 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*β 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)
not me begging you to actually report the bugs instead of just yelling about them in your own terminal π
π AUTHOR π
Jason E. Stewart (jasons 'at' cpan 'dot' org)
π SEE ALSO π
and that's the whole page, bestie β this one's perl v5.32.0, dated 2020-11-27, and yeah it's literally titled MAGE::...Element(3pm). go forth and parse your MAGE-ML, you absolute icon πβ¨π¦
π¦ 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