MAGE::...equence(3pm)

πŸ’– NAME πŸ’–

okay bestie, listen β€” Bio::MAGE::BioSequence is the container module for all the classes in the MAGE package that live under BioSequence. it's the group chat, and these are its members 🫢


✨ SYNOPSIS ✨

use Bio::MAGE::BioSequence;

that's it. that's the whole vibe. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this is a package module, which is a fancy way of saying it's the mom friend that holds a whole bunch of classes together in the Bio::MAGE hierarchy. all these classes are part of the BioSequence package of the MAGE-OM object model. iconic behavior, honestly.


🌸 CLASSES 🌸

the Bio::MAGE::BioSequence module contains these Bio::MAGE classes, no cap:

  • SeqFeature
  • SeqFeatureLocation
  • BioSequence
  • SequencePosition

πŸ‘‘ CLASS METHODS πŸ‘‘

  • @class_list = Bio::MAGE::BioSequence::classes(); β€” hands you back a list of class names from this package, and bestie they are not fully qualified (meaning: no Bio::MAGE:: prefix up front, they're just the short names, iykyk).
  • $obj = class->new(%parameters) β€” the class constructor, the birth of a whole new object πŸ’«
    • Parameters: if you pass it a list of name/value pairs, the matching slots, attributes, or associations get their initial values set right there by the constructor.
    • Return value: a reference to an object of the class.
    • Side effects: it invokes the initialize() method if the class defines one.
  • @names = class->get_slot_names() β€” used to grab the names of every slot defined in a given class.
NOTE: this list of names does not include attribute names or association names. those are separate things, don't @ me.
  • 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.
  • $package_name = package_name() β€” returns the base package name of the package that contains this class, meaning it has no namespace:: on it. just the clean base name.
  • %assns = associations() β€” returns the association meta-information as a hash. the keys are the association names, and the values are Association objects that carry the meta-information for that association. very demure, very mindful. πŸŽ€

🌈 INSTANCE METHODS 🌈

  • $obj_copy = $obj->new() β€” when you call new() on an existing object reference instead of a class name, it acts as a copy constructor β€” the new object's initial values get set to whatever the existing object had. cloning, but make it Perl 🧚
    • 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 the class defines one.
  • $obj->set_slots(%parameters) $obj->set_slots(\@name_list, \@value_list) β€” sets a whole bunch of slots at the same time. it's got two different invocation methods: the first one takes a named parameter list, the second takes two array references. pick your fighter πŸ’…
    • Return value: none.
    • Side effects: will call croak() if you use a slot_name that the class doesn't define. so like, know your slots.
  • @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 $name to the value $val.
    • Return value: the new value of the slot, i.e. $val.
    • Side effects: none.
  • $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 undef if the slot has not been initialized. 😭
    • Side effects: none.
  • $val = $biosequence->xml_lists() $inval = $biosequence->xml_lists($inval) β€” the unified setter/getter method for the xml_lists 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 xml_lists slot.
    • Side effects: none.
    • Exceptions: none.
  • $val = $biosequence->tagname() $inval = $biosequence->tagname($inval) β€” 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 = $biosequence->biosequence_list() $inval = $biosequence->biosequence_list($inval) β€” the unified setter/getter method for the biosequence_list 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 biosequence_list slot.
    • Side effects: none.
    • Exceptions: none.
  • $array_ref = $biosequence->getBioSequence_list() β€” handles the list for the Bio::MAGE::BioSequence::BioSequence class. it returns a reference to an array of the class objects that have been associated with the package instance. super handy when you're pulling data out of a parsed MAGE-ML file πŸ”₯
  • $biosequence->addBioSequence(@vals) β€” the interface for adding Bio::MAGE::BioSequence::BioSequence objects to the biosequence_list list. it's generally used by generic methods like the ones in the XMLWriter.
    • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted, bestie, you don't have to give it a whole list.
    • Return value: none.
    • Side effects: none.
    • Exceptions: 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::BioSequence::BioSequence. ⚠️
  • $biosequence->obj2xml($writer) β€” writes out this object, and all its sub-objects, as XML, using the supplied $writer to actually do the XML formatting. delegating, as one does πŸ’…
    • Input parameters: $writer must be an XML writer, e.g. an instance of Bio::MAGE::XML::Writer. It must have the methods: write_start_tag(), write_end_tag(), and obj2xml().
    • Return value: none.
    • Side effects: all writing is delegated to the $writer β€” its write_start_tag() and write_end_tag() methods are invoked with the appropriate data, and all class sub-objects of the Bio::MAGE::BioSequence instance will have their obj2xml() methods invoked in turn. by letting the $writer do the actual formatting of the output XML, it lets you precisely control the format. you're the main character of your own output ✨
    • Exceptions: will call croak() if no identifier has been set for the Bio::MAGE::BioSequence instance. 😬
  • $biosequence->register($obj) β€” stores an object for later writing as XML.
    • Input parameters: the 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: none.

πŸŽ€ SLOTS, ATTRIBUTES, AND ASSOCIATIONS πŸŽ€

in the Perl implementation of MAGE-OM classes, there are three types of class data members: slots, attributes, and associations. three flavors, all valid.

πŸ’œ SLOTS

this API uses the term slot for a data member of the class that was not present in the UML model, and it's used mainly for internal purposes β€” so like, only touch it if you understand the inner workings of the API, fr fr. most of the time, 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); β€” stores $new_var in the slot, and 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 care. πŸ’€

πŸ¦‹ 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 instead. 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* β€” appends a list of objects to any values that may already be stored in the association.
NOTE: only present in associations with list cardinality. 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 on this page for a detailed description of these methods. they're all up there, bestie, scroll up 🫢


πŸ’€ BUGS πŸ’€

please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net). they want to hear from you, genuinely.


πŸ’– AUTHOR πŸ’–

Jason E. Stewart (jasons 'at' cpan 'dot' org)


🌈 SEE ALSO 🌈

perl(1).


and that's the whole page, bestie β€” written for perl v5.32.0, dated 2020-11-27. go forth and sequence responsibly, you absolute icon πŸ‘‘βœ¨πŸ’