Dear community,
I am trying to perform a differential abundance analysis on 16S data using DESeq2.
The metadata is as follow :
"Prelevement" : 2 types (P1, P2)
"Extraction" : 3 types (E1, E2, E3)
"NS" : Corresponds to donnor ID. Each donnor (10) had 6 samples, one for each case (P1 x E1, P1 x E2, P1 x E3, P2 x E1, P2 x E2, P2 x E3)
Thus design should be :
Extraction + Prelevement + Extraction:Prelevement + NS as blocking factor
design <- ~ NS + Extraction * Prelevement
I did read the ressources below with care : https://bioconductor.org/packages/release/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#interactions http://master.bioconductor.org/packages/release/workflows/vignettes/rnaseqGene/inst/doc/rnaseqGene.html ?results
But I am still unsure about how to extract specific contrasts from my dds. We want to retrieve differentially abundant taxa for :
# Prelevement effect :
P1 vs P2 for E1
P1 vs P2 for E2
P1 vs P2 for E3
# Extraction effect :
E1 vs E2 for P1
E1 vs E2 for P2
E1 vs E3 for P1
E1 vs E3 for P2
E2 vs E3 for P1
E2 vs E3 for P2
Ps : I did not set any reference level for my factors, given that there is no real "biologically relevant" reference here.
I am thus using R alphabetical order factors levels.
> levels(dds$Extraction)
[1] "E1" "E2" "E3"
# "E1" as reference level
> levels(dds$Prelevement)
[1] "P1" "P2"
# "P1" as reference level
Analysis was run with the following commands :
design <- ~ NS + Extraction * Prelevement
dds <- DESeqDataSetFromMatrix(countData = data, colData = meta, design = design)
sizeFactors(dds) <- res$GMPR
dds <- estimateDispersions(dds, fitType = "local")
dds <- nbinomWaldTest(dds, betaPrior = FALSE)
resultsNames(dds)
"Intercept"
" NSNS02vsNS01"
"NSNS03vsNS01"
"NSNS04vsNS01"
"NSNS05vsNS01"
"NSNS06vsNS01"
"NSNS07vsNS01"
"NSNS08vsNS01"
"NSNS09vsNS01"
"NSNS10vsNS01"
"ExtractionE2vsE1"
"ExtractionE3vsE1"
"PrelevementP2vsP1"
"ExtractionE2.PrelevementP2"
"ExtractionE3.PrelevementP2"
Below are attempts to extract specific contrasts, feedback is welcomed :
## Prelevement effect :
# [P1 vs P2 for E1] for Extraction reference level (E1)
results(dds, contrast = c("Prelevement", "P1", "P2"))
# [P1 vs P2 for E2] for Extraction "E2" (main effect *plus* the interaction term)
results(dds, list(c("Prelevement_P1_vs_P2", "ExtractionE2.PrelevementP2")))
# [P1 vs P2 for E3] for Extraction "E3" (main effect *plus* the interaction term)
results(dds, list(c("Prelevement_P1_vs_P2", "ExtractionE3.PrelevementP2")))
## Extraction effect :
# [E1 vs E2 for P1]
results(dds, contrast = c("Extraction", "E1", "E2"))
# [E1 vs E3 for P1]
results(dds, contrast = c("Extraction", "E1", "E3"))
# [E2 vs E3 for P1]
results(dds, contrast = c("Extraction", "E2", "E3"))
# [E1 vs E2 for P2]
results(dds, name="ExtractionE2.PrelevementP2")
# [E1 vs E3 for P2]
?
# [E2 vs E3 for P2]
results(dds, contrast=list("ExtractionE2.PrelevementP2", "ExtractionE3.PrelevementP2"))
Sorry if some of these questions are trivial or if I am not always using the right terminology,
Best regards
Thanks for your reply,
Using DESeq2 version 1.22.2
Notice that there is no more coefficients for interactions (with design ~ NS + group as compared to design ~ NS + Extraction * Prelevement)
Following your advice, I wrote these contrasts :
Does this seems right ? Best regards
Yes, aren’t those the group comparisons you wanted?