Skip to content

Commit b3c3262

Browse files
authored
Merge pull request #314 from DendrouLab/dsb_bg_fix
Fix dsb background
2 parents 50e734c + 5dda110 commit b3c3262

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

panpipes/python_scripts/run_preprocess_prot.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@
103103
else:
104104
L.error("You must specify a background MuData to run dsb, containing both rna and prot")
105105
sys.exit("You must specify a background MuData to run dsb, containing both rna and prot")
106+
107+
# RNA and PROT layer must be present in the object to run dsb
108+
if 'rna' not in list(all_mdata_bg.mod.keys()):
109+
L.error("The MuData you specified does not contain rna modality. Cannot run dsb")
110+
sys.exit("The MuData you specified does not contain rna modality. Cannot run dsb")
111+
112+
# the RNA and PROT must intersect - they won't if experimental design included some cells without PROT data
113+
L.info("Checking that only cells with PROT signal present are in the background object")
114+
if all_mdata_bg['rna'].shape[0] != all_mdata_bg['prot'].shape[0]:
115+
mu.pp.intersect_obs(mdata_bg)
116+
all_mdata_bg.update()
106117

107118
# checking that the same proteins are in foreground and background (since foreground might have been filtered)
108119
L.info("Checking that the same proteins are in foreground and background")

0 commit comments

Comments
 (0)