Skip to content

Commit

Permalink
load assignment score for localmax
Browse files Browse the repository at this point in the history
  • Loading branch information
Müller-Bötticher committed Oct 28, 2024
1 parent dce8532 commit 6dee4b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 11 additions & 1 deletion sainsc/lazykde/_LazyKDE.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,18 @@ def load_local_maxima_cosine_similarity(
-------
anndata.AnnData
"""
# Celltype assignment must have beenn run so the following attributesshoul exist
assert self.local_maxima is not None
return _load_localmax_cosine(self.local_maxima, zarr_path, celltypes=celltypes)
assert self.celltypes is not None
assert self.celltype_map is not None
assert self.assignment_score is not None

adata = _load_localmax_cosine(self.local_maxima, zarr_path, celltypes=celltypes)
adata.obs["celltype"] = pd.Categorical.from_codes(
self.celltype_map[self.local_maxima], self.celltypes
)
adata.obs["assignment_score"] = self.assignment_score[self.local_maxima]
return adata

## Celltyping
def filter_background(
Expand Down
3 changes: 1 addition & 2 deletions sainsc/lazykde/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def _load_localmax_cosine(
)

obs = pd.DataFrame(
{"celltype": pd.Categorical.from_codes(cosine.argmax(axis=1), celltypes)},
index=_get_coordinate_index(*coord, name="local_maxima", n_threads=1),
index=_get_coordinate_index(*coord, name="local_maxima", n_threads=1)
)
var = pd.DataFrame(index=celltypes)

Expand Down

0 comments on commit 6dee4b7

Please sign in to comment.