Skip to content

Commit

Permalink
🎨 Make sure pert_ column categories are consistent (#92)
Browse files Browse the repository at this point in the history
* 🩹 Add unknown as default Tissue

* ⏪️ Remove tissue default

* 🎨 Clean up categories
  • Loading branch information
sunnyosun authored Jan 12, 2025
1 parent 3d94975 commit b33760e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wetlab/_pert_curator.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ def _process_perturbation_types(self, adata: ad.AnnData, pert_types: set):
adata.obs[col_name] = adata.obs["pert_name"].where(
adata.obs["pert_type"] == pert_type, None
)
if adata.obs[col_name].dtype.name == "category":
adata.obs[col_name].cat.remove_unused_categories()
logger.important(f"mapped 'pert_name' to '{col_name}'")

def _setup_compound_source(self):
Expand Down

0 comments on commit b33760e

Please sign in to comment.