From 6f87e722fcdf4af93917480003f6106197d7d03f Mon Sep 17 00:00:00 2001 From: Wojciech Lason <40389067+wlason@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:55:36 +0100 Subject: [PATCH 1/3] Update run_preprocess_prot.py --- panpipes/python_scripts/run_preprocess_prot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/panpipes/python_scripts/run_preprocess_prot.py b/panpipes/python_scripts/run_preprocess_prot.py index e221138d..12fbc67f 100644 --- a/panpipes/python_scripts/run_preprocess_prot.py +++ b/panpipes/python_scripts/run_preprocess_prot.py @@ -103,6 +103,22 @@ else: L.error("You must specify a background MuData to run dsb, containing both rna and prot") sys.exit("You must specify a background MuData to run dsb, containing both rna and prot") + + # RNA and PROT layer must be present in the object to run dsb + mods = list(all_mdata_bg.mod.keys()) + if 'prot' not in mods: + L.error("The MuData you specified does not contain prot modality. Cannot run dsb") + sys.exit("The MuData you specified does not contain prot modality. Cannot run dsb") + if 'rna' not in mods: + L.error("The MuData you specified does not contain rna modality. Cannot run dsb") + sys.exit("The MuData you specified does not contain rna modality. Cannot run dsb") + del mods + + # the RNA and PROT must intersect - they won't if experimental design included some cells without PROT data + L.info("Checking that only cells with PROT signal present are in the bacground object") + if all_mdata_bg['rna'].shape[0] != all_mdata_bg['prot'].shape[0]: + mu.pp.intersect_obs(mdata_bg) + all_mdata_bg.update() # checking that the same proteins are in foreground and background (since foreground might have been filtered) L.info("Checking that the same proteins are in foreground and background") From 6ea37e9d0f6a6748a99bbdc03578b51b27aa5e45 Mon Sep 17 00:00:00 2001 From: Wojciech Lason <40389067+wlason@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:10:54 +0100 Subject: [PATCH 2/3] check dsb bg obj in run_preprocess_prot.py --- panpipes/python_scripts/run_preprocess_prot.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/panpipes/python_scripts/run_preprocess_prot.py b/panpipes/python_scripts/run_preprocess_prot.py index 12fbc67f..19b5e7f1 100644 --- a/panpipes/python_scripts/run_preprocess_prot.py +++ b/panpipes/python_scripts/run_preprocess_prot.py @@ -105,14 +105,9 @@ sys.exit("You must specify a background MuData to run dsb, containing both rna and prot") # RNA and PROT layer must be present in the object to run dsb - mods = list(all_mdata_bg.mod.keys()) - if 'prot' not in mods: - L.error("The MuData you specified does not contain prot modality. Cannot run dsb") - sys.exit("The MuData you specified does not contain prot modality. Cannot run dsb") - if 'rna' not in mods: + if 'rna' not in list(all_mdata_bg.mod.keys()): L.error("The MuData you specified does not contain rna modality. Cannot run dsb") sys.exit("The MuData you specified does not contain rna modality. Cannot run dsb") - del mods # the RNA and PROT must intersect - they won't if experimental design included some cells without PROT data L.info("Checking that only cells with PROT signal present are in the bacground object") From 5dda110ce7ce16f3412411bde64a63fe7ccd46f3 Mon Sep 17 00:00:00 2001 From: Wojciech Lason <40389067+wlason@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:22:18 +0100 Subject: [PATCH 3/3] fix typo in run_preprocess_prot.py --- panpipes/python_scripts/run_preprocess_prot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panpipes/python_scripts/run_preprocess_prot.py b/panpipes/python_scripts/run_preprocess_prot.py index 19b5e7f1..793bac7b 100644 --- a/panpipes/python_scripts/run_preprocess_prot.py +++ b/panpipes/python_scripts/run_preprocess_prot.py @@ -110,7 +110,7 @@ sys.exit("The MuData you specified does not contain rna modality. Cannot run dsb") # the RNA and PROT must intersect - they won't if experimental design included some cells without PROT data - L.info("Checking that only cells with PROT signal present are in the bacground object") + L.info("Checking that only cells with PROT signal present are in the background object") if all_mdata_bg['rna'].shape[0] != all_mdata_bg['prot'].shape[0]: mu.pp.intersect_obs(mdata_bg) all_mdata_bg.update()