Skip to content

Commit 7edb7fe

Browse files
committed
Fix mapping matrix type
1 parent d0e910b commit 7edb7fe

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

docs/notebooks/tutorials/spatial_mapping.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@
508508
},
509509
{
510510
"cell_type": "code",
511-
"execution_count": 14,
511+
"execution_count": null,
512512
"metadata": {},
513513
"outputs": [
514514
{
@@ -523,7 +523,7 @@
523523
],
524524
"source": [
525525
"cmap.compute_neighbors(use_rep=\"X_harmony\", only_yx=True)\n",
526-
"cmap.compute_mappping_matrix()"
526+
"cmap.compute_mapping_matrix()"
527527
]
528528
},
529529
{

docs/notebooks/tutorials/spatial_smoothing.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@
529529
},
530530
{
531531
"cell_type": "code",
532-
"execution_count": 21,
532+
"execution_count": null,
533533
"metadata": {},
534534
"outputs": [
535535
{
@@ -542,7 +542,7 @@
542542
}
543543
],
544544
"source": [
545-
"smap.compute_mappping_matrix(method=\"equal\")"
545+
"smap.compute_mapping_matrix(method=\"equal\")"
546546
]
547547
},
548548
{

src/cellmapper/model/cellmapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def compute_neighbors(
249249
self.knn = Neighbors(np.ascontiguousarray(xrep), np.ascontiguousarray(yrep))
250250
self.knn.compute_neighbors(n_neighbors=n_neighbors, method=method, metric=metric, only_yx=only_yx)
251251

252-
def compute_mappping_matrix(
252+
def compute_mapping_matrix(
253253
self,
254254
method: Literal["jaccard", "gaussian", "scarches", "inverse_distance", "random", "hnoca", "equal"] = "gaussian",
255255
) -> None:
@@ -532,7 +532,7 @@ def fit(
532532
self.compute_neighbors(
533533
n_neighbors=n_neighbors, use_rep=use_rep, method=knn_method, metric=metric, only_yx=only_yx
534534
)
535-
self.compute_mappping_matrix(method=mapping_method)
535+
self.compute_mapping_matrix(method=mapping_method)
536536
if obs_keys is not None:
537537
self.transfer_labels(obs_keys=obs_keys, prediction_postfix=prediction_postfix)
538538
if obsm_keys is not None:

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def cmap(query_reference_adata):
177177

178178
# Compute neighbors and mapping matrix
179179
cmap.compute_neighbors(n_neighbors=30, use_rep="X_pca", method="sklearn")
180-
cmap.compute_mappping_matrix(method="gaussian")
180+
cmap.compute_mapping_matrix(method="gaussian")
181181

182182
return cmap
183183

tests/test_query_to_reference_mapping.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_expression_transfer(self, cmap, expected_expression_transfer_metrics):
3636
"method", ["gaussian", "scarches", "random", "inverse_distance", "jaccard", "hnoca", "equal"]
3737
)
3838
def test_compute_mapping_matrix_all_methods(self, cmap, method):
39-
cmap.compute_mappping_matrix(method=method)
39+
cmap.compute_mapping_matrix(method=method)
4040
assert cmap.mapping_matrix is not None
4141

4242
@pytest.mark.parametrize("layer_key", ["X", "counts"])

tests/test_self_mapping.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_all_operations_self_mapping(self, adata_pbmc3k):
4343

4444
# Test with typical parameters
4545
cm.compute_neighbors(n_neighbors=5, use_rep="X_pca")
46-
cm.compute_mappping_matrix(method="gaussian")
46+
cm.compute_mapping_matrix(method="gaussian")
4747

4848
# Test label transfer
4949
cm.transfer_labels(obs_keys="leiden")
@@ -83,7 +83,7 @@ def test_load_scanpy_distances(self, adata_spatial, n_neighbors):
8383
assert cm.knn.xx.n_neighbors + 1 == n_neighbors
8484

8585
# Test the full pipeline with precomputed distances
86-
cm.compute_mappping_matrix(method="gaussian")
86+
cm.compute_mapping_matrix(method="gaussian")
8787
cm.transfer_labels(obs_keys="leiden")
8888

8989
assert "leiden_pred" in cm.query.obs
@@ -142,7 +142,7 @@ def test_load_squidpy_distances(self, adata_spatial, squidpy_params):
142142
).all()
143143

144144
# Test the mapping pipeline
145-
cm.compute_mappping_matrix(method="gaussian")
145+
cm.compute_mapping_matrix(method="gaussian")
146146
cm.transfer_labels(obs_keys="leiden")
147147

148148
assert "leiden_pred" in cm.query.obs
@@ -176,8 +176,8 @@ def test_load_distances_with_include_self(self, adata_spatial, include_self):
176176
assert i not in cm_without_self.knn.xx.indices[i]
177177

178178
# Both should work with the rest of the pipeline
179-
cm_with_self.compute_mappping_matrix(method="gaussian")
180-
cm_without_self.compute_mappping_matrix(method="gaussian")
179+
cm_with_self.compute_mapping_matrix(method="gaussian")
180+
cm_without_self.compute_mapping_matrix(method="gaussian")
181181

182182
# Compute label transfer for both
183183
cm_with_self.transfer_labels(obs_keys="leiden", prediction_postfix="with_self")
@@ -197,7 +197,7 @@ def test_self_mapping_without_rep(self, adata_pbmc3k):
197197

198198
# Test with no representation provided
199199
cm.compute_neighbors(n_neighbors=5, use_rep=None, n_comps=10)
200-
cm.compute_mappping_matrix(method="gaussian")
200+
cm.compute_mapping_matrix(method="gaussian")
201201

202202
# Verify joint PCA was computed
203203
assert "X_pca" in adata_pbmc3k.obsm

0 commit comments

Comments
 (0)