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


Python NexusReader.write_to_file方法代码示例

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


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

示例1: test_write_to_file

# 需要导入模块: from nexus import NexusReader [as 别名]
# 或者: from nexus.NexusReader import write_to_file [as 别名]
 def test_write_to_file(self):
     tmp = NamedTemporaryFile(delete=False, suffix=".nex")
     tmp.close()
     nex = NexusReader(os.path.join(EXAMPLE_DIR, 'example.nex'))
     nex.write_to_file(tmp.name)
     assert os.path.isfile(tmp.name)
     n2 = NexusReader(tmp.name)
     assert n2.data.matrix == nex.data.matrix
     assert sorted(n2.data.taxa) == sorted(nex.data.taxa)
     os.unlink(tmp.name)        # cleanup
开发者ID:SimonGreenhill,项目名称:python-nexus,代码行数:12,代码来源:test_reader.py

示例2: len

# 需要导入模块: from nexus import NexusReader [as 别名]
# 或者: from nexus.NexusReader import write_to_file [as 别名]
        sys.exit("No trees found in found %s!" % nexusname)
    if options.quiet is False:
        print "%d trees found with %d translated taxa" % (nexus.trees.ntrees, len(nexus.trees.translators))

    # Delete trees
    if options.deltree:
        nexus = run_deltree(options.deltree, nexus, options.quiet)

    # Resample trees
    if options.resample:
        nexus = run_resample(options.resample, nexus, options.quiet)

    # Randomly sample trees
    if options.random:
        nexus = run_random(options.random, nexus, options.quiet)

    # remove comments
    if options.removecomments:
        nexus = run_removecomments(nexus, options.quiet)

    # detranslate
    if options.detranslate:
        nexus = run_detranslate(nexus, options.quiet)

    if newnexus is not None:
        nexus.write_to_file(newnexus)
        if options.quiet is False:
            print "New nexus with %d trees written to %s" % (nexus.trees.ntrees, newnexus)
    else:
        print nexus.write()
开发者ID:pombredanne,项目名称:PTP-web-server,代码行数:32,代码来源:nexus_treemanip.py

示例3: hash

# 需要导入模块: from nexus import NexusReader [as 别名]
# 或者: from nexus.NexusReader import write_to_file [as 别名]
def hash(salt, taxon):
    return hashlib.md5("%s-%s" % (salt, taxon)).hexdigest()

if __name__ == '__main__':
    from optparse import OptionParser
    parser = OptionParser(usage="usage: %prog fudge.nex output.nex")
    options, nexuslist = parser.parse_args()
    
    try:
        nexusname = args[0]
    except IndexError:
        print(__doc__)
        print("Author: %s\n" % __author__)
        parser.print_help()
        sys.exit()
    
    try:
        newnexus = args[1]
    except IndexError:
        newnexus = None
        
    nexus = NexusReader(nexusname)
    nexus = anonymise(nexus)
    
    if newnexus is not None:
        nexus.write_to_file(newnexus)
        print("New nexus written to %s" % newnexus)
    else:
        print(nexus.write_to_file(hash('filename', filename)))
开发者ID:zhangjiajie,项目名称:PTP,代码行数:31,代码来源:nexus_anonymise.py


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