Dear community,
I am using an "external" normalization method (not available in DESeq2) to obtain size factors for each sample in my dataset.
Obtained size factors :
sfGMPR
sfGMPR
V10T0 : 0.8564351
V10T14 : 0.9745389
V11T0 : 1.2577104
V11T14 : 1.1482669
...
sfGMPR$sfGMPR
[[1]] 0.8564351 0.9745389 1.2577104 1.1482669 ...
Then, I tried to apply the obtained size factors on my data using 2 approaches :
Ps)
raw dataset :
t(tail(dataset, 1))
taxa_x
V10T0 : 0
V10T14 : 0
V11T0 : 30
V11T14 : 105
...
dds dataset :
t(tail(counts(dds, normalized = FALSE), 1))
taxa_x
V10T0 : 0
V10T14 : 0
V11T0 : 30
V11T14 : 105
...
1) Using "raw R"
dataset_norm <- dataset / sfGMPR$sfGMPR
t(tail(dataset_norm , 1))
taxa_x
V10T0 : 0.0000000
V10T14 : 0.0000000
V11T0 : 13.7131949
V11T14 : 47.9961821
...
2) Using a DESeq2 dds object (setting my own size factors with "sizeFactors")
dds <- DESeqDataSetFromMatrix(countData = dataset, colData = metadata, design = design)
sizeFactors(dds) = c(sfGMPR$sfGMPR)
t(tail(counts(dds, normalized = TRUE), 1))
taxa_x
V10T0 : 0.0000000
V10T14 : 0.0000000
V11T0 : 23.8528673
V11T14 : 91.4421565
...
I was expecting the same results, but it's not the case.
From what I read in the manual, regarding the counts slot of a dds :
normalized : logical indicating whether or not to divide the counts by the size factors or normalization factors before returning (normalization factors always preempt size factors)
In the dds, counts should be divided by size factors according to this, unless normalization factors preempt size factors. Thus I checked for normalization factors :
normalizationFactors(dds.phylum)
NULL
Can you please explain what I missed ?
Best regards
packageVersion("DESeq2")
[1] ‘1.22.2