【问题标题】:Retrieve data from GenBank with Bio.Entrez module使用 Bio.Entrez 模块从 GenBank 检索数据
【发布时间】:2019-02-15 04:11:24
【问题描述】:
我正在尝试解决 Rosalind 的一个挑战,但我似乎无法找到在特定时间范围内检索数据的方法。
http://rosalind.info/problems/gbk/
如何/如何修改 Entrez.esearch() 以指定时间范围?
Question:
Given:一个属名,后跟两个YYYY/M/D格式的日期。
Return:在指定日期之间发布的给定属的核苷酸基因库条目数。
测试数据:
答案:7
【问题讨论】:
-
您需要弄清楚要提供给 esearch 的确切查询。您可以通过转到ncbi.nlm.nih.gov/nuccore 来执行此操作,单击搜索框正下方的“高级”链接以转到“高级搜索”页面。在那里,您可以从下拉列表中选择生物体和出版日期并执行搜索。在结果页面上,您将在右侧看到一个“搜索详细信息”框,其中包含发送到数据库的确切文本查询。您可以简单地将其复制/粘贴到您的 Entrez.esearch 查询功能中或根据您的需要进行修改。
标签:
python
bioinformatics
biopython
【解决方案1】:
非常感谢@Kayvee 的指点!它就像一个魅力!
这是一种通过'posted between start-end'搜索有机体的格式:
(Anthoxanthum[Organism]) AND ("2003/7/25"[Publication Date] : "2005/12/27"[Publication Date])
这是 Python 代码:
# GenBank gene database
geneName = "Anthoxanthum"
pubDateStart = "2003/7/25"
pubDateEnd = "2005/12/27"
searchTerm = f'({geneName}[Organism]) AND("{pubDateStart}"[Publication Date]: "{pubDateEnd}"[Publication Date])'
print(f"\n[GenBank gene database]:")
Entrez.email = "please@pm.me"
handle = Entrez.esearch(db="nucleotide", term=searchTerm)
record = Entrez.read(handle)
print(record["Count"])