Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch transformations. #429

Open
antagomir opened this issue Aug 26, 2023 · 9 comments
Open

Batch transformations. #429

antagomir opened this issue Aug 26, 2023 · 9 comments

Comments

@antagomir
Copy link
Member

Create Function to add given transformation to all altExps / ranks at once, or at least provide an example in OMA/mia.

This is handy also since methods like agglomerateFeaturesByRank or splitByRank will only deal with count and relabundance assays, and ignore the rest (like CLR, which does translate directly in such operations). Hence there is often a need to add transformations in batch for all altExps after such operations.

@TuomasBorman
Copy link
Contributor

TuomasBorman commented Oct 5, 2023

Maybe apply.altexp parameter to transformAssay?

@TuomasBorman
Copy link
Contributor

@Insaynoah Could you check this?

If apply.altexp=TRUE

  1. Do transformation to TreeSE. (just like it does currently)
  2. If there are altExps, lapply over them and apply transformation

@TuomasBorman
Copy link
Contributor

TuomasBorman commented Jun 7, 2024

assay <- assay(x, assay.type)

It might be that you have to move code from lines 235-258 to internal function. Then call that internal function from the transformAssay().

# In input check, check that assays present. --> If apply.altexp was specified, check also assays of altexp --> fail fast
#
x <- .perform_transformation()

if( apply.altexps && length(altExps) > 0 ){
   altExps() <- lapply(altExps(), .perform_ransformation()
}

return(x)
.perform_transform <- funciton(){
1. Apply pseudocount
2. Apply transformation
3. return TreeSE with transformed data
}

@Insaynoah Insaynoah self-assigned this Jun 13, 2024
@antagomir antagomir assigned Insaynoah and unassigned Insaynoah Jun 18, 2024
@antagomir
Copy link
Member Author

Thanks @Insaynoah if you have a chance to check it

@TuomasBorman
Copy link
Contributor

This is useful and often needed. @ake123 can you check? See the comments above

tse <- agglomerateByRanks(tse)
tse <- transformAssay(tse, method = "relabundance", apply.altexp = TRUE)

@antagomir
Copy link
Member Author

Yes. Just one reservation: imo we could allow users to choose which altexps they would like to include. The default could be all (as in apply.altexp=TRUE) but it could also be a subset selection, like apply.altexp=c("counts", "relabundance").

Could it be just a shorter "altexp" instead of "apply.altexp"?

@TuomasBorman
Copy link
Contributor

altexp is ok, so it would be

tse <- transformAssay(tse, method = "relabundance", altexp = c("phylum", "genus"))

@antagomir
Copy link
Member Author

Hups, yes.

@ake123
Copy link
Collaborator

ake123 commented Jul 24, 2024

This is ready I am waiting for the other PR closed then make a PR for this.

ake123 added a commit to ake123/mia that referenced this issue Jul 30, 2024
TuomasBorman added a commit that referenced this issue Sep 21, 2024
Co-authored-by: Tuomas Borman <[email protected]>
Co-authored-by: Leo Lahti <[email protected]>
Co-authored-by: TuomasBorman <[email protected]>
Co-authored-by: Muluh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants