Skip to content

Commit

Permalink
adding seeds to each scvi-tool script
Browse files Browse the repository at this point in the history
  • Loading branch information
bio-la committed Mar 26, 2024
1 parent 22aa0bd commit 2a1b863
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
10 changes: 10 additions & 0 deletions panpipes/panpipes/pipeline_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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 "

Expand Down
8 changes: 6 additions & 2 deletions panpipes/panpipes/pipeline_integration/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ queues:
# --------------------------------

# ----------------------------
# Data format
# Data input
# ----------------------------
sample_prefix: test
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
Expand All @@ -55,6 +56,7 @@ rna:

# SCVI args
scvi:
seed: 1492
exclude_mt_genes: True
mt_column: mt
model_args:
Expand Down Expand Up @@ -144,6 +146,7 @@ multimodal:

# TotalVI arguments
totalvi:
seed: 1492
modalities: rna,prot
exclude_mt_genes: True
mt_column: mt
Expand All @@ -159,6 +162,7 @@ multimodal:

# MultiVI arguments
MultiVI:
seed: 1492
lowmem: True
model_args:
n_hidden :
Expand Down
7 changes: 6 additions & 1 deletion panpipes/python_scripts/batch_correct_multivi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")



Expand All @@ -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()
Expand Down
9 changes: 9 additions & 0 deletions panpipes/python_scripts/batch_correct_scvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions panpipes/python_scripts/batch_correct_totalvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand Down

0 comments on commit 2a1b863

Please sign in to comment.