piu_mosso
più mosso: "more motion", faster. Fast single-cell utilities: FAISS nearest neighbours, a fast UMAP and Seurat v3 highly variable gene selection across several AnnDatas.
piu_mosso is free software, licensed under the GNU Lesser General Public License, version 3 or (at your option) any later version (LGPL-3.0-or-later). The LGPL builds on the GNU General Public License, version 3; LICENSE holds both texts.
Install
pip install piu-mosso
piu_mosso needs Python 3.11 or later.
For development, an editable install with the test dependencies (scanpy, pytest):
pip install -e ".[test]"
GPU nearest neighbours
piu_mosso depends on faiss-cpu. FAISS's GPU build, faiss-gpu-cu12, installs the same faiss module, so the two
cannot share an environment (importing faiss fails when both are installed). For GPU search, swap them:
pip uninstall faiss-cpu
pip install faiss-gpu-cu12
Then pass use_gpu=True to piu_mosso.knn or piu_mosso.pp.neighbors. The UMAP layout runs on the CPU; a GPU
layout is planned.
Usage
piu_mosso works on scanpy's AnnData objects and writes its results where scanpy does, so scanpy's other tools and plots use them unchanged.
import piu_mosso
import scanpy as sc
piu_mosso.pp.neighbors(adata, use_rep="X_pca") # FAISS neighbours and the UMAP graph, where scanpy keeps them
piu_mosso.tl.umap(adata) # spectral start, parallel layout; writes .obsm["X_umap"]
sc.pl.umap(adata, color="cell_type")
Seurat v3 highly variable genes over several datasets together, from raw counts, without concatenating them or loading them into memory:
import anndata as ad
adatas = [ad.read_h5ad(path, backed="r") for path in ["part1.h5ad", "part2.h5ad"]]
hvg = piu_mosso.highly_variable_genes(adatas, n_top_genes=2000, batch_key="sample")
genes = hvg.index[hvg["highly_variable"]]
The lower-level functions are piu_mosso.knn (nearest neighbours of an array), piu_mosso.umap_connectivities and
piu_mosso.knn_distance_matrix (scanpy's graph and distances from them) and piu_mosso.umap_embedding (the layout of
a graph). Their docstrings give the details.
Changes and citation
CHANGELOG.md lists the changes in each release. To cite piu_mosso, see CITATION.cff (GitHub's "Cite this repository" button reads it).
Tests
bash tests/run_tests.sh [pytest arguments] # in the active environment
Third-party code
src/piu_mosso/spectral.py holds a copy of umap-learn's spectral layout (umap/spectral.py, version 0.5.12), changed where marked "piu_mosso:". umap-learn is Copyright (c) 2017, Leland McInnes, under the BSD 3-Clause License; the full notice is at the top of that file.
src/piu_mosso/layout.py follows umap-learn's simplicial_set_embedding (umap/umap_.py) step by step, under the same licence.
src/piu_mosso/tl.py chooses the representation of a neighbour graph as scanpy's _choose_representation does (scanpy/tools/_utils.py), Copyright (c) 2025 scverse and Copyright (c) 2017 F. Alexander Wolf, P. Angerer, Theis Lab, under the BSD 3-Clause License.
piu_mosso.highly_variable_genes follows scanpy's Seurat v3 selection (scanpy/preprocessing/_highly_variable_genes.py), Copyright (c) 2025 scverse and Copyright (c) 2017 F. Alexander Wolf, P. Angerer, Theis Lab, under the BSD 3-Clause License; the full notice is in piu_mosso/hvg.py.
Metadata
Release files for piu-mosso 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| piu_mosso-0.1.0.tar.gz | 52.9 kB | Without provenance | Details for piu_mosso-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| piu_mosso-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for piu_mosso-0.1.0-py3-none-any.whl |
Total release size: 98.0 kB
Release files / piu_mosso-0.1.0.tar.gz
| Download URL | piu_mosso-0.1.0.tar.gz |
|---|---|
| Size | 52.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8476c2d1b98d22da94f66a2a6d6276cc3265117f0705cc71bf45d1146047160
|
|
BLAKE2b-256 checksum How to use checksums |
dafe5ceaff42bc3e8ee0829851dd2227cf95fb6eb90764c8fe584e4b97cc0a1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / piu_mosso-0.1.0-py3-none-any.whl
| Download URL | piu_mosso-0.1.0-py3-none-any.whl |
|---|---|
| Size | 45.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44b61712074d8c5f9c904f60fbd12838fc6cf68a57754374d18f4496b04d9bfd
|
|
BLAKE2b-256 checksum How to use checksums |
06a127c96cf83ea86d24d7529144ee20f53e7213f2a505ac94055be171b9cc18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for piu-mosso 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.