path1输入你的第一个Excel
path2输入你的第二个Excel
DEG.dig <- function(path1,path2) {
require(xlsx)
require(tidyverse)
require(limma)
require(edgeR)
E<- read.xlsx (path1,sheetIndex = 1,header = 1) %>% column_to_rownames(var ="NA." )
type<- read.xlsx (path2,sheetIndex = 1,header = 1) %>% select(type)
type <- type$type
type <- factor(type,levels = c(0,1),labels = c("tumor","normal"))
design <- model.matrix(~0+type)
rownames(design) = colnames(E)
colnames(design) = c("normal","tumor")
dge <- DGEList(counts = E)
dge$E %>% dim
keep_gene <- rowSums(cpm(dge) > 1) >= 2
dge <- dge[keep_gene,,keep.lib.sizes=FALSE]
dge$E %>% dim
dge <- calcNormFactors( dge )
dge$sample
pdf(file = "MDS.pdf")
plotMDS(dge)
dev.off()
v <- voom(dge, design, plot = F, normalize = "quantile")
fit <- lmFit(v, design)
cont.matrix <- makeContrasts(tumorvsnormal=tumor-normal, levels = design)文章来源:https://www.toymoban.com/news/detail-639474.html
fit2 <- contrasts.fit(fit, cont.matrix)
fit2 <- eBayes(fit2)
nrDEG_limma_voom <- topTable(fit2, n = 100) %>% na.omit()
head(nrDEG_limma_voom)
write.csv(nrDEG_limma_voom,"结果.csv")
}文章来源地址https://www.toymoban.com/news/detail-639474.html
到了这里,关于差异性分析傻瓜版的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!