利用eggnog做go富集

###go富集
對(duì)populus_simonii_genome_data.emapper.annotations處理
vi chang_go1.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os
x = sys.argv[1]
file = open(x, "r")
lines = file.readlines()
for line in lines:
    line=line.strip()
    if line.startswith("#"):
        continue
    else:
        tmp=line.split("\t")
        if tmp[12] == "-":
            continue
        else:
            if(tmp[12].find(',')):
                tmp2=tmp[12].split(',')
                for i in range(0,len(tmp2)):
                    print(tmp[0]+"\t"+tmp2[i])
            else:
                print(tmp[0]+"\t"+tmp[12])
python chang_go1.py populus_simonii_genome_data.emapper.annotations >go.all
然后用R語(yǔ)言畫圖

library(clusterProfiler)
go_anno <- read.delim("go.all", header=FALSE, stringsAsFactors =FALSE)
names(go_anno) <- c('gene_id','ID')

go_class <- read.delim('go_term.txt', header=FALSE, stringsAsFactors =FALSE)
names(go_class) <- c('ID','Description','Ontology')
go_anno <-merge(go_anno, go_class, by = 'ID', all.x = TRUE)

gene_list <- read.delim("genego.list",header=FALSE,stringsAsFactors = FALSE)
names(gene_list) <- c('gene_id')
gene_select <- gene_list$gene_id

go_rich <- enricher(gene = gene_select,
                    TERM2GENE = go_anno[c('ID','gene_id')],
                    TERM2NAME = go_anno[c('ID','Description')],
                    pvalueCutoff = 0.05,
                    qvalueCutoff = 0.1,
                    pAdjustMethod = 'BH',
                    maxGSSize = 200)
df<-as.data.frame(go_rich)
pdf(file="enrichment.pdf",width=9,height=5)
dotplot(go_rich)
dev.off()
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容