Support for SummarizedExperiment assays

Maaslin3 0.99.3

Thanks for adding SummarizedExperiment support for Maaslin3, and soon Bioconductor availability.

SummarizedExperiment supports multiple abundance tables (e.g. counts, relative abundances, log, clr etc) in the same data object. Usually one can choose the assay to use with e.g. assay(x, “relabundance”) where x is a SummarizedExperiment object. Many R/Bioc packages (e.g. scater, scuttle, mia, miaViz etc) directly support this by providing the argument assay.type.

I noticed that the maaslin3 function does not support assays. On line 833 of utility_scripts.R the code says SummarizedExperiment::assay(summarized_experiment). However, in practice this means that the code will just pick the first available assay, regardless of its name. It could be “counts”, “clr”, “log” or anything else, depending on how the data was created. There is no guarantee that the assay is what maaslin3 function expects (e.g. “counts”). For unexperienced users this may lead to problems that are difficult to trace.

I suggest to add support for assays in maaslin3. One could fix the line 833 in utility_scripts.R with SummarizedExperiment::assay(summarized_experiment, assay.type) and pass the assay.type through the maaslin3 main function.

We can also provide a PR if this helps.

Thanks for the suggestion! We’ve added a parameter assay_type (string or numeric index) which can be used to select an assay from the SummarizedExperiment object. By default, the first assay is still selected.

This should be available both on the biobakery GitHub and with BiocManager::install("biobakery/maaslin3").

Will

Awesome, thank!

One remark: other key packages use “assay.type”, rather than “assay_type”. If it would be possible to use the same argument name this could support methods development and interlinking / argument passing.

Or if Maaslin3 internal conventions require using underscore on argument names, perhaps you could consider providing alias “assay.type” for the argument “assay_type”. This could be hidden by default but would do the same trick.

We’ve used snake case throughout, but since the point of assay.type is for consistency with other packages, I’ve changed assay_type to assay.type.

1 Like