美文网首页
kegg在线链接图的颜色设置 2021-07-08

kegg在线链接图的颜色设置 2021-07-08

作者: python明 | 来源:发表于2021-07-08 11:27 被阅读0次

    转载,留待以后学习。
    这是生信菜鸟团成员的帖子,发现可以自动注释,真是大好,作为生信初学者,无疑是利器,还可以有代码可改!
    只剩赞了!
    原文链接放在最后,尊重作者原创!
    一般来说, 有了kegg的ID,就可以直接去官网查看具体的通路图片,但是需要把差异基因给标注上去,就有点麻烦了,我以前做过类似的工作,结果没有做笔记,这次相当于重新造了个轮子,好惨!

    简单的KEGG图片,看下面的url:

    http://www.genome.jp/kegg-bin/show_pathway?hsa03040

    http://www.genome.jp/kegg-bin/show_pathway?hsa05168

    可以看出来只需要变化KEGG的ID即可。

    如果要做下面的这个,上调基因用红色表示,下调基因用绿色表示:

    [图片上传失败...(image-757c09-1625714459160)]

    clipboard

    需要重新理解kegg的API规则,比如:http://www.kegg.jp/kegg/docs/weblink.html

    我就造出了下面的links:

    http://www.genome.jp/kegg-bin/show_pathway?map=hsa04115&multi_query=CDKN1A+red%2Cblue%0DSESN3+red%2Cblue%0DIGFBP3+blue%2Cred%0DFAS+red%2Cblue%0DCD82+red%2Cblue%0DGADD45B+blue%2Cred%0DSERPINB5+red%2Cblue%0DZMAT3+blue%2Cred%0DCCNB3+red%2Cblue%0D

    http://www.genome.jp/kegg-bin/show_pathway?map=hsa04151&multi_query=CDKN1A+red%2Cblue%0DLAMC3+red%2Cblue%0DCOL1A2+blue%2Cred%0DCREB1+blue%2Cred%0DEGF+red%2Cblue%0DFGFR3+blue%2Cred%0DGHR+red%2Cblue%0DGNG11+red%2Cblue%0DITGA2+red%2Cblue%0DITGA3+red%2Cblue%0DITGAV+red%2Cblue%0DLAMB3+red%2Cblue%0DMYC+blue%2Cred%0DPCK2+blue%2Cred%0DPPP2R5C+blue%2Cred%0DLPAR5+blue%2Cred%0DGNB4+blue%2Cred%0DSGK1+blue%2Cred%0DCREB3L2+blue%2Cred%0DTEK+red%2Cblue%0DTHBS2+blue%2Cred%0DPDGFD+blue%2Cred%0DOSMR+red%2Cblue%0D

    当然,肯定不是手动的啦!!!

    代码很简单

    this_keggID 就是 04115 等等的KEGG的ID,数字格式的哦!

    this_kegg_has_geneID <- kegg2GeneID_list[[this_keggID]] ## 拿到这个KEGG的所有基因

    this_kegg_has_geneSymbol <- unique(geneAnno(this_kegg_has_geneID)$symbol) ## 把基因的entrez ID转换为gene 的symbol ,其中geneAnno是我自定义的!

    跟我们的显著上下调基因取交集,其中diff_gene_list是以symbol为标记的

    this_kegg_has_geneSymbol_diff <- intersect(this_kegg_has_geneSymbol,diff_gene_list)

    UP GENE: DHX8+red%2Cblue%0D ##自己定义调色规则

    DOWN GENE:DHX8+blue%2Cred%0D

    color = ifelse(vcx15_DEG[this_kegg_has_geneSymbol_diff,]$logFC >0 ,'red%2Cblue%0D','blue%2Cred%0D')

    根据交集的基因来拼接调色字符串咯

    kegg_suffix <- paste0(paste(this_kegg_has_geneSymbol_diff,color,sep='+'),collapse = '')

    再把link给拼起来。

    href=paste0("http://www.genome.jp/kegg-bin/show_pathway?map=hsa",

    this_keggID,"&multi_query=", kegg_suffix)

    整个过程做成一个循环就好啦!!

    我开发的R包有集成这个功能:https://github.com/jmzeng1314/humanid

    https://github.com/jmzeng1314/humanid/blob/master/R/add_kegg_up_down_link.R
    http://www.bio-info-trainee.com/2061.html

    相关文章

      网友评论

          本文标题:kegg在线链接图的颜色设置 2021-07-08

          本文链接:https://www.haomeiwen.com/subject/ofozultx.html