美文网首页生信软件单细胞分析转录组
找出cluster的差异基因并进行GO和KEGG分析

找出cluster的差异基因并进行GO和KEGG分析

作者: 阿糖胞苷_SYSU | 来源:发表于2019-05-13 23:02 被阅读71次

    单细胞测序数据经Seurat包tsne降维聚类后,得到cluster,如何找出cluster的marker并进行GO、KEGG分析

    需要R包:Seurat、clusterProfiler、ggplot2

    library(Seurat)

    library(dplyr)

    library(clusterProfiler)

    library(ggplot2)

    for( j in 0:12)

    {

    cluster.markers <- FindMarkers(object = RA.integrated, ident.1 =j, logfc.threshold = 0.25, test.use = "bimod", only.pos = TRUE)

    cluster<- row.names.data.frame(cluster.markers)

    cluster=bitr(cluster,fromType = "SYMBOL",toType = c("ENTREZID"),OrgDb = "org.Hs.eg.db")

    cluster.go<-enrichGO(gene=cluster[,"ENTREZID"],keyType = "ENTREZID",OrgDb=org.Hs.eg.db,ont = "ALL",pAdjustMethod = "BH",pvalueCutoff = 0.01,qvalueCutoff = 0.05,readable = TRUE)

    assign(paste0("cluster",j,".go"),cluster.go)

    pdf(file = paste0("cluster",j,"go.pdf"),,width=20,height=10)

    barplot(cluster.go,showCategory=50)

    dev.off()

    cluster.kegg<-enrichKEGG(gene = cluster[,"ENTREZID"],organism = 'hsa', pvalueCutoff = 0.05,pAdjustMethod = 'BH', minGSSize = 10,maxGSSize = 500,qvalueCutoff = 0.2,use_internal_data = FALSE)

    assign(paste0("cluster",j,".kegg"),cluster.kegg)

    pdf(file = paste0("cluster",j,"kegg.pdf"),,width=20,height=10)

    dotplot(cluster.kegg,showCategory=50)

    dev.off()

    write.csv(x=cluster.markers,file=paste0("cluster",j,".csv"))

    }

    相关文章

      网友评论

        本文标题:找出cluster的差异基因并进行GO和KEGG分析

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