提问人:Jevgenij Posaškov 提问时间:10/24/2023 最后编辑:Jevgenij Posaškov 更新时间:10/24/2023 访问量:28
从 Entrez 下载完整记录
Downloading full records from Entrez
问:
我无法从NCBI获得大肠杆菌基因组的数据。为此,我使用了两个文档来获取数据 http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec149 http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec37
所以我写了一个代码:
from Bio import Entrez
from Bio import SeqIO
Entrez.email = "may mail"
organism_id = "NC_000913"
handle = Entrez.efetch(db="nucleotide", id=organism_id, rettype="gbwithparts", retmode="text")
record = SeqIO.read(handle, "genbank")
handle.close()
genome_length = len(record.seq)
但是,我收到一个奇怪的错误。例如:
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py:1348, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1347 try:
-> 1348 h.request(req.get_method(), req.selector, req.data, headers,
1349 encode_chunked=req.has_header('Transfer-encoding'))
1350 except OSError as err: # timeout error
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1282, in HTTPConnection.request(self, method, url, body, headers, encode_chunked)
1281 """Send a complete request to the server."""
-> 1282 self._send_request(method, url, body, headers, encode_chunked)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1328, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked)
1327 body = _encode(body, 'body')
-> 1328 self.endheaders(body, encode_chunked=encode_chunked)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1277, in HTTPConnection.endheaders(self, message_body, encode_chunked)
1276 raise CannotSendHeader()
-> 1277 self._send_output(message_body, encode_chunked=encode_chunked)
File /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py:1037, in HTTPConnection._send_output(self, message_body, encode_chunked)
1036 del self._buffer[:]
-> 1037 self.send(msg)
1039 if message_body is not None:
1040
...
-> 1351 raise URLError(err)
1352 r = h.getresponse()
1353 except:
URLError:
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
我不知道我该如何解决这个问题?你能帮帮我吗?提前致谢。
答: 暂无答案
评论