def run(self): logger.info('TreeFollow object running, %s' % self.thisGrandParentDir) nt = newickTreeParser(self.thisNewickStr, 0.0) name = lsc.nameTree(nt) commonParentDir = os.path.abspath(os.path.join(self.options.simDir, name)) if nt.distance == 0: if nt.internal: # branch point branches = { 'left' : lsc.tree2str(nt.left), 'right': lsc.tree2str(nt.right) } for b in branches: if not lsc.nodeIsLeaf(branches[b]): self.addChildTarget(Tree(branches[b], commonParentDir, b, self.options)) childDir = lsc.treeStr2Dir(lsc.takeNewickStep(branches[b], self.options)[0], self.options.simDir) else: # follow up to leaf cycles... Transalign and Stats only self.setFollowOnTarget(LeafCleanUp(commonParentDir, self.thisGrandParentDir, self.options)) else: # stem with distance self.addChildTarget(Tree(lsc.tree2str(nt), commonParentDir, 'stem', self.options)) childDir = lsc.treeStr2Dir(lsc.takeNewickStep(lsc.tree2str(nt), self.options)[0], self.options.simDir)
def __init__(self, thisNewickStr, parentDir, branchStr, options): Target.__init__(self) (self.thisNewickStr, self.thisStepLength) = lsc.takeNewickStep(thisNewickStr, options) self.parentDir = parentDir self.thisBranchStr = branchStr # either 'left', 'right', 'stem' self.options = options