params < - list(cache = false)## ----设置,include = false -------------------------------------------------------------------------------------------------------------------------------------- knitr::opts_chunk$set(fig.width=7, fig.height=6) ## ----load,message=FALSE, warning=FALSE--------------------------------------- library(topconfects)Library(NBPSEQ)库(EDGER)库(Limma)库(dplyr)库(ggplot2)数据(阿拉伯)#检索每个基因信息<-AnnotationDbi :: select(org.at.tair.db :: org.at.at of andotationdbi :: org.at.at。info [match(rownames(阿拉伯),info $ tair),]%>%>%select(-tair)%>%as.data.frame rownames(arab_info)<-Rownames(Arab)##从样本名称Treat treat treat frolsimal设计<- 因子(substring(colnames(阿拉伯),1,4))%>%relevel(ref =“模拟”)时间< - 因子(subnames(colnames(Arab),5,5))y < - dgelist(阿拉伯人,阿拉伯人,genes = as.data.frame(arab_info))#保持基因至少3个样品,其rpm超过2个keep <-rowsums(cpm(y)> 2)> = 3 y %lmfit(设计)## --------------------------------------------------------------------------------------------------------------------------------- confects <- limma_confects(fit,coef =“ treathrcc”,fdr = 0.05)---------------------------------- confects_plot(confects) ## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- fit_eb <-ebayes(fit)顶部<-toptable(fit_eb,coef =“ treathrcc”,n = inf)rank_rank_plot(confects $ table $ name,rownames(top),“ limma_confects”,“ toptable”,“ toptable”)## ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ plotmd(fit,legend =“ bottomleft”,status = paste0(ifelse(rownames(fit)%rownames中的%%)(top)[top)[1:40],”,”最佳Table ",""), ifelse(rownames(fit) %in% confects$table$name[1:40], "confects ",""))) ## ----edger-------------------------------------------------------------------- y <- estimateDisp(y, design, robust=TRUE) efit <- glmQLFit(y, design, robust=TRUE) ## ----edger_confects----------------------------------------------------------- econfects <- edger_confects(efit, coef="Treathrcc", fdr=0.05, step=0.05) econfects ## ----fig.height=7------------------------------------------------------------- confects_plot(econfects) confects_plot_me(econfects) ## ----------------------------------------------------------------------------- etop <- glmQLFTest(efit, coef="Treathrcc") %>% topTags(n=Inf) plotMD(efit, legend="bottomleft", status=paste0( ifelse(rownames(efit) %in% econfects$table$name[1:40], "confects ", ""), ifelse(rownames(efit) %in% rownames(etop)[1:40], "topTags ",""))) ## ----message=F, warning=F----------------------------------------------------- library(DESeq2) dds <- DESeqDataSetFromMatrix( countData = arab, colData = data.frame(Time, Treat), rowData = arab_info, design = ~Time+Treat) dds <- DESeq(dds) ## ----------------------------------------------------------------------------- dconfects <- deseq2_confects(dds, name="Treat_hrcc_vs_mock", step=0.05) ## ----------------------------------------------------------------------------- shrunk <- lfcShrink(dds, coef="Treat_hrcc_vs_mock", type="ashr") dconfects$table$shrunk <- shrunk$log2FoldChange[dconfects$table$index] dconfects ## ----------------------------------------------------------------------------- table(dconfects$table$filtered) tail(dconfects$table) ## ----fig.height=7------------------------------------------------------------- confects_plot(dconfects) + geom_point(aes(x=shrunk, size=baseMean, color="lfcShrink"), alpha=0.75) ## ----------------------------------------------------------------------------- filter(dconfects$table, !filtered) %>% ggplot(aes( x=ifelse(is.na(confect),0,confect), y=shrunk, color=!is.na(confect))) + geom_point() + geom_abline() + coord_fixed() + theme_bw() + labs(color="Significantly\nnon-zero at\nFDR 0.05", x="confect", y="lfcShrink using ashr") ## ----fig.height=7------------------------------------------------------------- rank_rank_plot(confects$table$name, econfects$table$name, "limma confects", "edgeR confects") rank_rank_plot(confects$table$name, dconfects$table$name, "limma confects", "DESeq2 confects") rank_rank_plot(econfects$table$name, dconfects$table$name, "edgeR confects", "DESeq2 confects") ## ----------------------------------------------------------------------------- sessionInfo()