I am trying to use csaw, but I have not spent enough time on reading documentation as I am in little hurry. I would like to know how should I save the csaw results to a file. I could see the window number in etable
but I can't make out which window it is actually (chrom, pos etc). Here is my code: I also would like to know if I am making proper paired analysis and looking for treated
vs untreated
conditions.
bam.files <- c("1_high.bam","1_low.bam","2_high.bam","2_low.bam","3_high.bam","3_low.bam","4_high.bam","4_low.bam","5_high.bam","5_low.bam","6_high.bam","6_low.bam","7_high.bam","7_low.bam","8_high.bam","8_low.bam") require(csaw) require(edgeR) dedup.param <- readParam(minq=10, dedup=TRUE) data <- windowCounts(bam.files, ext=300, width=200, param=dedup.param) treat <- c("treated","untreated","treated","untreated","treated","untreated","treated","untreated","treated","untreated","treated","untreated","treated","untreated","treated","untreated") subjects <- factor(c(rep( (1:8), each=2))) design <- model.matrix(~subjects+treat) keep <- abundances > aveLogCPM(5, lib.size=mean(data$totals)) data <- data[keep,] binned <- windowCounts(bam.files, bin=TRUE, width=10000, param=dedup.param) normfacs <- normOffsets(binned) y <- asDGEList(data, norm.factors=normfacs) y <- estimateGLMCommonDisp(y, design, verbose=TRUE) y <- estimateGLMTrendedDisp(y, design) y <- estimateGLMTagwiseDisp(y, design) fit <- glmFit(y, design) lrt <- glmLRT(fit) etable <- topTags(lrt, n=nrow(y))$table etable <- etable[order(etable$FDR), ] #Write the results to a file write.table(etable,file="abaundance_DE_edgeR.csv")
There's a saying I learned from my father: "I'm taking my time because I'm in a rush"
You're fooling yourself into thinking that you're actually saving time here. Do yourself a favor and invest the time now into reading and understanding the resources made available to you. You will move a lot quicker, make fewer mistakes, and (importantly) present with confidence the results you're generating, which you are likely asking others to invest the time into reading about / listening to.