-
Notifications
You must be signed in to change notification settings - Fork 204
feat: added wrapper for MOFA2 #4883
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
d205b53
initialised workspace
seneschall ab3f1c8
added test data, dependencies
seneschall 609a372
implemented wrapper; added test data
d59ec3c
worked on wrapper
seneschall 5e2defa
fixed environment.yaml ; added test data
seneschall 265399c
started adding params
seneschall 26636a1
added test; appended meta.yaml; cleanup
seneschall df7be10
changed flag in test
seneschall c850121
removed testing pixi envs
seneschall 88b7ccc
changed wrapper path
seneschall 86efe3c
pinned environment; cleanup
seneschall aa73d2f
Merge branch 'master' into mofa2-wrapper
johanneskoester 97a5512
Apply suggestion from @coderabbitai[bot]
johanneskoester 8f20ee7
deleted requested files
seneschall 4480162
changed params froms strings to native bools
seneschall c788d45
fixed assignment bug; cleaned up comments
seneschall fe651a1
changed handling of output
seneschall 8072bd5
removed log file
seneschall 762a4ea
removed dependencies; readded gitignore
seneschall af345bf
updated pinned environment
seneschall da1b6b0
Merge branch 'master' into mofa2-wrapper
fgvieira dc9ac50
removed .gitattributes
seneschall 2aa6ed3
started working on subwrappers
seneschall 3bb4dff
added functionality for multiple plots
seneschall eac269f
added test data
seneschall eb482c2
adding params
seneschall db39e37
cleanup
seneschall bd61cb5
started working on meta.yaml
seneschall 15a040b
added notes to meta.yaml ; added test cases
e66771b
pinned environment
seneschall c92b290
fix to remove undesired output
seneschall 34a23a6
Merge branch 'mofa2-subwrappers' into mofa2-wrapper
seneschall 181b022
fixed issues
seneschall a679d95
changed notes to params in plotting/meta.yaml
seneschall 4648b53
reformatted meta.yaml
seneschall 3919b52
Apply suggestion from @fgvieira
fgvieira a91c777
Merge branch 'master' into mofa2-wrapper
fgvieira 1655fc4
Update bio/mofa2/training/test/Snakefile
johanneskoester f2e1d96
Update bio/mofa2/training/meta.yaml
johanneskoester cd139ce
Update bio/mofa2/training/meta.yaml
johanneskoester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # SCM syntax highlighting & preventing 3-way merges | ||
| pixi.lock merge=binary linguist-language=YAML linguist-generated=true |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| - nodefaults | ||
| dependencies: | ||
| - bioconductor-mofa2 =1.16.0 | ||
| - r-base =4.4.3 | ||
| - r-arrow =22.0.0 | ||
| - mofapy2 =0.7.2 | ||
| - python =3.14.2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: mofa2 | ||
| description: | | ||
| Train a model on a multi-omic data set with default options. | ||
| url: https://www.bioconductor.org/packages/release/bioc/html/MOFA2.html | ||
| authors: | ||
| - Simon Sack | ||
| input: | ||
| - | | ||
| A parquet file in tidy format containing data with the headers: `sample, feature, view, group (optional), value` | ||
|
|
||
| `sample`: The name of the sample | ||
|
|
||
| `feature`: The name of the observed feature | ||
|
|
||
| `group` (optional, advanced): Discouraged for beginners. The aim of the multi-group framework is not to capture differential changes in mean levels between the groups (as for example when doing differential RNA expression). The goal is to compare the sources of variability that drive each group. | ||
|
|
||
| `value`: The observed value | ||
|
|
||
| `view`: The view the observed feature is grouped into | ||
| output: | ||
| - An HDF5-file with the trained model. | ||
| notes: | | ||
| In the params, set `scale_group` and/or `scale_views` to `TRUE`, if your groups/views | ||
| have different ranges/variances. This scales them to unit variance. | ||
| Defaults to `FALSE` if no params are given. | ||
| For all other training variables, this wrapper uses the default values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| rule mofa2: | ||
| input: | ||
| "{data}.parquet", | ||
| output: | ||
| "{data}.hdf5", | ||
| log: | ||
| "log/{data}.log", | ||
| params: | ||
| scale_groups=False, # set to TRUE if groups have different ranges/variances | ||
| scale_views=False, # set to TRUE if views have different ranges/variances | ||
| wrapper: | ||
| "master/bio/mofa2" |
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/bin/R | ||
|
|
||
| # load libraries | ||
| library(MOFA2) | ||
| library(arrow) | ||
|
|
||
| # connect to conda environment | ||
| conda_prefix <- Sys.getenv("CONDA_PREFIX") | ||
| reticulate::use_condaenv(conda_prefix) | ||
|
|
||
| # if log file is provided, write log to that file | ||
| if (length(snakemake@log) > 0) { | ||
| log <- file(snakemake@log[[1]], open = "wt") | ||
| sink(log) | ||
| sink(log, type = "message") | ||
| } | ||
|
|
||
| # load long.data frame from parquet file with following headers: | ||
| # `sample, feature, view, group (optional), value` | ||
|
|
||
| # cast input path as character to avoid errors | ||
| path <- as.character(snakemake@input[[1]]) | ||
|
|
||
| df <- read_parquet(path) | ||
|
|
||
| mofa_object <- create_mofa(df) | ||
|
|
||
| data_opts <- get_default_data_options(mofa_object) | ||
| model_opts <- get_default_model_options(mofa_object) | ||
| train_opts <- get_default_training_options(mofa_object) | ||
|
|
||
| # model params: scale_groups, scale_views | ||
| if ("scale_groups" %in% names(snakemake@params)) { | ||
| data_opts$scale_groups <- snakemake@params[["scale_groups"]] | ||
| } | ||
|
|
||
| if ("scale_views" %in% names(snakemake@params)) { | ||
| data_opts$scale_views <- snakemake@params[["scale_views"]] | ||
| } | ||
|
|
||
| # create MOFA-object | ||
| mofa_object <- prepare_mofa( | ||
| object = mofa_object, | ||
| data_options = data_opts, | ||
| model_options = model_opts, | ||
| training_options = train_opts | ||
| ) | ||
|
|
||
| # train the MOFA model and write the result to `outfile` | ||
| run_mofa( | ||
| mofa_object, | ||
| snakemake@output[[1]] | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.