MAGE::...ataCube(3pm)

πŸ’– NAME πŸ’–

Bio::MAGE::BioAssayData::BioDataCube β€” the class for the MAGE-OM API. that's it, that's the name, she's iconic πŸ’…

(oh also hiii bestie, this page is MAGE::...ataCube(3pm) from the User Contributed Perl Documentation, and it's a long one β€” this is part 1, so stay with me 🫢)


✨ SYNOPSIS ✨

okay so here's the whole vibe, look at her go:

use Bio::MAGE::BioAssayData::BioDataCube

# creating an empty instance
my $biodatacube = Bio::MAGE::BioAssayData::BioDataCube->new();

# creating an instance with existing data
my $biodatacube = Bio::MAGE::BioAssayData::BioDataCube->new(
      cube=>$cube_val,
      order=>$order_val,
      propertySets=>\@namevaluetype_list,
);

# 'cube' attribute
my $cube_val = $biodatacube->cube(); # getter
$biodatacube->cube($value); # setter

# 'order' attribute
my $order_val = $biodatacube->order(); # getter
$biodatacube->order($value); # setter

# 'propertySets' association
my $namevaluetype_array_ref = $biodatacube->propertySets(); # getter
$biodatacube->propertySets(\@namevaluetype_list); # setter

like, new instance, or new instance with data already in it, then getters and setters. simple. slay. πŸ’–


🌸 DESCRIPTION 🌸

straight from the MAGE-OM documentation for the BioDataCube class, no notes:

A three-dimensional cube representation of the data.

that's the whole thing. a cube. three-dimensional. the data lives in it. πŸ”₯


πŸ¦‹ INHERITANCE πŸ¦‹

Bio::MAGE::BioAssayData::BioDataCube has the following superclasses:

  • Bio::MAGE::BioAssayData::BioDataValues

yes bestie, she has a parent class. family lineage. royalty. πŸ‘‘


⭐ CLASS METHODS ⭐

The following methods can all be called without first having an instance of the class, via the Bio::MAGE::BioAssayData::BioDataCube->methodname() syntax. so you don't even need an object yet, you can just call them on the class. periodt.

πŸŽ€ new() πŸŽ€

πŸŽ€ new(%args) πŸŽ€

The object constructor new() accepts the following optional named-value style arguments:

  • cube β€” sets the value of the cube attribute
  • order β€” sets the value of the order attribute
  • propertySets β€” sets the value of the propertySets association (and btw this association was inherited from the class Bio::MAGE::Extendable). The value must be of type: array of Bio::MAGE::NameValueType.

πŸŽ€ $obj = class->new(%parameters) πŸŽ€

The new() method is the class constructor.

  • Parameters: if given a list of name/value parameters, the corresponding slots, attributes, or associations will have 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 used to retrieve the name of all slots defined in a given class.

NOTE: the list of names does not include attribute or association names. like, they're just not invited to this party. πŸ™ˆ
  • 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 (i.e. no namespace::) 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.


πŸ’œ INSTANCE METHODS πŸ’œ

πŸŽ€ $obj_copy = $obj->new() πŸŽ€

When invoked with an existing object reference and not a class name, the new() method acts as a copy constructor β€” with the new object's initial values set to be those of the existing object. it's giving clone energy, fr fr. 🧬

  • 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. The first takes a named parameter list, and the second takes two array references.

  • Return value: none
  • Side effects: will call croak() if a slot_name is used that the class does not define.

πŸŽ€ @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.

  • 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

🌈 ATTRIBUTES 🌈

Attributes are simple data types that belong to a single instance of a class. In the Perl implementation of the MAGE-OM classes, the interface to attributes is implemented using separate setter and getter methods for each attribute. so like, one method to put a value in, one method to get it back out. chef's kiss. πŸ‘©β€πŸ³πŸ’‹

Bio::MAGE::BioAssayData::BioDataCube has the following attribute accessor methods:

πŸ“ cube πŸ“

Methods for the cube attribute.

From the MAGE-OM documentation:

Three dimension array, indexed by the three dimensions to provide the data for the BioAssayData.

  • $val = $biodatacube->setCube($val) β€” the restricted setter method for the cube attribute.
    • Input parameters: the value to which the cube attribute will be set
    • Return value: the current value of the cube attribute
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified
  • $val = $biodatacube->getCube() β€” the restricted getter method for the cube attribute.
    • Input parameters: none
    • Return value: the current value of the cube attribute
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

πŸ“ order πŸ“

Methods for the order attribute.

From the MAGE-OM documentation:

The order to expect the dimension. The enumeration uses the first letter of the three dimensions to represent the six possible orderings.

  • $val = $biodatacube->setOrder($val) β€” the restricted setter method for the order attribute.

order is an enumerated attribute β€” it can only be set to undef or one of the following values: BDQ BQD DBQ DQB QBD QDB

  • Input parameters: the value to which the order attribute will be set
  • Return value: the current value of the order attribute
  • Side effects: none
  • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $val is not one of the accepted enumeration values: BDQ BQD DBQ DQB QBD QDB
  • $val = $biodatacube->getOrder() β€” the restricted getter method for the order attribute.
    • Input parameters: none
    • Return value: the current value of the order attribute : an instance of type BDQ BQD DBQ DQB QBD QDB.
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified

πŸ’… ASSOCIATIONS πŸ’…

Associations are references to other classes. Associations in MAGE-OM have a cardinality that determines the minimum and maximum number of instances of the 'other' class that maybe included in the association:

  1. There must be exactly one item in the association, i.e. this is a mandatory data field.
  2. 0..1 β€” there may be one item in the association, i.e. this is an optional data field.
  3. 1..N β€” there must be one or more items in the association, i.e. this is a mandatory data field, with list cardinality.
  4. 0..N β€” there may be one or more items in the association, i.e. this is an optional data field, with list cardinality.

Bio::MAGE::BioAssayData::BioDataCube has the following association accessor methods:

πŸ¦„ propertySets πŸ¦„

Methods for the propertySets association.

From the MAGE-OM documentation:

Allows specification of name/value pairs. Meant to primarily help in-house, pipeline processing of instances by providing a place for values that aren't part of the specification proper.

  • $array_ref = $biodatacube->setPropertySets($array_ref) β€” the restricted setter method for the propertySets association.
    • Input parameters: the value to which the propertySets association will be set : a reference to an array of objects of type Bio::MAGE::NameValueType
    • Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::MAGE::NameValueType
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified, or if $array_ref is not a reference to an array class Bio::MAGE::NameValueType instances
  • $array_ref = $biodatacube->getPropertySets() β€” the restricted getter method for the propertySets association.
    • Input parameters: none
    • Return value: the current value of the propertySets association : a reference to an array of objects of type Bio::MAGE::NameValueType
    • Side effects: none
    • Exceptions: will call croak() if any input parameters are specified
  • $val = $biodatacube->addPropertySets(@vals) β€” because the propertySets association has list cardinality, it may store more than one value. This method adds the current list of objects in the propertySets association.
    • Input parameters: the list of values @vals to add to the propertySets association. NOTE: submitting a single value is permitted.
    • Return value: the number of items stored in the slot after adding @vals
    • Side effects: none
    • Exceptions: will call croak() if no input parameters are specified, or if any of the objects in @vals is not an instance of class Bio::MAGE::NameValueType

and then, right here in the docs, there's literally a little code moment:

sub initialize {

  my $self = shift;
  return 1;

}

okay that's part 1 bestie, more coming β€” don't go anywhere 🫢✨

✨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ✨

okay so bestie, in the Perl implementation of MAGE-OM classes there are like three whole types of class data members: slots, attributes, and associations. let's break it down πŸ’…


πŸŽ€ SLOTS πŸŽ€

so this API uses the term "slot" to mean a data member of the class that was not in the UML model and is mostly for internal stuff β€” like, only touch it if you really understand the inner workings of the API, okay? most of the time slots get used by generic methods like the ones in the XML writing and reading classes. iykyk ✨

slots are implemented using unified getter/setter methods:

  • $var = $obj->slot_name(); β€” retrieves the current value of the slot. it's giving "what's in there right now" πŸ’–
  • $new_var = $obj->slot_name($new_var); β€” stores $new_var in the slot β€” and the return value is also $new_var. slay.
  • @names = $obj->get_slot_names() β€” returns the list of all slots in the class. all of them. periodt.
DATA CHECKING: No data type checking is made for these methods. like, none. zero. nada. so be careful bestie 😭

πŸ¦‹ ATTRIBUTES AND ASSOCIATIONS πŸ¦‹

the terms "attribute" and "association" indicate data members of the class that were specified directly from the UML model. so they're the real ones πŸ’…

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. like, don't pass anything, okay? πŸ™ˆ

πŸ’– set* πŸ’–

sets the current value, replacing any existing value. bye bye old 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. fr fr.
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. so many rules, i know 😭

πŸŽ€ add* πŸŽ€

NOTE: only present in associations with list cardinality. so if you don't see it, that's why bestie.

appends a list of objects to any values that may already be stored in the association. it's giving "and also this" ✨

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. iconic behavior honestly πŸ‘‘

  • $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. (iykyk, go look it up πŸ’…)


πŸ’€ 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).


😭 POD ERRORS 😭

hey! the above document had some coding errors, which are explained below:

Around line 280: '=item' outside of any '=over'

Around line 365: You forgot a '=back' before '=head2'

Around line 541: Expected '=item 2'

Around line 546: Expected '=item 3'

Around line 551: Expected '=item 4'


and that's a wrap bestie! this was perl v5.32.0 from 2020-11-27, and the page was MAGE::...ataCube(3pm). stay iconic, stay slaying, and don't forget to check your arguments πŸ’…βœ¨