Skip to content

Commit 2810413

Browse files
committed
cluster_subcluster fix layser and hvg
1 parent 95bf10d commit 2810413

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

docs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to PySingleCellNet should be listed here. The definition of
44

55
## [Unreleased]
66

7+
### Changed
8+
- tl.cluster_subclusters layer should be None instead of counts
9+
10+
### Fixed
11+
12+
- tl.cluster_subclusters calls sc.pp.pca with mask_var instead of use_highly_variable
13+
14+
715
## [0.1.3] - 2025-09-15
816

917
### Changed

src/pySingleCellNet/tools/cluster.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def cluster_subclusters(
259259
adata: ad.AnnData,
260260
cluster_column: str = 'leiden',
261261
to_subcluster: list[str] = None,
262-
layer: str = 'counts',
262+
layer = None,
263263
n_hvg: int = 2000,
264264
hvg_flavor: str = 'cell_ranger',
265265
n_pcs: int = 40,
@@ -281,8 +281,8 @@ def cluster_subclusters(
281281
Name of the `.obs` column holding the original cluster assignments. Default is 'leiden'.
282282
to_subcluster: list of str, optional
283283
List of cluster labels (as strings) to subcluster. If `None`, subclusters *all* clusters.
284-
layer: str, optional
285-
Layer name in `adata.layers` to use for HVG detection. Default is 'counts'.
284+
layer:
285+
Layer name in `adata.layers` to use for HVG detection. Default is None (and so uses .X)
286286
n_hvg: int, optional
287287
Number of highly variable genes to select per cluster. Default is 2000.
288288
n_pcs: int, optional
@@ -335,7 +335,7 @@ def cluster_subclusters(
335335
)
336336

337337
# 2) PCA
338-
sc.pp.pca(sub, n_comps=n_pcs, use_highly_variable=True)
338+
sc.pp.pca(sub, n_comps=n_pcs, mask_var='highly_variable')
339339

340340
# 3) kNN
341341
sc.pp.neighbors(sub, n_neighbors=n_neighbors, use_rep='X_pca')

0 commit comments

Comments
 (0)