当前位置: 首页>>代码示例>>Python>>正文


Python LoadTree.getSubTree方法代码示例

本文整理汇总了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;')
开发者ID:carze,项目名称:clovr-base,代码行数:12,代码来源:test_tree2.py

示例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"
开发者ID:squirrelo,项目名称:SelexTrace,代码行数:32,代码来源:clade_to_struct.py

示例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)
开发者ID:carze,项目名称:clovr-base,代码行数:6,代码来源:test_bootstrap.py


注:本文中的cogent.LoadTree.getSubTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。