MAGE::BioAssay(3pm)

๐Ÿ’– NAME ๐Ÿ’–

Bio::MAGE::BioAssay โ€” okay so this is the container module for all the classes hanging out in the MAGE package: BioAssay. It's the group chat, and every class below is a member of it. ๐Ÿซถ

(Also, for the record, this page is MAGE::BioAssay(3pm) from the User Contributed Perl Documentation. Hi. Welcome. You're gonna do great.) ๐Ÿ’…


โœจ SYNOPSIS โœจ

use Bio::MAGE::BioAssay;

That's it. That's the whole vibe. One line and you're in. ๐ŸŽ€


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So like, this is a package module, meaning it's not one class โ€” it's a whole little friend group of classes that all live together in the Bio::MAGE hierarchy. They belong to the BioAssay package of the MAGE-OM object model. If you're building or parsing MAGE-OM stuff, this is your home base, bestie. ๐Ÿ โœจ


๐Ÿ‘‘ CLASSES ๐Ÿ‘‘

The Bio::MAGE::BioAssay module contains the following Bio::MAGE classes, and no we're not skipping any of them, they all matter:

  • PhysicalBioAssay
  • DerivedBioAssay
  • Image
  • BioAssay
  • Channel
  • MeasuredBioAssay
  • BioAssayCreation
  • FeatureExtraction
  • Hybridization
  • ImageAcquisition
  • BioAssayTreatment

Look at them. Eleven whole classes. Iconic behavior honestly. ๐ŸŒˆ


๐ŸŒธ CLASS METHODS ๐ŸŒธ

These ones you call on the class itself, not on an object. Class-level energy. Main character, but for the whole package.

๐ŸŒŸ @class_list = Bio::MAGE::BioAssay::classes();

This hands you back a list of the non-fully qualified class names in this package โ€” like, they do not have Bio::MAGE:: glued to the front. Short names only, cuties. โœ‚๏ธ

๐ŸŒŸ $obj = class->new(%parameters)

The new() method is the class constructor. The classic. The origin story. ๐Ÿฃ

  • Parameters: if you hand 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. Fresh out of the box. ๐ŸŽ
  • Side effects: it invokes the initialize() method if the class defines one.

๐ŸŒŸ @names = class->get_slot_names()

get_slot_names() is how you get the name of every slot defined in a given class.

NOTE: this list of names does not include attribute or association names. Slots only, bestie. Don't @ me.
  • Return value: a list of the names of all slots defined for this class.
  • Side effects: none. Chill as always. ๐Ÿ˜Œ

๐ŸŒŸ @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 ones who came before. ๐Ÿ‘‘

๐ŸŒŸ @class_list = get_subclasses()

Returns the list of subclasses for this class. The babies. The heirs. ๐Ÿฃ

๐ŸŒŸ $name = class_name()

Returns the full class name for this class.

๐ŸŒŸ $package_name = package_name()

Returns the base package name โ€” and that means no namespace:: prefix on it โ€” of the package that contains this class. ๐Ÿ“ฆ

๐ŸŒŸ %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. Meta. Very meta. ๐Ÿ”ฎ


๐Ÿ’œ INSTANCE METHODS ๐Ÿ’œ

Now we're on the object level. You need an actual instance for these, okay?

๐Ÿ’ซ $obj_copy = $obj->new()

Plot twist: when you call new() on an existing object reference instead of a class name, it acts as a copy constructor โ€” the brand new object's initial values get set to whatever the existing object's values are. Clone arc. ๐Ÿงฌ

  • Parameters: no input parameters are used in the copy constructor โ€” the initial values are taken straight 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)

set_slots() is the multitasker โ€” it sets a whole bunch of slots at the same time. It has two different ways you can invoke it:

  1. The first takes a named parameter list.
  2. The second takes two array references.
  • Return value: none.
  • Side effects: it will call croak() if you use a slot_name that the class doesn't define. So likeโ€ฆ don't make up slots. ๐Ÿ™ˆ

๐Ÿ’ซ @obj_list = $obj->get_slots(@name_list)

get_slots() gets the values of a bunch of slots all at once. Bulk retrieve, we love efficiency. โšก

  • 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 at a time, precise, intentional. ๐Ÿ’…

  • 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 hasn't been initialized yet. Empty. Void. Nothing. ๐Ÿ’€
  • Side effects: none.

๐Ÿ’ซ $val = $bioassay->xml_lists()

๐Ÿ’ซ $inval = $bioassay->xml_lists($inval)

This is the unified setter/getter for the xml_lists slot. One method, two moods. โœจ

If $inval is specified, the setter method gets invoked. With no parameters, the getter method gets 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 = $bioassay->tagname()

๐Ÿ’ซ $inval = $bioassay->tagname($inval)

This is the unified setter/getter for the tagname slot.

If $inval is specified, the setter method gets invoked. With no parameters, the getter method gets 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 = $bioassay->channel_list()

๐Ÿ’ซ $inval = $bioassay->channel_list($inval)

This is the unified setter/getter for the channel_list slot.

If $inval is specified, the setter method gets invoked. With no parameters, the getter method gets invoked.

  • Input parameters: the optional $inval will invoke the setter method.
  • Return value: for both setter and getter, the current value of the channel_list slot.
  • Side effects: none.
  • Exceptions: none.

๐Ÿ’ซ $val = $bioassay->bioassay_list()

๐Ÿ’ซ $inval = $bioassay->bioassay_list($inval)

This is the unified setter/getter for the bioassay_list slot.

If $inval is specified, the setter method gets invoked. With no parameters, the getter method gets invoked.

  • Input parameters: the optional $inval will invoke the setter method.
  • Return value: for both setter and getter, the current value of the bioassay_list slot.
  • Side effects: none.
  • Exceptions: none.

๐Ÿ’ซ $array_ref = $bioassay->getChannel_list()

This method handles the list for the Bio::MAGE::BioAssay::Channel class. It returns a reference to an array of the class objects that have been associated with the package instance. ๐ŸŽ€

This is genuinely useful when you're pulling data out of a parsed MAGE-ML file. Trust. ๐Ÿ“‚

๐Ÿ’ซ $bioassay->addChannel(@vals)

This one is the interface for adding Bio::MAGE::BioAssay::Channel objects to the channel_list list. It's generally used by generic methods, like the ones hanging out in the XMLWriter. ๐Ÿ› ๏ธ

  • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted. One is fine. One is valid. ๐Ÿซถ
  • Return value: none.
  • Side effects: none.
  • Exceptions: it 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::BioAssay::Channel. So like, check your types before you come in here, bestie. ๐Ÿ˜ญ

๐Ÿ’ซ $array_ref = $bioassay->getBioAssay_list()

This method handles the list for the Bio::MAGE::BioAssay::BioAssay class. It returns a reference to an array of the class objects that have been associated with the package instance. ๐Ÿฆ‹

This is useful when retrieving data from a parsed MAGE-ML file. (Yes, same energy as getChannel_list(). They're siblings.) ๐Ÿ’•

๐Ÿ’ซ $bioassay->addBioAssay(@vals)

This is the interface for adding Bio::MAGE::BioAssay::BioAssay objects to the bioassay_list list. It's generally used by generic methods such as those in the XMLWriter. โœ๏ธ

  • Input parameters: the list of values @vals to add to the owner association. NOTE: submitting a single value is permitted.
  • Return value: none.
  • Side effects: none.
  • Exceptions: it 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::BioAssay::BioAssay. Again. Types. Check them. ๐Ÿ™ˆ

๐Ÿ’ซ $bioassay->obj2xml($writer)

Write out this object, and all of its sub-objects, as XML โ€” using the $writer you supply 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 these methods: write_start_tag(), write_end_tag(), and obj2xml().
  • Return value: none.
  • Side effects: literally all the writing gets delegated to the $writer. Its write_start_tag() and write_end_tag() methods get invoked with the appropriate data, and every class sub-object of the Bio::MAGE::BioAssay instance will have its own obj2xml() method invoked in turn. By letting the $writer do the actual formatting of the output XML, you get to precisely control the format. That's the whole point. That's the power move. ๐Ÿ’…
  • Exceptions: it will call croak() if no identifier has been set for the Bio::MAGE::BioAssay instance. So set your identifier, bestie. No identifier, no XML. Periodt. ๐Ÿšซ

๐Ÿ’ซ $bioassay->register($obj)

Stores an object so it can be written as XML later. Save it for the future. โณ

  • 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 get stored in the correct XML list for this class. Right place, right list. ๐Ÿ—‚๏ธ
  • Exceptions: none.

okay that's the first half bestie, don't go anywhere, there's literally more ๐Ÿซถโœจ

โœจ SLOTS, ATTRIBUTES, AND ASSOCIATIONS โœจ

okay so bestie, in the Perl implementation of MAGE-OM classes there are three kinds of class data members, and you gotta know which is which: "slots", "attributes", and "associations". let's break them down one by one ๐Ÿซถ


๐ŸŽ€ SLOTS ๐ŸŽ€

so "slot" is the API's word for a data member of the class that wasn't in the UML model at all โ€” it exists for mainly internal purposes. it's giving backstage pass, not front-of-house. only touch these if you genuinely understand the inner workings of the API ๐Ÿ’… most of the time slots get used by generic methods, like the ones hanging out in the XML writing and reading classes.

slots are implemented using unified getter/setter methods:

  • $var = $obj->slot_name(); โ€” grabs 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. cute, right? it's giving echo.
  • @names = $obj->get_slot_names() โ€” hands you the list of every slot in the class.
๐Ÿšจ DATA CHECKING: literally no data type checking is made for these methods. none. zero. you're on your own, bestie ๐Ÿ˜ญ

๐Ÿฆ‹ ATTRIBUTES AND ASSOCIATIONS ๐Ÿฆ‹

"attribute" and "association" are the terms for data members of the class that were specified directly from the UML model. these are the main-character data members, fr fr ๐Ÿ‘‘

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, you get back an array reference. keep that in mind or you'll be confused later, iykyk.
    • DATA CHECKING: ensures that no argument is provided. so don't be passing stuff in there ๐Ÿ™ˆ
  • set* โ€” sets the current value, replacing whatever value was already there. it's a full glow-up, out with the old.
    • NOTE: for associations, if the association has list cardinality, the argument must be an array reference. and because of that whole situation, you probably should be using the add* methods instead. lowkey just use add*.
    • DATA CHECKING: for attributes, it ensures that a single value is provided as the argument. for associations, if the association has list cardinality, it ensures the argument is a reference to an array of instances of the correct MAGE-OM class; otherwise it ensures there's 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. it's additive, it's generous, it's the friend who keeps bringing more people to the party โœจ
    • NOTE: this one is only present in associations with list cardinality. if it's not there, that's why, don't come for me.
    • DATA CHECKING: ensures that all arguments are of the correct MAGE-OM class.

๐Ÿ’ซ GENERIC METHODS ๐Ÿ’ซ

the unified base class of all MAGE-OM classes, Bio::MAGE::Base, serves up a whole set of generic methods that operate on slots, attributes, and associations. one class to rule them all, periodt ๐Ÿ‘‘

$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 โ€” they're already covered, bestie, go look ๐ŸŒธ

๐Ÿ’€ BUGS ๐Ÿ’€

found a bug? not me manifesting that but okay. 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) โ€” the author, the icon, the legend ๐Ÿ’œ


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

  • perl(1) โ€” go read it, bestie, it's foundational ๐Ÿซถ

and that's the whole page, bestie!! this little masterpiece is perl v5.32.0 from 2020-11-27, filed under MAGE::BioAssay(3pm) โ€” go forth and annotate your bioassays with main character energy ๐Ÿ’–โœจ๐ŸŽ€๐Ÿฆ‹๐ŸŒธ

๐Ÿ“ฆ where this page comes from