import pandas as pd
from Bio.KEGG import REST
df = pd.read_excel(r'E:\XY\hhly1\clean\unchime-dn-out\picrust2/kegg.xlsx')
pwid = df['pathway']
my_dict={}
for id in pwid:
print(id)
pathway = REST.kegg_get(id).read()
for i in pathway.rstrip().split('\n'):
feature = str(i.split('\t'))
if 'CLASS 'in feature:
q = str(i.split(';')[0])
name1 = str(q.strip('CLASS').strip())
name2 = str(i.split(';')[1])
value = name1 +'/'+ name2
my_dict[id] = value
# print(my_dict)
df['name'] = df['pathway'].apply(lambda x : my_dict[x])
Biopython根据ko号访问KEGG数据库并找到通路LEVEL1和LEVE2
最新推荐文章于 2023-10-24 15:16:48 发布