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

Add lowmem parameter to MOFA #311

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions panpipes/panpipes/pipeline_integration/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ multimodal:
mofa:
modalities: rna,prot,atac
filter_by_hvg: True
lowmem: True
n_factors: 10
n_iterations: 1000
convergence_mode: fast
Expand Down
19 changes: 19 additions & 0 deletions panpipes/python_scripts/batch_correct_mofa.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@
L.info("Intersecting modality obs before running mofa")
mu.pp.intersect_obs(tmp)


if check_for_bool(params["multimodal"]["MultiVI"]["lowmem"]):
L.info("Running in low memory mode. Calculating and subsetting ATAC to top 25k HVF")
atac = tmp.mod['atac']

sc.pp.highly_variable_genes(atac, n_top_genes=25000)
atac = atac[:, atac.var.highly_variable].copy()

tmp.mod['atac'] = atac.copy()
del atac

tmp.update()

gc.collect()

mofa_kwargs={}
#expected args:
# n_factors: 10
Expand All @@ -106,6 +121,7 @@

mofa_kwargs = params['multimodal']['mofa']
del mofa_kwargs['modalities']
del mofa_kwargs['lowmem']

if mofa_kwargs['filter_by_hvg']:
mofa_kwargs['use_var'] = "highly_variable"
Expand All @@ -115,6 +131,9 @@
tmp[mod].var["highly_variable"] = True

tmp.update()
else:
del mofa_kwargs['filter_by_hvg']
mofa_kwargs['use_var'] = None



Expand Down