I am using the Deseq2 package to perform a DE analysis on multiple factors.
So, basically to perform the analysis I consider patients characterized by the Brugada Syndrome type 1 and other patients that instead are controls.
In order to have equal numbers of PZ and CTRs I included in my analysis all the PZ of type 1, that in this case are 8 samples, and I selected 8 random CTRs among the full dataset the CTRs that I have for this batch (in total are 40).
To select the random CTRs I used the sample_n function:
random_CTR_samples_IGATECH<-sample_n(samples_IGATECH_ALL_CTR,8)
Anyway I created the design matrix that looks like this including also the Age variable as well as the Gender one since I want to test also the effect of those in my data, (NON_INDUCIBLE)= CTR:
Sample BrS_BASELINE_PATTERN Gender Age
1 DG1340 1 M 44
2 DG1383 1 F 35
3 DG1453 1 F 55
4 DG1455 1 F 53
5 DG1473 1 M 33
6 DG1557 1 M 45
7 DG1578 1 F 57
8 DG1590 1 M 42
9 DG1380 NON_INDUCIBILE M 20
10 DG1381 NON_INDUCIBILE F 52
11 DG1382 NON_INDUCIBILE M 49
12 DG1565 NON_INDUCIBILE M 30
13 DG1594 NON_INDUCIBILE F 42
14 DG1620 NON_INDUCIBILE M 40
15 DG1633 NON_INDUCIBILE F 62
16 DG1652 NON_INDUCIBILE M 21
and I filtered the Count matrix for the samples present in the design one. So I have
head(Counts_IGATECH_ALL_1_random_CTR)
DG1340 DG1383 DG1453 DG1455 DG1473 DG1557 DG1578 DG1590 DG1380 DG1381 DG1382 DG1565 DG1594 DG1620 DG1633 DG1652
ENSG00000114771 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ENSG00000129673 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 0
ENSG00000144452 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ENSG00000143921 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ENSG00000173357 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ENSG00000161103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
When I run the DESeqDataSetFromMatrix
function I get this error:
converting counts to integer mode
factor levels were dropped which had no samples
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')
and the function i ran is:
dds_IGATECH_1_random_CTR<- DESeqDataSetFromMatrix(countData = round(Counts_IGATECH_ALL_1_random_CTR),
colData = design_IGATECH_1_random_CTR,
design = ~ Age + Gender + BrS_BASELINE_PATTERN)
I revised my design matrix multiple times and tried to change also the combinations of the CTRs to have a different one and see if that would solve the problem but it didn't work, and I cannot figure out what it can be.
Thank you in advance for any suggestion.
Update
Design matrix:
dput(design_IGATECH_1_random_CTR)
structure(list(Sample = c("DG1340", "DG1383", "DG1453", "DG1455",
"DG1473", "DG1557", "DG1578", "DG1590", "DG1376", "DG1379", "DG1573",
"DG1575", "DG1579", "DG1598", "DG1627", "DG1633"), BrS_BASELINE_PATTERN = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), levels = c("1",
"2", "NON_INDUCIBILE"), class = "factor"), Gender = structure(c(2L,
1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L), levels = c("F",
"M"), class = "factor"), Age = structure(c(23L, 15L, 32L, 31L,
13L, 24L, 34L, 21L, 29L, 27L, 30L, 10L, 19L, 28L, 18L, 37L), levels = c("17",
"20", "21", "22", "23", "24", "25", "26", "28", "29", "30", "32",
"33", "34", "35", "37", "38", "39", "40", "41", "42", "43", "44",
"45", "46", "48", "49", "50", "51", "52", "53", "55", "56", "57",
"58", "61", "62", "63", "64", "69"), class = "factor")), row.names = c(NA,
-16L), class = "data.frame")
The NON_INDUCIBLE data are different since i have generated a new design matrix again, but the format is the same