Setting stepwise reference


I am running Maaslin2 with Humann3 metgenomic output on some mouse feces. I would like to set up a two step reference when calculating the differential abundance levels on pathway abundance table. First, I want to identify the pathway shift regarding POST and PRE samples within each group. Then, I would like to set the control group as the reference to compare the differential abundance against the test group. Can I do that with maaslin?

I don’t think the stepwise process you’re outlining is possible, but you might be able to construct an interaction variable that’s close to what you want? Something like model.matrix(~status*time, data = d) where d is a data frame with factors status and time (whose reference levels are "CTRL" and "PRE" respectively). You’d then pass fixed_effects = c("statusCTRL", "timePRE", "statusCASE:timePRE") to Maaslin2.