与ncbi e-utilities的结构化python接口。

eutils的Python项目详细描述


pypi_badgebuild_statusissues_badgecontributorslicensedocschangelog

eutils是一个python包,用于简化搜索、获取和 使用ncbi的E-utilities接口解析记录。

新闻

功能

  • 用于搜索和获取的简单pythonic接口
  • 根据NCBI指南自动查询速率限制
  • 可选的基于sqlite的压缩回复缓存
  • 有助于在答复中获得基本属性的“正面”

一个简单的例子

截至2018年5月1日,NCBI根据客户机是否 已注册。未注册的客户端限制为每秒3个请求; 注册客户每秒被授予10个请求,并且可以请求 更多。见NCBI Announcement 更多信息。

eutils包将根据 NCBI指南(每秒3或10个请求,不带或带API密钥, 分别)。

$ pip install eutils
$ ipython

>>> from eutils import Client

# Initialize a client. This client handles all caching and query
# throttling.  For example:
>>> ec = Client(api_key=os.environ.get("NCBI_API_KEY", None))

# search for tumor necrosis factor genes
# any valid NCBI query may be used
>>> esr = ec.esearch(db='gene',term='tumor necrosis factor')

# fetch one of those (gene id 7157 is human TNF)
>>> egs = ec.efetch(db='gene', id=7157)

# One may fetch multiple genes at a time. These are returned as an
# EntrezgeneSet. We'll grab the first (and only) child, which returns
# an instance of the Entrezgene class.
>>> eg = egs.entrezgenes[0]

# Easily access some basic information about the gene
>>> eg.hgnc, eg.maploc, eg.description, eg.type, eg.genus_species
('TP53', '17p13.1', 'tumor protein p53', 'protein-coding', 'Homo sapiens')

# get a list of genomic references
>>> sorted([(r.acv, r.label) for r in eg.references])
[('NC_000017.11', 'Chromosome 17 Reference GRCh38...'),
 ('NC_018928.2', 'Chromosome 17 Alternate ...'),
 ('NG_017013.2', 'RefSeqGene')]

# Get the first three products defined on GRCh38
#>>> [p.acv for p in eg.references[0].products][:3]
#['NM_001126112.2', 'NM_001276761.1', 'NM_000546.5']

# As a sample, grab the first product defined on this reference (order is arbitrary)
>>> mrna = eg.references[0].products[0]
>>> str(mrna)
'GeneCommentary(acv=NM_001126112.2,type=mRNA,heading=Reference,label=transcript variant 2)'

# mrna.genomic_coords provides access to the exon definitions on this reference

>>> mrna.genomic_coords.gi, mrna.genomic_coords.strand
('568815581', -1)

>>> mrna.genomic_coords.intervals
[(7687376, 7687549), (7676520, 7676618), (7676381, 7676402),
(7675993, 7676271), (7675052, 7675235), (7674858, 7674970),
(7674180, 7674289), (7673700, 7673836), (7673534, 7673607),
(7670608, 7670714), (7668401, 7669689)]

# and the mrna has a product, the resulting protein:
>>> str(mrna.products[0])
'GeneCommentary(acv=NP_001119584.1,type=peptide,heading=Reference,label=isoform a)'

重要注意事项

  • 我们鼓励您browse issues。请报告任何 你发现的问题
  • 使用pip包规范确保保持在minor 用于API稳定性的版本。例如,eutils >=0.1,<0.2

开发和贡献

错误报告、代码补丁和文档的贡献如下 欢迎!

在默认分支中进行开发。请在功能区工作 默认分支的分支或书签。功能分支应 以他们解决的eutils问题命名,如 121更新xml外观合并时,使用提交消息,如 “closes#121:将xml facades更新为新样式的接口”(“关闭n” 自动识别并在按下时关闭车票。)

包含的makefile自动化了许多任务。尤其是 开发准备开发环境并进行测试运行 单元测试。(请在提交之前运行测试!)

再次感谢你的贡献。

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

推荐PyPI第三方库


热门话题
java Android首选项相同getPreference()值的不同数据   字符串如何在Java中连接两个列表中的单词   安卓 Java Socket编程:检测客户端和服务器是否连接   使用JTextField的java无法将值转换为int   在java中,如何在不通过超级构造函数设置的情况下将消息设置为自定义异常类   用于标识属性值的java正则表达式模式   Android中的java不可见谷歌地图   java正确取消启动ExecutorService的JavaFX任务   在非活动java类中使用安卓的融合位置提供程序,并在主活动类中获取经度和纬度   spring为什么我的大摇大摆不能用springboot在java中工作?   java JSF(2.2)ViewScope在Weblogic 12.2.1.2和JDK 8上使用Spring 4.3.7(在Mac OS和Docker Oracle Linux环境上)   java如何用一个按钮提高计时器速度   java如何检查字符是否是元音?   注册表引用了不存在的Java运行时环境安装或运行时已损坏错误   来自ResultSet java的mysql getDateTime   maven LanguageTool Java API是否具有“无用”依赖关系?   twitter api身份验证的java Trycatch问题   java在Apache Struts 1.1中是否可以显式白名单?   安卓致命异常:主java。lang.RuntimeException:被问及未知片段