Releases: atarashansky/SAMap
Releases · atarashansky/SAMap
v3.0.1
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[3.0.1]
Fixed
get_mapping_scoresno longer raisesIndexErrorwhen the connectivity
matrix contains explicit stored zeros —_compute_csimnow calls
eliminate_zeros()beforenonzero(). (#172)_calculate_blast_graphis now compatible with pandas ≥3.0, which returns
StringArray(no.flatten()method) from.valueson string columns.
Replaced.values.flatten()withnp.asarray(...). (#173)GenePairFinder.find_genesnow honours thew1t/w2tSAM-weight threshold
parameters instead of using a hardcoded0.2. (#166)prepare_SAMap_loadingsnow falls back toadata.uns["sam"]["run_args"]
whenrun_argsis not at the top level, supporting AnnData produced by
scanpy.external.tl.sam. (#156)sankey_plotnow renders all adjacent species pairs instead of being
hardcoded for exactly 3 species. (#130)_find_link_genes_avgcoerces sparse matrix indices toint64before
fancy-indexing, avoiding scipy's int32 overflow (ValueError: negative dimensions are not allowed) on very large datasets. (#118)
Changed
- README updated for v3.0.0: Python ≥3.11 requirement, simplified conda/pip
install instructions, fixed "Anacodna" typo, updated import paths.
(#171, #137, #136, #132)
[3.0.0] - UNRELEASED
Breaking
sc-samremoved as a dependency. The SAM algorithm is now vendored
undersamap.sam. All internal imports route throughsamap.sam— no
external SAM package is installed or required. If you were importing
samalgdirectly, switch tosamap.sam._smart_expanddefault switched from matrix-power to BFS. Produces
slightly different marginal neighbours (~1% edge difference on the
golden-suite data) — the matpow path wasted one budget slot per cell on
a self-loop artefact. Passlegacy=Truefor bit-exact 2.x reproduction.
Added
- GPU backend via
SAMAP(backend="auto"|"cpu"|"cuda"). Dispatches
numpy/scipy ↔ cupy/cupyx, hnswlib ↔ FAISS for kNN, and scanpy ↔
rapids-singlecell for Leiden/UMAP. Install withpip install sc-samap[gpu]
(seedocs/performance.mdfor conda details)."auto"picks CUDA if
available, else CPU. - N² → N-linear memory rewrites (see
docs/performance.mdfor the full
model):- Precomposed feature translation — projection precomposes
G · diag(W/σ) · PCsso the cells × genesXtrintermediate is never
materialised. Iteration-invariant state (XᵀX, means, own-species
projection) is computed once. ~2× wall and ~2× memory on the benchmark
suite; gains grow with N. - Streaming mutual-NN — coarsening streams per-species-pair blocks
directly into a CSR builder instead of materialising dense N × N products. - Batched correlation refinement — streams gene-pair batches
(defaultbatch_size=512); computes only the columns of the smoothed
expression matrix referenced per batch. Peak memory drops from
O(N × G_active) to O(N × 1024). ~4× less memory; ~3-5× slower on small
data where the full matrix fits — passbatch_size=Noneto opt out. - BFS neighbourhood expansion — numba BFS kernel replaces matrix-power
_smart_expand. ~5× faster at 3k cells, memory-bounded.
- Precomposed feature translation — projection precomposes
- Randomized SVD with implicit centering for sparse PCA — available
viasvd_solver="randomized"onsamap.sam.pca._pca_with_sparse. Faster
on GPU and at high PC counts; slightly different numerics. Default remains
ARPACK. - Phase-level benchmark suite —
benchmarks/bench_samap.pycompares
legacy vs optimized paths for each rewritten phase. docs/performance.md— memory model, backend selection, tuning, scaling
estimates.
Fixed
- Dead random-walk computation in
_mapper(result written then immediately
discarded; preserved only the binarization side effect). thr→align_thrkwarg misroute inanalysis.enrichment(was falling
through to an unrelated p-value threshold).- Deprecated
.Amatrix attribute →np.asarray()in several hot paths. - Stale root
setup.pyremoved (pyproject.toml is authoritative). - Broken
SAMGUIimport and deadgui()method removed. - Duplicated
_qhelper consolidated intosamap.utils.q. - Dead
mdata['xsim']store removed. __version__is now dynamic viaimportlib.metadata.
Changed
src/samap/core/mapping.pysplit into focused modules:homology.py,
correlation.py,projection.py,coarsening.py,expand.py. The
SAMAPclass remains inmapping.py; all existing imports work unchanged._refine_corr/_refine_corr_paralleldefaultbatch_sizechanged
fromNone(materialized) to512(streaming)._smart_expanddefaultlegacychanged fromTrue(matpow) to
False(BFS).- Golden regression fixture regenerated to reflect the BFS and streaming
defaults.