Description
Dear Zachary and members of the Grunwald lab,
first of all: Thank you very, very much for the metacoder heat tree package! These heat trees open up so many possibilities!
I have a question regarding the differential abundance analysis using the calc_diff_abund_deseq2 function. I am trying to perform differential abundance analysis and display the results as a heat tree, and that seems to work fine if I use a factor with two levels in the function (groups = metadata$treatment; treatment having two levels). However, my experimental design is a little more complex than that. My experimental design is a split-plot experiment (nested design, every plot was split into the 2 treatments; pseudo-replication!), so I would like to remove the "plot" effect first. In DESeq2 there is the option to specify the "design" to account for exactly that problem:
deseq2Data <- DESeqDataSetFromMatrix(countData=cerco_taxmap$data$tax_counts[-1], colData=metadata, design= ~ plotcode + treatment)
Is there a possibility to do this using calc_diff_abund_deseq2 as well?
Furthermore, on plot level, I have a plant diversity gradient that I would like to test as a linear variable (log-transformed, but that is not important at this point). In other words, I want to know which OTUs/ASVs are more abundant at low (or high, respectively) plant species richness. Again, DESeq2 offers a parameter for this in the "results" function: While "contrast" is used for factors, "name" can be used for continuous variables, e.g.:
deseq2Results <- results(diff_abundant_OTUs, name="log_sowndiv", alpha = 0.05)
But the calc_diff_abund_deseq2 function only accepts factors. The Error message (group is not a factor, see ?results) also refers to the results function of DESeq2. I think the issue is that DESeq2 itself uses the abovementioned two different parameters ("group" or "name") for different variable types, but calc_diff_abund_deseq2 only accepts factors. Or am I overlooking an additional parameter?
I am aware that this function is still in development, so this may not be implemented yet. But can you think of a "workaround" to still get this to work? I am sadly not too familiar with either DESeq2 nor metacoder, so I struggle a lot with that.
And if it is already implemented and I am just overlooking it, then I am very sorry for the inconvenience! But maybe this helps improve the function!
Thanks in advance, and greetings from Germany!
Marcel