使用pathview时遇到一个error,初始代码如下:
pathview(gene.data = df_gene_KO$KEGG_ko,
pathway.id = mapID,
species = "ko",
limit = list(gene=1, cpd=1),
out.suffix = "suffix")
部分pathway可以正常生成,如ko00970
但是部分pathway无法生成,报错,如
ko01230
仔细对比发现,这两幅图的区别在于:
ko00970
图中基因Kxxxxx是矩形方框,所以可以添加颜色;ko01230
中基因Kxxxxx是线条,无法添加颜色
解决办法:
不要将颜色添加在同一图层,修改参数same.layer = T
,代码如下:
pathview(gene.data = df_gene_KO$KEGG_ko,
pathway.id = mapID,
species = "ko",
limit = list(gene=1, cpd=1),
out.suffix = "suffix",
same.layer = T)
生成图形: