参考1
参考2
我试了其中一个方法:
suppressMessages(library(NOISeq))
NOISeq_analysis<-function(mycounts,factors,out_dir,prefix){
mydata <- readData(data = mycounts, factors = factors)
mycountsbio = dat(mydata, factor = NULL, type = "countsbio")
mysaturation = dat(mydata, k = 0, ndepth = 7, type = "saturation")
pdf(file = paste0(out_dir,prefix,"_exp_plot.pdf"),width = 6,height = 5)
explo.plot(mysaturation, toplot = 1, samples = 1:2, yleftlim = NULL, yrightlim = NULL)
dev.off()
pdf(file = paste0(out_dir,prefix,"_exp_bar_plot.pdf"),width = 6,height = 12)
explot_barplot<-explo.plot(mycountsbio, toplot = 1, samples = NULL, plottype = "barplot")
dev.off()
mycd = dat(mydata, type = "cd", norm = FALSE, refColumn = 1)
myresults <- noiseq(mydata, factor = "Group",conditions =as.character(factors[,1]), k = NULL, norm = "n", pnr = 0.2,nss = 5, v = 0.02, lc = 1, replicates = "no")
head(myresults@results[[1]])
mynoiseq.deg = degenes(myresults, q = 0.95, M = NULL)
mynoiseq.deg_up = degenes(myresults, q = 0.95, M = "up")
mynoiseq.deg_down = degenes(myresults, q = 0.95, M = "down")
write.csv(mynoiseq.deg,paste0(out_dir,prefix,"_exp_DEGs_total.csv"))
write.csv(mynoiseq.deg_up,paste0(out_dir,prefix,"_exp_DEGs_upregulation.csv"))
write.csv(mynoiseq.deg_down,paste0(out_dir,prefix,"_exp_DEGs_downregulation.csv"))
pdf(file = paste0(out_dir,prefix,"_exp_DEGs_dot_plot.pdf"),width = 5,height = 5)
DE.plot(myresults, q = 0.95, graphic = "expr", log.scale = TRUE)
dev.off()
}
#counts should be raw counts
#factors should be the group information with the sample id as the row names
NOISeq_analysis(mycounts=ip_count,factors = factors,out_dir = out_dir,prefix = "IP")
NOISeq_analysis(mycounts=ex_count,factors = factors,out_dir = out_dir,prefix = "OE")
网友评论