I have two set data, 4 samples with 2 replicates for each one from batch 1 and another 4 samples with 2 replicates from batch 2.
I would like to remove batch effects from these samples and compare different methods together. I have done below commands but face with error:
design
samples method batch
L4_rep1 L4 L b1
L4_rep2 L4 L b1
L6_L8_rep1 L6_L8 L b1
L6_L8_rep2 L6_L8 L b1
Q5_Q7_rep1 Q5_Q7 Q b1
Q5_Q7_rep2 Q5_Q7 Q b1
Q3_rep1 Q3 Q b1
Q3_rep2 Q3 Q b1
co_40d_A co_40d co_40d b2
co_40d_B co_40d co_40d b2
co_60d_A co_60d co_60d b2
co_60d_B co_60d co_60d b2
EB_A EB EB b2
EB_B EB EB b2
H9_A H9 H9 b2
H9_B H9 H9 b2
design$=samples <- factor(design$=samples, levels = c("L4","L6_L8", "Q3", "Q5_Q7","co_40d","co_60d", "EB", "H9"))
design$method <- factor(design$method, levels = c("L", "Q", "co_40d","co_60d", "EB", "H9"))
design$batch <- factor(design$batch, levels = c("b1", "b2"))
design.matrix <- model.matrix(~0+batch+method,design)
design.matrix
batchb1 batchb2 methodQ methodco_40d methodco_60d methodEB methodH9
L4_rep1 1 0 0 0 0 0 0
L4_rep2 1 0 0 0 0 0 0
L6_L8_rep1 1 0 0 0 0 0 0
L6_L8_rep2 1 0 0 0 0 0 0
Q5_Q7_rep1 1 0 1 0 0 0 0
Q5_Q7_rep2 1 0 1 0 0 0 0
Q3_rep1 1 0 1 0 0 0 0
Q3_rep2 1 0 1 0 0 0 0
co_40d_A 0 1 0 1 0 0 0
co_40d_B 0 1 0 1 0 0 0
co_60d_A 0 1 0 0 1 0 0
co_60d_B 0 1 0 0 1 0 0
EB_A 0 1 0 0 0 1 0
EB_B 0 1 0 0 0 1 0
H9_A 0 1 0 0 0 0 1
H9_B 0 1 0 0 0 0 1
library(edgeR)
data_filter<- count table
edgeR.dgelist = DGEList(data_filter)
edgeR.dgelist_normal = calcNormFactors(edgeR.dgelist)
CommonDisp <- estimateGLMCommonDisp(edgeR.dgelist_normal, design.matrix)
Error in glmFit.default(y, design = design, dispersion = dispersion, offset = offset, : Design matrix not of full rank. The following coefficients not estimable: methodH9
I like to know whether my design matrix is correct? Also, I like to compare Q method against other methods, would you please help me in making contrast?
@mon, Thanks for your reply. yes i removed the sample column but still have error. Thanks a lot for your links.
I checked, because I was certain I'd already answered a question by @star directly related to this. Here it is