与itol.embl.de交互的api

itolapi的Python项目详细描述


Latest VersionPython VersionLicense

CodeshipCodeCovCodeClimateDependency Status

用于交互式生命树(itol)的python api

由Albert Wang创建(git at Albertyw.com)

iTOL (Interactive Tree of Life)python requests package互补。

这个itol api允许本地软件使用^{tt1}将树上载到itol$ 并使用直接python使用itolexport.py导出上载的树 调用或通过shell。与 iTOL website是必需的。

安装

pip install itolapi

将树上载到itol(itol.py)

从命令行

(如果您需要做的不仅仅是显示基本的树结构, 必须从python程序中调用python itol api)

$ itol.py /path/to/example.tree
http://itol.embl.de/external.cgi?tree=1234567890&restore_saved=1

来自python

从Python程序中运行比从运行中灵活得多 命令行并允许访问所有iTOL options

from itolapi import Itol
itol_uploader = Itol()
itol_uploader.add_file('/path/to/example.tree')
itol_uploader.params['treeName'] = 'apple'
status = itol_uploader.upload()
assert status != False
itol_uploader.comm.upload_output
# SUCCESS: 1234567890
itol_uploader.comm.tree_id
# 1234567890
itol_uploader.get_webpage()
# http://itol.embl.de/external.cgi?tree=1234567890&restore_saved=1
itol_uploader.get_itol_export()
# <ItolExport.ItolExport instance at 0x207c5f0>

使用python itol api的示例可以在 examples/example.py

从itol下载树(itolexport.py)

从命令行

(如果要设置除树ID以外的任何参数, 保存文件的位置、文件格式以及是否显示数据集, 必须使用python程序中的itolexport)

$ itolexport.py TREEID FILELOCATION FORMAT [OPTIONS]
选项包括:
  • -d:显示数据集
  • -v:详细输出
  • -h:帮助

来自python

从python程序运行itolexport.py可以使用 iTol提供的选项。

from itolapi import ItolExport
itol_exporter = ItolExport()
itol_exporter.add_export_param_value('tree', tree_id)
assert format in ['png', 'svg', 'eps', 'ps', 'pdf', 'nexus', 'newick']
itol_exporter.add_export_param_value('format', format)
itol_exporter.add_export_param_value(param_key, param_value)
itol_exporter.export(file_location)

the iTOL API page上可以找到有效的param_keyparam_value值。

错误/评论

将错误和评论作为问题发送到Github存储库。

开发

运行测试:

python setup.py install
pip install -r requirements-test.txt
pip install -r requirements-test-python3.txt
mypy itolapi
coverage run setup.py test
coverage report -m

更新pypi:

pip install twine
python setup.py sdist bdist_wheel
twine upload dist/*

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java从Struts操作的钩子更改表单值(Liferay 6.2)   java如何改变Spring MVC处理url“点”字符的行为   Clojure中使用Java接口的问题   junit如何模拟comosDB azure java集成客户端?   运行函数时发生java错误   netbeans Java。jar文件和依赖项   Eclipse中文本字段中的java输入类型   在JAVA中,将集合变量从实时批处理运行时传递到调用批处理文件   java通过Bean验证API中的自定义消息管理异常   XML到json的转换,在Java中,同时保留数据类型   根据JAVA中的列名从Excel文件中获取单元格值   在AsyncTask的doInBackground中未调用java FirebaseMessagingService   java如何在数据库中插入一行?