diff --git a/panpipes/panpipes/pipeline_integration.py b/panpipes/panpipes/pipeline_integration.py index b1ff648c..c5f79646 100644 --- a/panpipes/panpipes/pipeline_integration.py +++ b/panpipes/panpipes/pipeline_integration.py @@ -228,6 +228,9 @@ def run_scvi(outfile): --figdir figures/rna/ """ # cannot use the normal method for importing params from yaml, because it only works up to depth 2 + # fetch seeds + scvi_params = PARAMS['rna']['scvi'] + cmd += " --scvi_seed %s" % scvi_params['seed'] neighbor_params = PARAMS['rna']['neighbors'] if neighbor_params['method'] is not None: cmd += " --neighbors_method %s" % neighbor_params['method'] @@ -550,6 +553,10 @@ def run_totalvi(outfile): --output_csv %(outfile)s --figdir figures/ """ + scvi_params = PARAMS['multimodal']['totalvi'] + cmd += " --scvi_seed %s" % scvi_params['seed'] + + if PARAMS['multimodal_column_categorical'] is not None: cmd += "--integration_col_categorical %(multimodal_column_categorical)s " neighbor_params = PARAMS['multimodal']['neighbors'] @@ -587,7 +594,10 @@ def run_multivi(outfile): --output_csv %(outfile)s --figdir figures/ """ + scvi_params = PARAMS['multimodal']['MultiVI'] + cmd += " --scvi_seed %s" % scvi_params['seed'] + if PARAMS['multimodal_column_categorical'] is not None: cmd += "--integration_col_categorical %(multimodal_column_categorical)s " diff --git a/panpipes/panpipes/pipeline_integration/pipeline.yml b/panpipes/panpipes/pipeline_integration/pipeline.yml index a3cea274..d5f29875 100644 --- a/panpipes/panpipes/pipeline_integration/pipeline.yml +++ b/panpipes/panpipes/pipeline_integration/pipeline.yml @@ -26,7 +26,8 @@ queues: # -------------------------------- # ---------------------------- -# Data format +# Data input +# ---------------------------- sample_prefix: test preprocessed_obj: ../preprocess/test.h5mu @@ -34,7 +35,7 @@ preprocessed_obj: ../preprocess/test.h5mu #----------------- # Batch correction # ---------------- -# Batch correction is done unimodal, meaning each modality is batch corrected independently +# Batch correction, unimodal correction: meaning each modality is batch corrected independently. # ------------ # RNA modality @@ -55,6 +56,7 @@ rna: # SCVI args scvi: + seed: 1492 exclude_mt_genes: True mt_column: mt model_args: @@ -144,6 +146,7 @@ multimodal: # TotalVI arguments totalvi: + seed: 1492 modalities: rna,prot exclude_mt_genes: True mt_column: mt @@ -159,6 +162,7 @@ multimodal: # MultiVI arguments MultiVI: + seed: 1492 lowmem: True model_args: n_hidden : diff --git a/panpipes/python_scripts/batch_correct_multivi.py b/panpipes/python_scripts/batch_correct_multivi.py index 533369a9..f6fd347d 100644 --- a/panpipes/python_scripts/batch_correct_multivi.py +++ b/panpipes/python_scripts/batch_correct_multivi.py @@ -46,6 +46,8 @@ help="neighbors k") parser.add_argument('--neighbors_metric',default="euclidean", help="neighbor metric, e.g. euclidean or cosine") +parser.add_argument('--scvi_seed',default=None, + help="set explicitly seed to make runs reproducible") @@ -57,7 +59,10 @@ sc.settings.autoshow = False sc.settings.figdir = args.figdir -scvi.settings.seed = 1492 +if args.scvi_seed is not None: + scvi.settings.seed = int(args.scvi_seed) +else: + scvi.settings.seed = 1492 # load parameters threads_available = multiprocessing.cpu_count() diff --git a/panpipes/python_scripts/batch_correct_scvi.py b/panpipes/python_scripts/batch_correct_scvi.py index 6c6ac24b..bf86f87b 100644 --- a/panpipes/python_scripts/batch_correct_scvi.py +++ b/panpipes/python_scripts/batch_correct_scvi.py @@ -44,6 +44,9 @@ help="neighbors k") parser.add_argument('--neighbors_metric', help="neighbor metric, e.g. euclidean or cosine") +parser.add_argument('--scvi_seed',default=None, + help="set explicitly seed to make runs reproducible") + args, opt = parser.parse_known_args() @@ -61,6 +64,12 @@ sc.settings.autoshow = False sc.settings.figdir = args.figdir +if args.scvi_seed is not None: + scvi.settings.seed = int(args.scvi_seed) +else: + scvi.settings.seed = 1492 + + # test_script=params['rna']['scvi']['testrun'] test_script=False diff --git a/panpipes/python_scripts/batch_correct_totalvi.py b/panpipes/python_scripts/batch_correct_totalvi.py index b7214484..8431ea74 100644 --- a/panpipes/python_scripts/batch_correct_totalvi.py +++ b/panpipes/python_scripts/batch_correct_totalvi.py @@ -46,6 +46,11 @@ help="neighbors k") parser.add_argument('--neighbors_metric',default="euclidean", help="neighbor metric, e.g. euclidean or cosine") +parser.add_argument('--scvi_seed',default=None, + help="set explicitly seed to make runs reproducible") + + + args, opt = parser.parse_known_args() L.info(args) @@ -55,6 +60,11 @@ sc.settings.figdir = args.figdir +if args.scvi_seed is not None: + scvi.settings.seed = int(args.scvi_seed) +else: + scvi.settings.seed = 1492 + # load parameters threads_available = multiprocessing.cpu_count()