Bio::Phylo::Matrices::Datum - Character state sequence
use Bio::Phylo::Factory;
my $fac = Bio::Phylo::Factory->new;
# instantiating a datum object...
my $datum = $fac->create_datum(
-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 = $fac->create_taxon(
-name => 'Lemur_catta'
);
$datum->set_taxon( $taxon );
# instantiating a matrix...
my $matrix = $fac->create_matrix;
# ...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. This package contains the getters and
setters that alter the internal state of the datum object. Additional
(stateless) behaviours are defined in the Bio::Phylo::Matrices::DatumRole
package.
- set_weight()
- 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.
- set_position()
- 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.
- set_annotation()
- 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).
- set_annotations()
- 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. If no
argument given, annotations
are reset.
Comments: Use this method to annotate
multiple characters. To
annotate a single character,
use 'set_annotation' (see
above).
- get_weight()
- Gets invocant weight.
Type : Accessor
Title : get_weight
Usage : my $weight = $datum->get_weight;
Function: Retrieves a datum's weight.
Returns : FLOAT
Args : NONE
- get_position()
- 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
- get_annotation()
- 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
- get_annotations()
- Retrieves character annotations (array ref).
Type : Accessor
Title : get_annotations
Usage : my @anno = @{ $datum->get_annotation() };
Function: Retrieves annotations
Returns : ARRAY
Args : NONE
There is a mailing list at
<https://groups.google.com/forum/#!forum/bio-phylo> for any user or
developer questions and discussions.
- Bio::Phylo::Matrices::DatumRole
- This object inherits from Bio::Phylo::Matrices::DatumRole, so the methods
defined therein are also applicable to Bio::Phylo::Matrices::Datum
objects.
- Bio::Phylo::Manual
- Also see the manual: Bio::Phylo::Manual and
<http://rutgervos.blogspot.com>.
If you use Bio::Phylo in published research, please cite it:
Rutger A Vos, Jason Caravas, Klaas Hartmann,
Mark A Jensen and Chase Miller, 2011. Bio::Phylo -
phyloinformatic analysis using Perl. BMC Bioinformatics 12:63.
<http://dx.doi.org/10.1186/1471-2105-12-63>