def run(self): logger.info('MergeTree object running, name: %s' % (self.name)) if self.nt is None: return for t in [self.nt.left, self.nt.right]: if t is None: continue t.distance = 0.0 if not os.path.exists(os.path.join(self.options.simDir, lsc.nameTree(t), self.name + '.maf')): sys.stderr.write('%s does not exist, recurse\n' % os.path.join(self.options.simDir, lsc.nameTree(t), self.name+ '.maf')) self.addChildTarget(MergeTree(t, self.nodeDict, self.nodeParentDict, self.leafsDict, self.options)) else: sys.stderr.write('%s does exist, don\'t recurse\n' % os.path.join(self.options.simDir, lsc.nameTree(t),self.name + '.maf')) self.setFollowOnTarget(MergeMafsDown(self.nt, self.nodeDict, self.nodeParentDict, self.leafsDict, self.nodeParent, self.options))
def __init__(self, nt, nodeDict, nodeParentDict, leafsDict, options): Target.__init__(self) nt.distance = 0.0 self.nt = nt self.name = lsc.nameTree(self.nt) self.nodeDict = nodeDict self.nodeParentDict = nodeParentDict self.leafsDict = leafsDict self.options = options if self.name != self.options.rootName: self.nodeParent = self.nodeParentDict[self.name] else: self.nodeParent = self.options.rootName
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)