diff --git a/package.json b/package.json index b9cdfd4..7a6364f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phylotree", - "version": "1.4.1", + "version": "1.4.2", "main": "dist/phylotree.js", "unpkg": "dist/phylotree.js", "jsdelivr": "dist/phylotree.js", diff --git a/src/formats/newick.js b/src/formats/newick.js index b8a438d..6453555 100644 --- a/src/formats/newick.js +++ b/src/formats/newick.js @@ -230,14 +230,16 @@ function newickParser(nwk_str, options={}) { * @returns {String} newick - Phylogenetic tree serialized as a Newick string. */ -// TODO: break this out into two seperate functions -export function getNewick(annotator, root) { +export function getNewick(annotator, root) { let self = this; if (!annotator) annotator = d => ''; function nodeDisplay(n) { + // Skip the node if it is hidden + if (n.notshown) return; + if (!isLeafNode(n)) { element_array.push("("); n.children.forEach(function(d, i) { @@ -273,7 +275,6 @@ export function getNewick(annotator, root) { nodeDisplay(root || this.nodes); return element_array.join("")+";"; - } export default newickParser;