The bioBakery help forum

Accounting for ordered categorical metadata in formula

Hi

Thanks for this great tool! I have been successfully running Maaslin2 without issues.

I was wondering however if there is a way to account for ordered metadata in the model?

If I have ordered categorical metadata (for example weeks) is there a way to take that into account in the formula in Maaslin2? I have ordered the data in the metadata file and set a reference (first week) but it appears that it compares each week to the first (reference) week only, what I want to do is compare each week to the next week which in my scenario makes more biological sense then comparing to the reference (first) week.
For example is it possible to do forward or backward difference coding where the variable for a level is compared with the variable of the next or prior level.

Thanks in advance.

Hi @kadunn - this will not be possible with MaAsLin 2’s default workflow as we do not come across this dummy coding requirement too often. In this case, you may want to write your own wrapper (some examples here: GitHub - biobakery/maaslin2_benchmark: Large-scale Benchmarking of Microbial Multivariable Association Methods) and use the functionalities of contrast coding to achieve this goal. Note that, these wrappers are pretty basic and they do not have the same functionalities as MaAsLin 2 (e.g. preprocessing and visualization are not implemented) but it’s possibly your best bet given that you have a specific contrast of interest. I hope it helps.

Thanks I will give that a try!!