Bio::Phylo::Matrices::Datum - The character state sequence object.
use Bio::Phylo::Matrices::Matrix; use Bio::Phylo::Matrices::Datum; use Bio::Phylo::Taxa::Taxon; # instantiating a datum object... my $datum = Bio::Phylo::Matrices::Datum->new( -name => 'Tooth comb size, -type => 'STANDARD', -desc => 'number of teeth in lower jaw comb', -pos => 1, -weight => 2, -char => [ 6 ], ); # ...and linking it to a taxon object my $taxon = Bio::Phylo::Taxa::Taxon->new( -name => 'Lemur_catta' ); $datum->set_taxon( $taxon ); # instantiating a matrix... my $matrix = Bio::Phylo::Matrices::Matrix->new; # ...and insert datum in matrix $matrix->insert($datum);
The datum object models a single observation or a sequence of observations, which can be linked to a taxon object.
Datum object constructor.
Type : Constructor Title : new Usage : my $datum = Bio::Phylo::Matrices::Datum->new; Function: Instantiates a Bio::Phylo::Matrices::Datum object. Returns : A Bio::Phylo::Matrices::Datum object. Args : None required. Optional: -taxon => $taxon, -weight => 0.234, -type => DNA, -pos => 2,
Sets invocant weight.
Type : Mutator Title : set_weight Usage : $datum->set_weight($weight); Function: Assigns a datum's weight. Returns : Modified object. Args : The $weight argument must be a number in any of Perl's number formats.
Sets character state(s)
Type : Mutator Title : set_char Usage : $datum->set_char($char); Function: Assigns a datum's character value. Returns : Modified object. Args : The $char argument is checked against the allowed ranges for the various character types: IUPAC nucleotide (for types of DNA|RNA|NUCLEOTIDE), IUPAC single letter amino acid codes (for type PROTEIN), integers (STANDARD) or any of perl's decimal formats (CONTINUOUS). The $char can be: * a single character; * a string of characters; * an array reference of characters; * an array of characters; Comments: Note that on assigning characters to a datum, previously set annotations are removed.
Set invocant starting position.
Type : Mutator Title : set_position Usage : $datum->set_position($pos); Function: Assigns a datum's position. Returns : Modified object. Args : $pos must be an integer.
Sets single annotation.
Type : Mutator Title : set_annotation Usage : $datum->set_annotation( -char => 1, -annotation => { -codonpos => 1 } ); Function: Assigns an annotation to a character in the datum. Returns : Modified object. Args : Required: -char => $int Optional: -annotation => $hashref Comments: Use this method to annotate a single character. To annotate multiple characters, use 'set_annotations' (see below).
Sets list of annotations.
Type : Mutator Title : set_annotations Usage : $datum->set_annotations( { '-codonpos' => 1 }, { '-codonpos' => 2 }, { '-codonpos' => 3 }, ); Function: Assign annotations to characters in the datum. Returns : Modified object. Args : Hash references, where position in the argument list matches that of the specified characters in the character list. Comments: Use this method to annotate multiple characters. To annotate a single character, use 'set_annotation' (see above).
Gets invocant weight.
Type : Accessor Title : get_weight Usage : my $weight = $datum->get_weight; Function: Retrieves a datum's weight. Returns : FLOAT Args : NONE
Gets characters.
Type : Accessor Title : get_char Usage : my $char = $datum->get_char; Function: Retrieves a datum's character value. Returns : In scalar context, returns a single character, or a string of characters (e.g. a DNA sequence, or a space delimited series of continuous characters). In list context, returns a list of characters (of zero or more characters). Args : NONE
Gets invocant starting position.
Type : Accessor Title : get_position Usage : my $pos = $datum->get_position; Function: Retrieves a datum's position. Returns : a SCALAR integer. Args : NONE
Retrieves character annotation (hashref).
Type : Accessor Title : get_annotation Usage : $datum->get_annotation( '-char' => 1, '-key' => '-codonpos', ); Function: Retrieves an annotation to a character in the datum. Returns : SCALAR or HASH Args : Optional: -char => $int Optional: -key => $key
Gets invocant number of characters.
Type : Accessor Title : get_length Usage : my $length = $datum->get_length; Function: Retrieves a datum's length. Returns : a SCALAR integer. Args : NONE
Gets state at argument index.
Type : Accessor Title : get_by_index Usage : my $val = $datum->get_by_index($i); Function: Retrieves state at index $i. Returns : a character state. Args : INT
Tests if invocant can contain argument.
Type : Test Title : can_contain Usage : &do_something if $datum->can_contain( @args ); Function: Tests if $datum can contain @args Returns : BOOLEAN Args : One or more arguments as can be provided to set_char
Reverses contents.
Type : Method Title : reverse Usage : $datum->reverse; Function: Reverses a datum's contained characters Returns : Returns modified $datum Args : NONE
Appends argument to invocant.
Type : Method Title : reverse Usage : $datum->concat($datum1); Function: Appends $datum1 to $datum Returns : Returns modified $datum Args : NONE
Validates invocant data contents.
Type : Method Title : validate Usage : $datum->validate; Function: Validates character data contained by $datum Returns : True or throws Bio::Phylo::Util::Exceptions::InvalidData Args : NONE
Not implemented!
This object inherits from Bio::Phylo::Taxa::TaxonLinker, so the methods defined therein are also applicable to Bio::Phylo::Matrices::Datum objects.
This object inherits from Bio::Phylo::Matrices::TypeSafeData, so the methods defined therein are also applicable to Bio::Phylo::Matrices::Datum objects.
Also see the manual: Bio::Phylo::Manual.
$Id: Datum.pm 4265 2007-07-20 14:14:44Z rvosa $
To install Bio::Phylo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bio::Phylo
CPAN shell
perl -MCPAN -e shell install Bio::Phylo
For more information on module installation, please visit the detailed CPAN module installation guide.