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


Python Tree.run_bionj方法代码示例

本文整理汇总了Python中tree.Tree.run_bionj方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.run_bionj方法的具体用法?Python Tree.run_bionj怎么用?Python Tree.run_bionj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tree.Tree的用法示例。


在下文中一共展示了Tree.run_bionj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TCSeqRec

# 需要导入模块: from tree import Tree [as 别名]
# 或者: from tree.Tree import run_bionj [as 别名]

#.........这里部分代码省略.........
            )
        os.remove('{0}/{1}.phy'.format(tmpdir, filename))
        return self.tree

    def get_bionj_tree(
        self,
        model=None,
        datatype=None,
        ncat=1,
        optimise='n',
        tmpdir='/tmp',
        overwrite=True,
        verbose=False,
        ):

        if not overwrite and self.tree.newick:
            print '{0}: Tree exists and overwrite set to false'.format(self.name)
            return self.tree
        self.Tree = Tree()
        filename = self._write_temp_phylip(tmpdir=tmpdir, use_hashname=True)
        print 'Running bionj on ' + str(self.name) + '...'
        input_file = '{0}/{1}.phy'.format(tmpdir, filename)

        if not model and not datatype:  # quick-fix to allow specification of other
            if self.datatype == 'dna':  # models when calling phyml
                model = 'GTR'
                datatype = 'nt'
            elif self.datatype == 'protein':
                model = 'WAG'
                datatype = 'aa'
            else:
                print 'I don\'t know this datatype: {0}'.format(self.datatype)
                return
        t = self.tree.run_bionj(
            model,
            input_file,
            datatype,
            ncat=ncat,
            name=self.name,
            optimise=optimise,
            overwrite=overwrite,
            verbose=verbose,
            )
        os.remove('{0}/{1}.phy'.format(tmpdir, filename))
        return self.tree

    def get_raxml_tree(self, tmpdir='/tmp', overwrite=True):
        if not overwrite and self.tree.newick:
            print '{0}: Tree exists and overwrite set to false'.format(self.name)
            return self.tree
        self.tree = Tree()
        self._write_temp_phylip(tmpdir=tmpdir)
        print 'Running raxml on ' + str(self.name) + '...'
        input_file = '{0}/{1}.phy'.format(tmpdir, self.name)
        if self.datatype == 'dna':
            model = 'GTRGAMMA'
        elif self.datatype == 'protein':
            model = 'PROTGAMMAWAG'
        else:
            print 'I don\'t know this datatype: {0}'.format(self.datatype)
            return
        self.tree.run_raxml(model, input_file, self.name, tmpdir,
                            overwrite=overwrite)
        os.remove('{0}/{1}.phy'.format(tmpdir, self.name))
        if os.path.isfile('{0}/{1}.phy.reduced'.format(tmpdir,
                          self.name)):
开发者ID:kgori,项目名称:clustering_project,代码行数:70,代码来源:sequence_record.py


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