Hi, I want to find out genes which are up-regulated or down-regulated over a period of time from RNASeq data. We have samples collected at 24, 48, 72 hours post infection. We do not have control samples. The objective is to find genes significantly over time in response to infection. I have used Limma, and the code used is given below, I want to confirm whether I am going in the correct direction.
data=read.delim("count.txt",header = T,row.names = 1,check.names = FALSE)
head(data)
<- c(rep("Sample1", 3),
rep("Sample2", 3),
rep("Sample3", 3))
time.grp <- rep(c(24, 48, 72), 3)
groups <- as.factor(assay)
design <- model.matrix( ~0 + groups + time.grp)
fit <- lmFit(data, design)
cont.matrix <- makeContrasts(
time = "time.grp",
levels = design
)
fit.cont <- contrasts.fit(fit, cont.matrix)
efit.cont <- eBayes(fit.cont)
top_table <- topTable(efit.cont, adjust="fdr", n = Inf)
1 answer
Try:
colData <- data.frame(Samples = c(paste0("Sample1_rep", seq(1,3)),
paste0("Sample2_rep", seq(1,3)),
paste0("Sample3_rep", seq(1,3))),
time.grp. = rep(c("t24", "t48", "t72"), 3))
design <- model.matrix( ~0 + time.grp., data = colData)
## example contrasts:
makeContrasts(Contrast_72_vs_24 = (time.grp.t72 - time.grp.t24),
Contrast_72_vs_48 = (time.grp.t72 - time.grp.t48),
levels = design)
Replicate information is not explicitely part of the design formula. It is encoded in the time.grp information, so samples with the same factor are treated as replicates, in this case t24/48/72. Please check with the limma manual. The design is only time.grp. From there on you can make contrasts as you wish, e.g. as demonstrated above. Also try to avoid numeric group levels, better use characters as t24 instead of 24.
Log in to answer this question.