Skip to content

Commit

Permalink
Unknown key-value pair handling has been added (#72)
Browse files Browse the repository at this point in the history
* Added handling mechanism for 'unknown' cell_type in seed_dict

* Updated version to 0.1.15

* Refactored multiple test cases

* Fixed typo
  • Loading branch information
ubyndr committed May 13, 2024
1 parent 711fcc8 commit bcad34d
Show file tree
Hide file tree
Showing 6 changed files with 536 additions and 569 deletions.
10 changes: 7 additions & 3 deletions pandasaurus_cxg/anndata_enricher.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ def __init__(
# TODO Do we need to keep whole anndata? Would it be enough to keep the obs only?
self.anndata = anndata
self.seed_dict = dict(
self.anndata.obs.drop_duplicates(subset=[cell_type_field, "cell_type"]).dropna()[
[cell_type_field, "cell_type"]
].values
self.anndata.obs.drop_duplicates(subset=[cell_type_field, "cell_type"])
.dropna()[[cell_type_field, "cell_type"]]
.values
)
# "unknown" patch
if "unknown" in self.seed_dict:
del self.seed_dict["unknown"]
self.seed_dict["CL:0000000"] = "cell"
self.enricher = Query(list(self.seed_dict.keys()))
try:
unique_context = self.anndata.obs[
Expand Down
Loading

0 comments on commit bcad34d

Please sign in to comment.