changeset 6:1d140c4a5875 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:19 +0000
parents 87f1eaa410cc
children 2c5686d627c0
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:06 2024 +0000
+++ b/decoupler_pseudobulk.py	Fri Oct 25 15:12:19 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]