本文整理汇总了Python中cogent.LoadTree.getSubTree方法的典型用法代码示例。如果您正苦于以下问题:Python LoadTree.getSubTree方法的具体用法?Python LoadTree.getSubTree怎么用?Python LoadTree.getSubTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cogent.LoadTree
的用法示例。
在下文中一共展示了LoadTree.getSubTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_params_merge
# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getSubTree [as 别名]
def test_params_merge(self):
t = LoadTree(treestring='((((a,b)ab,c)abc),d)')
for (label, length, beta) in [('a',1, 20),('b',3,2.0),('ab',4,5.0),]:
t.getNodeMatchingName(label).params = {'length':length, 'beta':beta}
t = t.getSubTree(['b', 'c', 'd'])
self.assertEqual(t.getNodeMatchingName('b').params,
{'length':7, 'beta':float(2*3+4*5)/(3+4)})
self.assertRaises(ValueError, t.getSubTree, ['b','c','xxx'])
self.assertEqual(str(t.getSubTree(['b','c','xxx'],ignore_missing=True)),
'(b:7,c)root;')
示例2: LoadSeqs
# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getSubTree [as 别名]
header = line.split()[0]
fileout.write(''.join([">", header, "\n", seqs[header], "\n"]))
rawseqs.append((header, seqs[header]))
tips.append(header)
fileout.close()
print "Aligning seqs using muscle with -diags"
seqs = LoadSeqs(data=rawseqs, moltype=RNA, aligned=False)
aln = align_unaligned_seqs(seqs, RNA, {"-diags": True})
fileout = open(folderout + "/" + basenames + "-seqsaligned.fasta", 'w')
fileout.write(str(aln))
fileout.close()
print "Folding sequences"
#get subtree of the clade being folded to pass to PPfold
tr = LoadTree(argv[3])
sub_tree = tr.getSubTree(tips, keep_root=True)
filesubtree = open(folderout + "/" + basenames + "-subtreeDistances.nwk", 'w')
filesubtree.write(sub_tree.getNewick(with_distances=True))
filesubtree.close()
filesubtree = open(folderout + "/" + basenames + "-subtree.nwk", 'w')
filesubtree.write(sub_tree.getNewick(with_distances=False))
#call PPfold with aligned sequences and subtree
args = ["java", "-jar", PPFOLDDIR + "PPfold.jar", folderout + "/" + basenames + "-seqsaligned.fasta", "--outputd", folderout]
check_call(args)
print "Converting sequences to vienna"
check_call(["ct2b.pl", folderout + basenames + "-seqsaligned.ct", ">",folderout + basenames + "-vienna.txt"])
print "DONE"
示例3: gettree
# 需要导入模块: from cogent import LoadTree [as 别名]
# 或者: from cogent.LoadTree import getSubTree [as 别名]
def gettree(self):
treeobj = LoadTree(filename=os.path.join(data_path, "murphy.tree"))
return treeobj.getSubTree(seqnames)