0

如何在给定染色体的 Genbank 标识符的情况下查询 NCBI 的序列,并使用 Biopython 开始和停止位置?

CP001665    NAPP    TILE    6373    6422    .   +   .   cluster=9; 
CP001665    NAPP    TILE    6398    6447    .   +   .   cluster=3; 
CP001665    NAPP    TILE    6423    6472    .   +   .   cluster=3; 
CP001665    NAPP    TILE    6448    6497    .   +   .   cluster=3;
CP001665    NAPP    TILE    7036    7085    .   +   .   cluster=10; 
CP001665    NAPP    TILE    7061    7110    .   +   .   cluster=3; 
CP001665    NAPP    TILE    7073    7122    .   +   .   cluster=3;
4

3 回答 3

1
from Bio import Entrez
from Bio import SeqIO

Entrez.email = "sample@example.org"

handle = Entrez.efetch(db="nuccore",
                       id="CP001665",
                       rettype="gb",
                       retmode="text")

whole_sequence = SeqIO.read(handle, "genbank")

print whole_sequence[6373:6422]

一旦您知道id要从中获取的数据库和数据库,就可以使用Entrez.efetch该文件来获取该文件的句柄。您应该指定返回类型 ( rettype="gb") 和模式 ( retmode="text"),以获取类文件数据的处理程序。

然后将此处理程序传递给SeqIO,它应该返回一个SeqRecord对象。s 的一个很好的特性SeqRecord是它们可以被干净地切片为列表。如果您可以从某处检索起点和终点,则上述print语句将返回:

ID: CP001665.1
Name: CP001665
Description: Escherichia coli 'BL21-Gold(DE3)pLysS AG', complete genome.
Number of features: 0
Seq('GCGCTAACCATGCGAGCGTGCCTGATGCGCTACGCTTATCAGGCCTACG', IUPACAmbiguousDNA())
于 2014-07-01T12:35:48.650 回答
0

大概是这样的吧?

    from Bio import Entrez
    Entrez.email = "Your.Name.Here@example.org"
    handle = Entrez.efetch(db="genome", id="56", rettype="fasta")

您需要确定正确的数据库并对其进行查询。我建议使用 Assembly Advanced Search Builder 来构建您的查询,看看您是否可以通过这种方式解决问题:

http://www.ncbi.nlm.nih.gov/assembly/advanced

于 2014-06-28T07:02:15.263 回答
0

要下载核苷酸/蛋白质序列,不必使用 Biopython。您可以使用 urllib2 或 Biopython 或 Bioperl。此处列表包含 NCBI GI ID。

import urllib2
List = ['440906003','440909279','440901052']
for gi in List:
    url = 'https://www.ncbi.nlm.nih.gov/sviewer/viewer.cgi?    tool=portal&sendto=on&log$=seqview&db=protein&dopt=fasta&sort=&val='+gi+'&from=begin&to=end&maxplex=1'
    resp = urllib2.urlopen(url)
    page = resp.read()
    print (page),
于 2016-08-26T04:37:08.203 回答