'parses a newick representation of a tree into a PhyloTree data structure,
which can be easily converted to json'

def _parseNewickToJson(self, newickString, treeName=None, nameMap=None):

    self.phyloTree = PhyloTree()
    newickString = self.cleanNewickString(newickString)
    if nameMap:
        newickString = self._mapName(newickString, nameMap)
    self.phyloTree.root = self.parseNode(newickString, 0)
    if nameMap:
        self.phyloTree.addAttributesToRoot({'treeName': treeName})
    return self.phyloTree.generateJsonableDict()
