Working with arrays of trees
This example demonstrates how one can manipulate an array of trees for efficient bulk processing.
Arrays of trees (Tree[]
) can be read in with any of the readTrees*()
functions. That is, readTreesFromNewick()
, readTreesFromNexus()
, readTreesFromPhyloXML()
, and readTreesFromNeXML()
. The read()
function also returns an array of trees, taking flags for the input string and expected file format.
In the below example, we parse two trees from phyloXML format, reroot them, rescale their branches randomly, and ladderise. Output is then written to newick where it could, for example, be passed to visualisation code.
See the Pen tree-arrays by Leo Featherstone (@LeoFeatherstone) on CodePen.