changeset 8:3c18dda2ea3f draft

planemo upload for repository https://github.com/ebi-gene-expression-group/container-galaxy-sc-tertiary/ commit f6c6b8e014c99101232dc75aa972a12fc640a4de
author ebi-gxa
date Fri, 25 Oct 2024 15:12:14 +0000
parents 617e50767215
children 8a9c173645d2
files decoupler_pseudobulk.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/decoupler_pseudobulk.py	Wed Oct 02 08:27:01 2024 +0000
+++ b/decoupler_pseudobulk.py	Fri Oct 25 15:12:14 2024 +0000
@@ -503,6 +503,14 @@
         for condition in conditions:
             # remove any starting or trailing whitespaces from condition
             condition = condition.strip()
+            if condition not in adata.obs[obs_field].unique():
+                raise ValueError(
+                    f"Condition '{condition}' from contrast {contrast}"
+                    f" is not present in the "
+                    f"obs_field '{obs_field}' from the AnnData object."
+                    f"Possible values are: "
+                    f"{', '.join(adata.obs[obs_field].unique())}."
+                )
             # check the percentage of cells that express each gene
             # Filter the AnnData object based on the obs_field value
             adata_filtered = adata[adata.obs[obs_field] == condition]