spatialcore 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {spatialcore-0.2.0 → spatialcore-0.2.1}/PKG-INFO +1 -1
- {spatialcore-0.2.0 → spatialcore-0.2.1}/pyproject.toml +1 -1
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/__init__.py +1 -1
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/training.py +36 -3
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore.egg-info/PKG-INFO +1 -1
- {spatialcore-0.2.0 → spatialcore-0.2.1}/LICENSE +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/README.md +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/setup.cfg +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/acquisition.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/annotate.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/cellxgene.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/confidence.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/discovery.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/expression.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/loading.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/markers.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/ontology.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/patterns.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/pipeline.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/synapse.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/annotation/validation.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/core/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/core/cache.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/core/logging.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/core/metadata.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/core/utils.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/data/gene_mappings/ensembl_to_hugo_human.tsv +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/data/markers/canonical_markers.json +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/data/ontology_mappings/ontology_index.json +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/benchmark.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/celltype.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/confidence.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/spatial.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/utils.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/plotting/validation.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/r_bridge/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/r_bridge/subprocess_runner.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/spatial/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/spatial/autocorrelation.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/spatial/distance.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/spatial/domains.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/spatial/neighborhoods.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/stats/__init__.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/stats/_thresholding.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/stats/classify.py +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore.egg-info/SOURCES.txt +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore.egg-info/dependency_links.txt +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore.egg-info/requires.txt +0 -0
- {spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@ A thin, robust wrapper around standard libraries to ensure Python and R users
|
|
|
5
5
|
get the exact same result for the same biological question.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "0.2.
|
|
8
|
+
__version__ = "0.2.1"
|
|
9
9
|
|
|
10
10
|
# Track which modules are available in this installation
|
|
11
11
|
_available_modules: list[str] = []
|
|
@@ -1243,8 +1243,8 @@ def subsample_balanced(
|
|
|
1243
1243
|
max_cells_per_type : int, default 5000
|
|
1244
1244
|
Maximum cells per cell type in output.
|
|
1245
1245
|
min_cells_per_type : int, default 50
|
|
1246
|
-
|
|
1247
|
-
|
|
1246
|
+
Minimum cells required to keep a cell type. Types with fewer
|
|
1247
|
+
cells are removed before balancing.
|
|
1248
1248
|
source_column : str, optional, default "reference_source"
|
|
1249
1249
|
Column identifying which reference each cell came from.
|
|
1250
1250
|
Set to None to disable source-aware balancing (simple capping).
|
|
@@ -1387,8 +1387,41 @@ def subsample_balanced(
|
|
|
1387
1387
|
else:
|
|
1388
1388
|
cell_types = adata.obs[label_column].astype(str)
|
|
1389
1389
|
|
|
1390
|
-
unique_types = cell_types.unique()
|
|
1391
1390
|
type_counts = cell_types.value_counts()
|
|
1391
|
+
if min_cells_per_type > 0:
|
|
1392
|
+
low_count_types = type_counts[type_counts < min_cells_per_type].index.tolist()
|
|
1393
|
+
if low_count_types:
|
|
1394
|
+
n_removed = int(type_counts[type_counts < min_cells_per_type].sum())
|
|
1395
|
+
logger.info(
|
|
1396
|
+
f"\nFiltering low-count cell types (<{min_cells_per_type} cells) before balancing:"
|
|
1397
|
+
)
|
|
1398
|
+
logger.info(f" Removing {len(low_count_types)} types, {n_removed:,} cells")
|
|
1399
|
+
for ct in low_count_types[:10]:
|
|
1400
|
+
logger.info(f" {ct}: {type_counts[ct]} cells")
|
|
1401
|
+
if len(low_count_types) > 10:
|
|
1402
|
+
logger.info(f" ... and {len(low_count_types) - 10} more types")
|
|
1403
|
+
|
|
1404
|
+
keep_mask = ~cell_types.isin(low_count_types)
|
|
1405
|
+
adata = adata[keep_mask].copy()
|
|
1406
|
+
|
|
1407
|
+
if group_by_column is not None:
|
|
1408
|
+
cell_types = adata.obs[group_by_column].astype(str)
|
|
1409
|
+
else:
|
|
1410
|
+
cell_types = adata.obs[label_column].astype(str)
|
|
1411
|
+
|
|
1412
|
+
if props:
|
|
1413
|
+
dropped = sorted(set(props) & set(low_count_types))
|
|
1414
|
+
if dropped:
|
|
1415
|
+
for ct in dropped:
|
|
1416
|
+
props.pop(ct, None)
|
|
1417
|
+
logger.warning(
|
|
1418
|
+
"Dropping target_proportions for low-count types: %s",
|
|
1419
|
+
", ".join(dropped),
|
|
1420
|
+
)
|
|
1421
|
+
|
|
1422
|
+
type_counts = cell_types.value_counts()
|
|
1423
|
+
|
|
1424
|
+
unique_types = cell_types.unique()
|
|
1392
1425
|
target_totals = _resolve_target_totals(
|
|
1393
1426
|
type_counts=type_counts,
|
|
1394
1427
|
min_cells_per_type=min_cells_per_type,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/data/gene_mappings/ensembl_to_hugo_human.tsv
RENAMED
|
File without changes
|
|
File without changes
|
{spatialcore-0.2.0 → spatialcore-0.2.1}/src/spatialcore/data/ontology_mappings/ontology_index.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|