After going through the manual I couldn't proceed with collapse replicates
sampleFiles <- list.files(path = "./", pattern = ".counts")
sampleNames <- gsub(".counts", "", sampleFiles)
sampleCondition <- c(rep("KO1", 4),rep("KO2", 4),rep("KO3", 4), rep("WT1", 4),rep("WT2", 4),rep("WT3", 4))
sampleTable <- data.frame(sampleName = sampleNames, fileName = sampleFiles, condition = sampleCondition)
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,
directory = directory,
design = ~ condition)
treatments <- c("KO1", "KO2", "KO3", "WT1", "WT2", "WT3")
library("DESeq2")
ddsHTSeq <- DESeqDataSetFromHTSeqCount(sampleTable = sampleTable,design = ~ condition)
colData(ddsHTSeq)$condition <- factor(colData(ddsHTSeq)$condition,
levels = treatments)
#Analysis using DESeq
dds <- DESeq(ddsHTSeq)
resultsNames(dds)
#Pre-filtering
dds <- dds[ rowSums(counts(dds)) > 1, ]
res <- results(dds)
#summarise some basic tallies
summary(res)
This was the example from collapseReplicates, I am not sure where should I apply this step and how should I proceed with my dataset
dds <- makeExampleDESeqDataSet(m=12)
# make data with two technical replicates for three samples
dds$sample <- factor(sample(paste0("sample",rep(1:9, c(2,1,1,2,1,1,2,1,1)))))
dds$run <- paste0("run",1:12)
ddsColl <- collapseReplicates(dds, dds$sample, dds$run)
# examine the colData and column names of the collapsed data
colData(ddsColl)
colnames(ddsColl)
# check that the sum of the counts for "sample1" is the same
# as the counts in the "sample1" column in ddsColl
matchFirstLevel <- dds$sample == levels(dds$sample)[1]
stopifnot(all(rowSums(counts(dds[,matchFirstLevel])) == counts(ddsColl[,1])))
Your code is a bit confusing because you call
DESeqDataSetFromHTSeqCount
twice with different parameters. Can you clean this up and post the output ofcolData(ddsHTSeq)
?Please correct me if I am wrong in any point, if I need to make any changes
The output of colData(ddsHTSeq)