Differential abundance analysis and cage/pen effect

I am currently using deseq2 for differential abundance analysis. Consider a control-treatment type study where animals are housed in cages/pens and all animals in a given pen receive the same treatment. The only way to account for this using deseq2 is to calculate a median for each OTU and then use cage as the experimental unit. This works but some power is lost. How is this type of analysis handled with gneiss or ancom ?

Best regards,


Welcome @peterbjarke!

In q2-gneiss you could incorporate cage/pen effect into your formula with something like --p-formula 'main-effect + cage'.

The ANCOM version currently implemented in q2-composition does not support multivariate formulae, but the R version does.

Many thanks for the quick answer! In the solution suggested cage is a fixed effect as understand it. Is this correct ? I would like to us cage as a random effect.

Br Peter

Correct. I do not actually see a way to set random effects with qiime gneiss lme-regression. @mortonjt could you please enlighten us?

You can do this by specifying the cage id in --p-groups. That’ll allow for the cages to be treated as a random effect

Hi Jamie,

I found that ANCOM2 was used for the benchmarks while I was reading your differential ranking paper. Do you know if ANCOM2 can be used for differential abundance testing that accounts for nested random effects such as the cages/pens effects? I read the ANCOM2 documentation and tried to contact the authors but got no answers. Could you comment on this?

Hi @yanxianl, sorry I can’t comment on that. Theoretically it would be possible, but I’d be worried about interpretation. Should be able to do this in aldex2 and definitely songbird

1 Like

Thanks for the quick reply! I was actually reading the documentation of the songbird that implements the differential ranking method. Great that the support for nested random effects is much more straightforward in the songbird. Looking forward to its release in the QIIME2 library.


In case it wasn’t clear - songbird assumes fixed effects for everything (since it is just multinomial regression). You can have a fixed effects covariate for cage effect for starters - but it won’t do random effects (yet).

Many thanks! Can you help with with the syntax for specifying more than one group ?

Best regards,

Have you seen the cystic fibrosis tutorial? https://biocore.github.io/gneiss/docs/v0.4.0/tutorials/qiime2/cfstudy-qiime2-tutorial.html

If not, maybe that can help with the syntax

1 Like