我正在尝试使用Biopython从NCBI获取登录号的fasta序列。通常这些序列都是成功下载的。但偶尔我会遇到以下错误:
http.客户端。未完成读取:未完成读取(读取61808640字节)
我已经搜索了答案
How to handle IncompleteRead: in python
我已经试过顶级答案
https://stackoverflow.com/a/14442358/4037275
。它正在工作。然而,问题是,它下载了部分序列。还有别的办法吗。有人能给我指出正确的方向吗?
from Bio import Entrez
from Bio import SeqIO
Entrez.email = "my email id"
def extract_fasta_sequence(NC_accession):
"This takes the NC_accession number and fetches their fasta sequence"
print("Extracting the fasta sequence for the NC_accession:", NC_accession)
handle = Entrez.efetch(db="nucleotide", id=NC_accession, rettype="fasta", retmode="text")
record = handle.read()