MAGE::...mation(3pm)

MAGE::...mation(3pm) πŸ’–

okay bestie, so this is Bio::MAGE::DesignElement::MismatchInformation β€” a page from the User Contributed Perl Documentation and it lives in section 3pm of your man pages. it's a whole class for the MAGE-OM API. buckle up, we're doing this together 🫢


✨ NAME ✨

Bio::MAGE::DesignElement::MismatchInformation β€” bestie it's a Class for the MAGE-OM API. that's the whole vibe. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

so this is how you actually talk to it, no cap:

use Bio::MAGE::DesignElement::MismatchInformation

# creating an empty instance
my $mismatchinformation = Bio::MAGE::DesignElement::MismatchInformation->new();

# creating an instance with existing data
my $mismatchinformation = Bio::MAGE::DesignElement::MismatchInformation->new(
      startCoord=>$startcoord_val,
      newSequence=>$newsequence_val,
      replacedLength=>$replacedlength_val,
      propertySets=>\@namevaluetype_list,
);

# 'startCoord' attribute
my $startCoord_val = $mismatchinformation->startCoord(); # getter
$mismatchinformation->startCoord($value); # setter

# 'newSequence' attribute
my $newSequence_val = $mismatchinformation->newSequence(); # getter
$mismatchinformation->newSequence($value); # setter

# 'replacedLength' attribute
my $replacedLength_val = $mismatchinformation->replacedLength(); # getter
$mismatchinformation->replacedLength($value); # setter

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

see how the getter/setter situation is just... the same method name, different args? it's giving duality, it's giving iconic. πŸ’…


🌸 DESCRIPTION 🌸

straight from the MAGE-OM documentation for the "MismatchInformation" class, and I'm quoting here:

Describes how a reporter varies from its ReporterCharacteristics sequence(s) or how a Feature varies from its Reporter sequence.

so yeah, it's the "hey, this thing is different from that thing" class. fr fr. ✨


πŸ’œ INHERITANCE πŸ’œ

Bio::MAGE::DesignElement::MismatchInformation has the following superclasses, bestie, and you will respect the family tree:

  • Bio::MAGE::Extendable

πŸŽ€ CLASS METHODS πŸŽ€

okay so the following methods can all be called without first having an instance of the class β€” you just hit them with the

Bio::MAGE::DesignElement::MismatchInformation->methodname()

syntax. no object required, we're calling it like that. periodt. 🫢

new()

new(%args)

The object constructor "new()" accepts the following optional named-value style arguments β€” all optional, so no pressure, queen:

  • startCoord β€” sets the value of the "startCoord" attribute. ✨
  • newSequence β€” sets the value of the "newSequence" attribute. ✨
  • replacedLength β€” sets the value of the "replacedLength" attribute. ✨
  • propertySets β€” sets the value of the "propertySets" association (and psst, this association was inherited from 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. it makes the thing. that's its job. 🧚

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. πŸ‘€ don't get it twisted.

Return value: A list of the names of all slots defined for this class.

Side effects: none. blessed, no side quests. 🌈

@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.


okay that's the end of part one bestie, keep reading, there's more πŸ’–

πŸ’– INSTANCE METHODS πŸ’–

✨ $obj_copy = $obj->new() ✨

Okay so plot twist β€” when you call new() on an existing object reference instead of on a class name, it stops being a constructor and becomes a copy constructor. The new object's initial values get set to be those of the existing object. Copy-paste but make it ✨elegant✨.

  • 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 your "set a whole bunch of slots at once" bestie. She's got two whole invocation methods, because she contains multitudes:

  1. the first takes a named parameter list, and
  2. 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. So don't try it. She will find out.

✨ @obj_list = $obj->get_slots(@name_list) ✨

The get_slots() method grabs the values of a number of slots all at the same time. Batch retrieval, no cap. πŸ’…

  • 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 slot, one value, one vibe. πŸŽ€

  • 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. (Yes bestie, that is literally what the docs say for the single slot getter β€” we're keeping it exactly as written, no notes πŸ’€)

  • 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. No direct field access, we do it properly here. 🫢

Bio::MAGE::DesignElement::MismatchInformation has the following attribute accessor methods:

🌸 startCoord

Methods for the startCoord attribute.

From the MAGE-OM documentation:

Offset into the sequence that the mismatch occurs.

$val = $mismatchinformation->setStartCoord($val)

The restricted setter method for the startCoord attribute.

  • Input parameters: the value to which the startCoord attribute will be set
  • Return value: the current value of the startCoord attribute
  • Side effects: none
  • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified

$val = $mismatchinformation->getStartCoord()

The restricted getter method for the startCoord attribute.

  • Input parameters: none
  • Return value: the current value of the startCoord attribute
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

🌸 newSequence

Methods for the newSequence attribute.

From the MAGE-OM documentation:

The sequence that replaces the specified sequence starting at start_coord.

$val = $mismatchinformation->setNewSequence($val)

The restricted setter method for the newSequence attribute.

  • Input parameters: the value to which the newSequence attribute will be set
  • Return value: the current value of the newSequence attribute
  • Side effects: none
  • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified

$val = $mismatchinformation->getNewSequence()

The restricted getter method for the newSequence attribute.

  • Input parameters: none
  • Return value: the current value of the newSequence attribute
  • Side effects: none
  • Exceptions: will call croak() if any input parameters are specified

🌸 replacedLength

Methods for the replacedLength attribute.

From the MAGE-OM documentation:

Length of the original sequence that is replaced. A deletion is specified when the length of the newSequence is less than the replacedLength.

$val = $mismatchinformation->setReplacedLength($val)

The restricted setter method for the replacedLength attribute.

  • Input parameters: the value to which the replacedLength attribute will be set
  • Return value: the current value of the replacedLength attribute
  • Side effects: none
  • Exceptions: will call croak() if no input parameters are specified, or if too many input parameters are specified

$val = $mismatchinformation->getReplacedLength()

The restricted getter method for the replacedLength attribute.

  • Input parameters: none
  • Return value: the current value of the replacedLength attribute
  • 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. Cardinality check incoming, and it's giving very strict. ⭐

  1. exactly one β€” 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::DesignElement::MismatchInformation 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 = $mismatchinformation->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 = $mismatchinformation->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 = $mismatchinformation->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. Stack 'em up bestie, she can hold them all. πŸ‘‘

  • 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 there's this lil guy hanging out at the bottom, doing absolutely nothing but vibing:

sub initialize {

  my $self = shift;
  return 1;

}

✨ SLOTS, ATTRIBUTES, AND ASSOCIATIONS ✨

okay bestie, so in the Perl implementation of MAGE-OM classes there are literally three flavors of class data members and you gotta know which is which: "slots", "attributes", and "associations". that's the whole vibe check. let's go 🫢


πŸŽ€ SLOTS πŸŽ€

so this API uses the word "slot" for a data member of the class that was NOT in the UML model β€” it's mainly for internal purposes. like, only touch these if you genuinely understand the inner workings of the API, fr fr. most of the time slots get used by generic methods, like the ones hanging out in the XML writing and reading classes. iykyk πŸ’…

slots are implemented with unified getter/setter methods:

  • $var = $obj->slot_name(); β€” retrieves the current value of the slot. cute, simple, no notes ✨
  • $new_var = $obj->slot_name($new_var); β€” stores $new_var in the slot. and the return value? also $new_var. it's giving mirror energy πŸͺž
  • @names = $obj->get_slot_names() β€” returns the list of all slots in the class. the whole roster, bestie πŸ“‹
DATA CHECKING: no data type checking is made for these methods. none. zero. the vibes are unguarded 😭

πŸ’– ATTRIBUTES AND ASSOCIATIONS πŸ’–

the terms "attribute" and "association" mean data members of the class that were specified directly from the UML model β€” so these are the real main characters, not the internal side quests. πŸ‘‘

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. (yes, a whole ref. not the list itself. pay attention bestie πŸ’€)
DATA CHECKING: ensure that no argument is provided. like, don't hand it anything, okay? hands off πŸ™ˆ
  • set* β€” sets the current value, replacing any existing value. it's a full takeover, no survivors, periodt. πŸ’…
NOTE: for associations, if the association has list cardinality, the argument must be an array reference. and because of that little detail, you probably should be using the add* methods instead. trust. 🫢
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. yes it's specific. yes it matters. no you cannot freestyle this one 😀
  • add* β€”
NOTE: only present in associations with list cardinality. if it's not there, that's why, don't panic 🧚

appends a list of objects to any values that may already be stored in the association. it's additive, it's generous, it's stacking the collection πŸ“šβœ¨

DATA CHECKING: ensure that all arguments are of the correct MAGE-OM class. all of them. every single one. no strays 🚨

🧚 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. one base class to rule them all, 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. (go read it, bestie, it's right there πŸ’œ)


πŸ’€ BUGS πŸ’€

please send bug reports to the project mailing list: (mged-mage 'at' lists 'dot' sf 'dot' net)

not me asking you to email a mailing list in 2020s but okay, the classics ate πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

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

the founder. the originator. the blueprint. we stan 🌟


🌈 SEE ALSO 🌈

that's it. that's the list. sometimes the family tree is just one leaf πŸƒ


😭 POD ERRORS 😭

hey! the above document had some coding errors, which are explained below. the docs are a little messy, it's fine, we love them anyway πŸ’–

  • Around line 283:

'=item' outside of any '=over'

  • Around line 368:

You forgot a '=back' before '=head2'

  • Around line 612:

Expected '=item 2'

  • Around line 617:

Expected '=item 3'

  • Around line 622:

Expected '=item 4'


and that's a wrap on this whole page, bestie!! πŸŽ€βœ¨ this was perl v5.32.0 doing its thing, dated 2020-11-27, and it's the MAGE::...mation(3pm) page from the user contributed perl documentation. slay, stay safe, and always check your cardinality before you set* anything πŸ’…πŸ¦‹πŸ’œ