PhylogeneticNode
in package
A leaf is a node with no children and must carry a name (the taxon it represents) ; an internal node commonly has no name, since Newick and neighbor-joining rarely name ancestral nodes. Branch length is the distance to this node's OWN parent, so it is meaningless - and left null - on the root of a tree. Negative branch lengths are accepted without validation : neighbor-joining can legitimately produce one when the input distances are slightly non-additive (measurement noise), a well documented property of the algorithm, not an error this value object should reject.
Class PhylogeneticNode
Tags
Table of Contents
Properties
- $branchLength : float|null
- $children : array<string|int, PhylogeneticNode>
- $name : string|null
Methods
- __construct() : mixed
- PhylogeneticNode constructor.
- getBranchLength() : float|null
- getChildren() : array<string|int, PhylogeneticNode>
- getLeafNames() : array<string|int, string>
- getName() : string|null
- isLeaf() : bool
- toNewick() : string
- Serializes this node and its whole subtree as a Newick string, semicolon included.
- newickLabel() : string
- A name holding a blank, a quote or a character Newick uses for its structure is quoted, its quotes doubled : written bare, it would not read back as the same name. So is a name holding an underscore, which a reader following the specification turns into a blank.
- toNewickFragment() : string
Properties
$branchLength
private
float|null
$branchLength
= null
Distance to this node's own parent ; null when not specified (e.g. the root)
$children
private
array<string|int, PhylogeneticNode>
$children
= null
$name
private
string|null
$name
= null
Methods
__construct()
PhylogeneticNode constructor.
public
__construct(string|null $sName, float|null $fBranchLength[, array<string|int, PhylogeneticNode> $aChildren = [] ]) : mixed
Parameters
- $sName : string|null
- $fBranchLength : float|null
- $aChildren : array<string|int, PhylogeneticNode> = []
-
Empty for a leaf
Tags
getBranchLength()
public
getBranchLength() : float|null
Return values
float|nullgetChildren()
public
getChildren() : array<string|int, PhylogeneticNode>
Return values
array<string|int, PhylogeneticNode>getLeafNames()
public
getLeafNames() : array<string|int, string>
Return values
array<string|int, string> —The name of every leaf under this node, depth-first, left to right
getName()
public
getName() : string|null
Return values
string|nullisLeaf()
public
isLeaf() : bool
Return values
booltoNewick()
Serializes this node and its whole subtree as a Newick string, semicolon included.
public
toNewick() : string
Return values
stringnewickLabel()
A name holding a blank, a quote or a character Newick uses for its structure is quoted, its quotes doubled : written bare, it would not read back as the same name. So is a name holding an underscore, which a reader following the specification turns into a blank.
private
static newickLabel(string $sName) : string
Parameters
- $sName : string
Return values
stringtoNewickFragment()
private
toNewickFragment() : string
Return values
string —This node's subtree, without the terminating ";"