7.1 更新内容
偶然发现有人写了个包,直接用就行,很方便,就是保存文件有点小bug
点击链接跳转
用法:
下载全部文件,在下载目录操作就行。注:需要提前安装svgutils包
参考链接
KEGG Weblink:
1.https://www.bioinfo-scrounger.com/archives/191/
ipath:
2.https://www.kegg.jp/kegg/docs/weblink.html
3.https://pathways.embl.de/ipath3.cgi
pathview:
4.https://www.bioinfo-scrounger.com/archives/639/
5.https://bioconductor.org/packages/release/bioc/vignettes/pathview/inst/doc/pathview.pdf
ipath3:
批量生成通路图并保存本地。(无交互)
如果不知道Cooki以及User-Agent'等信息,网页按F12查看接口信息
def keggAPI(ko_ID,ko_dict,ipath_result_dir):
url = 'https://pathways.embl.de/mapping.cgi'
headers = {'Content-Type':"application/x-www-form-urlencoded",
'Cookie':【替换成自己的】,
'User-Agent': 【替换成自己的】,
'Accept':"svg/html,text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}
KO_list = ko_dict[ko_ID]
KO_str = '%0D'.join(KO_list)
data = "selection=" + KO_str + "&default_opacity=1&default_width=3&default_radius=7&default_color=%23aaaaaa&background_color=%23ffffff&tax_filter=&map=metabolic&export_type=svg&export_dpi=120"
outfile = os.path.join(ipath_result_dir,ko_ID+".html")
r = requests.post(url,data,headers)
r_xml = r.text
f = open(outfile,'w')
f.write(r_xml)
f.close()
KEGG Weblink:
根据参考链接格式批量生成即可。如果需要自定义颜色没客源写个脚本生成链接,类似上面的方法访问并下载页面。