function tripal_phylogeny_taxonomy_import_add_node
2.x tripal_phylogeny.taxonomy.inc | tripal_phylogeny_taxonomy_import_add_node(&$tree, $node, $lineage_depth) |
Parameters
unknown $node:
1 call to tripal_phylogeny_taxonomy_import_add_node()
- tripal_phylogeny_ncbi_taxonomy_import in tripal_phylogeny/
includes/ tripal_phylogeny.taxonomy.inc
File
- tripal_phylogeny/
includes/ tripal_phylogeny.taxonomy.inc, line 356
Code
function tripal_phylogeny_taxonomy_import_add_node(&$tree, $node, $lineage_depth) {
// Get the branch set for the tree root.
$branch_set = &$tree['branch_set'];
// Iterate through the tree up until the depth where this node will
// be placed.
$node_depth = $node['depth'];
for ($i = 1; $i <= $node_depth; $i++) {
// Iterate through any existing nodes in the branch set to see if
// the node name matches the correct name for the lineage at this
// depth. If it matches then it is inside of this branch set that
// we will place the node.
for ($j = 0; $j < count($branch_set); $j++) {
// If this node already exists in the tree then return.
if ($branch_set[$j]['name'] == $node['name'] and
$branch_set[$j]['depth'] = $node['depth']) {
return;
}
// Otherwise, set the branch to be the current branch and continue.
if ($branch_set[$j]['name'] == $lineage_depth[$i -1]) {
$branch_set = &$branch_set[$j]['branch_set'];
break;
}
}
}
// Add the node to the last branch set. This should be where this node goes.
$branch_set[] = $node;
}