I have only single condition "Cancer" and where processed as three batches.
SampleID Condition Batch
Sample1 Cancer A1
Sample2 Cancer A1
Sample3 Cancer A1
Sample4 Cancer A1
Sample5 Cancer A1
Sample6 Cancer A1
Sample7 Cancer A1
Sample8 Cancer A2
Sample9 Cancer A2
Sample10 Cancer A2
Sample11 Cancer A2
Sample12 Cancer A2
Sample13 Cancer A2
Sample14 Cancer A2
Sample15 Cancer A3
Sample16 Cancer A3
Sample17 Cancer A3
Sample18 Cancer A3
Sample19 Cancer A3
Sample20 Cancer A3
Sample21 Cancer A3
followed following method to normalize and batch correction
#Read the count table data
cts <- read.table("raw_read_count.txt", header=TRUE, row.names=1)
#Sample information and barch details
coldata <- read.table("sample_info.txt", header=TRUE, row.names=1)
#Create a DESeq2 object named dds from the gene read count and sample information
dds <- DESeqDataSetFromMatrix(countData = cts,
colData = coldata,
design = ~ 1)
#assign the batch column
dds$batch <- factor(dds$Batch)
#estimate the library size correction and save the normalized counts matrix
dds <- estimateSizeFactors(dds)
norm.cts <- counts(dds, normalized=TRUE)
#perform regularized log transformation (blind false)
rld_f <- rlog(dds, blind=FALSE)
Next step is to do a batch correction. I followed the method given here as follows:
library(sva)
mm <- model.matrix(~ Condition, colData(dds))
mm0 <- model.matrix(~ 1, colData(dds))
norm.cts <- norm.cts[rowSums(norm.cts) > 0,]
fit <- svaseq(norm.cts, mod=mm, mod0=mm0, n.sv=2)
where it ask for mm
and mm0
; and mm
does not work for me as I have only single condition. How can I go ahead with this? What changes has to made in the above code ?