microbiome / mia

Microbiome analysis
https://microbiome.github.io/mia/
Artistic License 2.0
47 stars 28 forks source link

altExp support for meltAssay #343

Closed antagomir closed 2 months ago

antagomir commented 1 year ago

It is not possible to choose altExp for meltAssay currently.

One can however call meltAssay(altExp(tse, ...)) to do this for any altExp. Perhaps this is enough and there is no need to complicate the function?

An example could be added on the manpage, however as there have been questions about it.

antagomir commented 1 year ago

altExp mechanism seems to work routinely also in transformCounts even though it is not defined in that function (i.e. it just works because the function implementation knows how to pass this argument further and make the selection; see transformCounts source code for an example).

library(mia)
data(GlobalPatterns)
tse <- GlobalPatterns
altExps(tse) <- splitByRanks(tse)
transformCounts(tse, assay.type="counts", method="relabundance", altexp="Genus")

For consistency let us make sure it works this way also for meltAssay.

Importantly, it should be (?) possible to add this implicitly by doing similar programming than in transformCounts, instead of explicitly declaring altexp as a function argument. Inspect the transformCounts source code on how to do this.

antagomir commented 1 year ago

@ake123 I suggest you try, ask @TuomasBorman if you bump into problems.

ake123 commented 2 months ago

This is solved!