My RNA-seq experiment layout is like this:
d0_CD49fneg_CD34neg_1
d0_CD49fneg_CD34neg_2
d0_CD49fneg_CD34neg_3
d15_CD49fpos_CD34neg_1
d15_CD49fpos_CD34neg_2
d25_CD49fpos_CD34neg_1
d25_CD49fpos_CD34neg_2
d25_CD49fpos_CD34neg_3
d25_CD49fpos_CD34pos_1
d25_CD49fpos_CD34pos_2
d25_CD49fpos_CD34pos_3
I want to account for all variables when determining differentialy expressed genes with Deseq2. So I did this experimental design:
sampleNames <- c("BJ_1", "BJ_2", "BJ_3", "d15_CD49f+_1", "d15_CD49f+_2", "d25_CD49f+_1", "d25_CD49f+_2", "d25_CD49f+_3", "d25_CD49f+CD34+_1", "d25_CD49f+CD34+_2", "d25_CD49f+CD34+_3")
sampleFiles <- c("1A_ATCACG_counts", "2A_CAGATC_counts", "3A_ATCACG_counts", "2B_ACTTGA_counts", "3B_CGATGT_counts", "1C_TTAGGC_counts", "2C_GATCAG_counts", "3C_TTAGGC_counts", "1E_ACAGTG_counts", "2E_GGCTAC_counts", "3F_GCCAAT_counts")
Time <- factor(c(rep('d0',3), rep('d15',2),rep('d25',6)))
CD49 <- factor(c(rep('CD49fneg',3), rep('CD49fpos',8)))
CD34 <- factor(c(rep('CD34neg',8), rep('CD34pos',3)))
Table <- data.frame(sampleName = sampleNames, fileName = sampleFiles, time = Time, CD49 = CD49, CD34 = CD34)
Table
sampleName fileName time CD49 CD34
1 BJ_1 1A_ATCACG_counts d0 CD49fneg CD34neg
2 BJ_2 2A_CAGATC_counts d0 CD49fneg CD34neg
3 BJ_3 3A_ATCACG_counts d0 CD49fneg CD34neg
4 d15_CD49f+_1 2B_ACTTGA_counts d15 CD49fpos CD34neg
5 d15_CD49f+_2 3B_CGATGT_counts d15 CD49fpos CD34neg
6 d25_CD49f+_1 1C_TTAGGC_counts d25 CD49fpos CD34neg
7 d25_CD49f+_2 2C_GATCAG_counts d25 CD49fpos CD34neg
8 d25_CD49f+_3 3C_TTAGGC_counts d25 CD49fpos CD34neg
9 d25_CD49f+CD34+_1 1E_ACAGTG_counts d25 CD49fpos CD34pos
10 d25_CD49f+CD34+_2 2E_GGCTAC_counts d25 CD49fpos CD34pos
11 d25_CD49f+CD34+_3 3F_GCCAAT_counts d25 CD49fpos CD34pos
But when running this:
dds2 <- DESeqDataSetFromHTSeqCount(sampleTable = Table, design= ~ time + CD49 + CD34)
I got this error:
Error in checkFullRank(modelMatrix) :
the model matrix is not full rank, so the model cannot be fit as specified.
One or more variables or interaction terms in the design formula are linear
combinations of the others and must be removed.
Please read the vignette section 'Model matrix not full rank':
vignette('DESeq2')
From what I understood of vignette section, the error shows because CD49fneg vs CD49fpos is the 'same' as d0 vs d15 or d0 vs d25. So I 'merged' time and CD49f and repeated:
CellType <- factor(paste0(Time,CD49))
Table <- data.frame(sampleName = sampleNames, fileName = sampleFiles, CellType = CellType, CD34 = CD34)
Table
sampleName fileName CellType CD34
1 BJ_1 1A_ATCACG_counts d0CD49fneg CD34neg
2 BJ_2 2A_CAGATC_counts d0CD49fneg CD34neg
3 BJ_3 3A_ATCACG_counts d0CD49fneg CD34neg
4 d15_CD49f+_1 2B_ACTTGA_counts d15CD49fpos CD34neg
5 d15_CD49f+_2 3B_CGATGT_counts d15CD49fpos CD34neg
6 d25_CD49f+_1 1C_TTAGGC_counts d25CD49fpos CD34neg
7 d25_CD49f+_2 2C_GATCAG_counts d25CD49fpos CD34neg
8 d25_CD49f+_3 3C_TTAGGC_counts d25CD49fpos CD34neg
9 d25_CD49f+CD34+_1 1E_ACAGTG_counts d25CD49fpos CD34pos
10 d25_CD49f+CD34+_2 2E_GGCTAC_counts d25CD49fpos CD34pos
11 d25_CD49f+CD34+_3 3F_GCCAAT_counts d25CD49fpos CD34pos
dds2 <- DESeqDataSetFromHTSeqCount(sampleTable = Table, design= ~ CD34 + CellType)
What I want to know is:
1 - Is this experimental design correct?
2 - If I want fold-change for e.g. CD49fneg vs CD49fpos, including all samples of CD49fpos (those CD34neg and those CD34pos) how do I do?