def oc_classify(records, one_codex_api_key, progress=False, stdout=False):
oc_auth = aiohttp.BasicAuth(one_codex_api_key)
conn = aiohttp.TCPConnector(limit=10)
with aiohttp.ClientSession(auth=oc_auth, connector=conn) as oc_session:
with aiohttp.ClientSession(connector=conn) as ebi_session:
tasks = [classify_taxify(oc_session, ebi_session, r.id, str(r.seq)) for r in records]
# No async generators in 3.5... :'(
# return [await f for f in tqdm.tqdm(asyncio.as_completed(tasks), total=len(tasks))]
records = []
for f in tqdm.tqdm(asyncio.as_completed(tasks),
disable=not progress,
total=len(tasks)):
response = await f
record = build_record(response[0], response[1])
if stdout:
print(record.format('fasta'), end='')
records.append(record)
return records
# --------------------------------------------------------------------------------------------------
评论列表
文章目录