# Support for SummarizedExperiment assays

**URL:** <https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772>\
**Category:** Feature/Pull Request\
**Created:** [January 25, 2025, 6:39pm UTC](https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772 "2025-01-25T18:39:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antagomir](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/antagomir/32/2122_2.png) [@antagomir](https://forum.biobakery.org/u/antagomir)\
**Post date:** [January 25, 2025, 6:39pm UTC](https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772/1 "2025-01-25T18:39:55Z")

</div>

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](https://github.com/biobakery/maaslin3/blob/release/R/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.

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [January 30, 2025, 2:23pm UTC](https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772/2 "2025-01-30T14:23:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![antagomir](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/antagomir/32/2122_2.png) [@antagomir](https://forum.biobakery.org/u/antagomir)\
**Post date:** [January 30, 2025, 4:21pm UTC](https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772/3 "2025-01-30T16:21:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [January 31, 2025, 6:19pm UTC](https://forum.biobakery.org/t/support-for-summarizedexperiment-assays/7772/4 "2025-01-31T18:19:48Z")

</div>

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`.
