var text = "(A:0.1,B:0.2,(C:0.3,(D:0.4,E:0.6):0.1):0.5);";
var tree = patristic.parseNewick(text);
console.log(tree);
This generates a Branch object with the following contents:
{
"id": "",
"length": 0,
"children": [
{
"id": "A",
"length": 0.1
},
{
"id": "B",
"length": 0.2
},
{
"id": "",
"length": 0.5,
"children": [
{
"id": "C",
"length": 0.3
},
{
"id": "",
"length": 0.1,
"children": [
{
"id": "D",
"length": 0.4
},
{
"id": "E",
"length": 0.6
}
]
}
]
}
]
}
Open your console to mess around with it!