Footsteps on my way !
perl/linux/测序分析

clusterProfile 的compareCluster GSEA分析结果默认按NES排序

一般默认是按cell ratio排序,并取前指定数目的条目,现改为按NES排序并取前指定数目的条目(此处记录便于以后查询):

#/share/workdir/yangl/work/10x_genomics_for_AGA/analysis-yangl/R_project/10x_aga5v2/03v0-DEG-GO-KEGG-GSEA.R
keggccGSEA<-compareCluster(geneClusters=compareList,fun = "GSEA",TERM2GENE = KEGG_nuohe, pvalueCutoff = 1)
keggccGSEA@compareClusterResult$Description<-str_to_title(sub(pattern = "[(]HSA.*",replacement = '',keggccGSEA@compareClusterResult$Description,perl=T)) #去掉(HSA...)
keggccGSEA<-setReadable(keggccGSEA,org.Hs.eg.db,keyType = 'ENTREZID')
keggccGSEA@compareClusterResult$absNES<-abs(keggccGSEA@compareClusterResult$NES) 
p<-dotplot(keggccGSEA,by = 'absNES',showCategory=30,color="pvalue",font.size=10,label_format = function(x) stringr::str_wrap(x, width=100),split=".sign")+ #by:设置默认按NES排序
facet_grid(.~.sign) #设置字幅宽度
p + aes(shape = p.adjust < 0.05) #+ scale_color_continuous(low='purple', high='green')
p
#save(keggccGSEA,file =paste('diff',"/",cluster,"/",'GSEA',"/",'keggccGSEA.Rdata',sep = ""))
ggsave(plot = p,filename = paste('diff',"/",cluster,"/",'GSEA',"/",'gseaKEGG.pdf',sep = ""),width = 10,height = 12)
write.xlsx(keggccGSEA,file =paste('diff',"/",cluster,"/",'GSEA',"/",'gseaKEGG.xlsx',sep = ""))

尊重他人劳动成果,转载请注明出处:Bluesky's blog » clusterProfile 的compareCluster GSEA分析结果默认按NES排序

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址