Good afternoon,
I am analyzing RNA-Seq data generated from an experiment to test the effects of salinity (15ppt, 35ppt, 60ppt) on different populations (BR and SD). My code for reporting the genes differentially expressed in each contrast is working well but I am wondering if topTable can report the list of genes that occur in the intersection of the two circles in the Venn diagram. My code is below. Thank you in advance for any advice.
source("http://bioconductor.org/biocLite.R") biocLite("edgeR") library("edgeR") biocLite("limma") biocLite("statmod") x <- read.delim("~mapped2SA.matrix", header=TRUE, row.names="Symbols") z <-x[ ,c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)] keep <- rowSums(cpm(z)>1) >=3 z<- z[keep,] dge <- DGEList(counts=z) dgeN <-calcNormFactors(dge) targets=read.delim("~targets.txt", header=TRUE) attach(targets) pop.sal <-paste(targets$pop, targets$sal, sep=".") pop.sal <-factor(pop.sal, level=c("br.15", "br.35", "br.60", "sd.15", "sd.35", "sd.60")) design <-model.matrix(~0+pop.sal) colnames(design) <- levels(pop.sal) v <- voom(dgeN,design,plot=TRUE) fit <- lmFit(v, design) cont.matrix <- makeContrasts(br.low=br.15-br.35, sd.low=sd.15-sd.35, levels=design) fit2 <- contrasts.fit(fit, cont.matrix1) fit2 <- eBayes(fit2) results <- decideTests(fit2) vennDiagram(results) BRlow <- topTable(fit2, 1, adjust.method="BH", number=30000, p.value=0.05, sort.by="p") write.csv(BRlow, file="BR_SA.csv") SDlow <- topTable(fit2, 2, adjust.method="BH", number=30000, p.value=0.05, sort.by="p") write.csv(SDlow, file="SDlow_SA.csv")
Set
n=Inf
if you want to get all genes fromtopTable
. It's less typing and it's more obvious to the reader.