From 7616379f7f1ab33347d88366f8d61953dc031f6f Mon Sep 17 00:00:00 2001 From: Nico Trummer Date: Mon, 8 Apr 2024 18:11:00 +0200 Subject: [PATCH] Fix problem with new cell labels in extend workflow --- bin/merge_datasets.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/merge_datasets.py b/bin/merge_datasets.py index 155fdb1..bb8e12b 100755 --- a/bin/merge_datasets.py +++ b/bin/merge_datasets.py @@ -90,6 +90,10 @@ def to_Florent_case(s: str): if args.base: adata_transfer = adata_intersection[~adata_intersection.obs.index.isin(adata_base.obs.index)] + + known_celltypes = adata_base.obs["cell_type"].unique() + adata_transfer.obs["cell_type"] = adata_transfer.obs["cell_type"].map(lambda x: x if x in known_celltypes else "Unknown") + adata_transfer.write_h5ad(args.output_transfer) adata_intersection.write_h5ad(args.output_intersection)