Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ Computations use CuPy and NVIDIA RAPIDS for performance on large datasets.
- **GPU acceleration**: Common single-cell workflows on `AnnData` run on the GPU.
- **Ecosystem compatibility**: Works with Scanpy APIs; includes pieces from Squidpy, decoupler, and pertpy.
- **Simple installation**: Available via Conda and PyPI.
- **Version-matched agent skill**: Released pip packages include an analysis skill for Codex, Claude, and other agents.

## Agent skill

Released packages include the matching model-neutral analysis skill:

```bash
rapids-singlecell-install-skills --agent codex
rapids-singlecell-install-skills --agent claude
rapids-singlecell-install-skills --agent claude-science # or: --agent agents
rapids-singlecell-check-kernel # before starting Jupyter
```

Use `--dest /path/to/skills/rapids-singlecell` for another agent. See the
[installation guide](https://rapids-singlecell.readthedocs.io/en/latest/installation.html#agent-skill)
for installation and preflight details.

## Documentation

Expand Down
45 changes: 45 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,51 @@ Use multiple architectures when building portable binaries (e.g., for a shared c
The `-real` suffix generates device code only (no PTX fallback), which reduces binary size.
```

## Agent skill

Released packages contain a matching model-neutral analysis skill. Copy it to
an agent's personal skill directory after installing RSC:

```bash
rapids-singlecell-install-skills --agent codex
rapids-singlecell-install-skills --agent claude
rapids-singlecell-install-skills --agent claude-science
rapids-singlecell-install-skills --agent agents
rapids-singlecell-install-skills --dest /other/skills/rapids-singlecell
```

`--check` compares the installed copy with the bundle in the active package;
`--force` replaces a differing copy. `--print-path` prints the bundled source.
For Claude Science, the installer resolves the active organization from
`~/.claude-science/active-org.json`.

```bash
rapids-singlecell-install-skills --check --agent codex
```

Before starting Jupyter, verify RMM, GPU/CUDA execution, the RSC import, native
extensions, and a representative RSC kernel:

```bash
rapids-singlecell-check-kernel
rapids-singlecell-check-kernel --mode managed # planned oversubscription
```

The preflight is disposable; configure RMM again at the start of the notebook.

### Bootstrap from a standalone skill

If RSC is not installed, create a fresh environment from the matching canonical
definition on `main`:

- [CUDA 12](https://github.com/scverse/rapids_singlecell/blob/main/conda/rsc_rapids_26.04_cuda12.yml)
- [CUDA 13](https://github.com/scverse/rapids_singlecell/blob/main/conda/rsc_rapids_26.04_cuda13.yml)

```bash
CONDA_CHANNEL_PRIORITY=flexible mamba env create --name rsc \
--file /path/to/rsc_rapids_26.04_cuda13.yml
```

## Docker

We also offer Docker containers for `rapids-singlecell`. These containers include all the necessary dependencies, making it even easier to get started with `rapids-singlecell`.
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ license = { file = "LICENSE" }
authors = [ { name = "Severin Dicks" } ]
readme = { file = "README.md", content-type = "text/markdown" }
dynamic = [ "version" ]
scripts.rapids-singlecell-install-skills = "rapids_singlecell_skills.install:main"
scripts.rapids-singlecell-check-kernel = "rapids_singlecell_skills.kernel:main"

dependencies = [
"anndata>=0.10.0",
Expand Down Expand Up @@ -152,7 +154,7 @@ local_scheme = "node-and-date"
version-file = "src/rapids_singlecell/_version.py"

[tool.hatch.build.targets.wheel]
packages = [ "src/rapids_singlecell", "src/testing" ]
packages = [ "src/rapids_singlecell", "src/rapids_singlecell_skills", "src/testing" ]
exclude = [ "**/*.cu", "**/*.cuh", "**/*.h" ]

[tool.hatch.build.targets.wheel.hooks.scikit-build]
Expand Down
2 changes: 2 additions & 0 deletions src/rapids_singlecell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from . import dcg, get, gr, pp, ptg, tl
from ._version import __version__

__all__ = ["dcg", "get", "gr", "pp", "ptg", "tl"]


def _detect_duplicate_installation():
"""Warn if multiple rapids_singlecell variants are installed."""
Expand Down
4 changes: 3 additions & 1 deletion src/rapids_singlecell/dcg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from .decoupler_gpu import *
from .decoupler_gpu import aucell, mlm, ulm, waggr, zscore

__all__ = ["aucell", "mlm", "ulm", "waggr", "zscore"]
2 changes: 2 additions & 0 deletions src/rapids_singlecell/get/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
# Aggregation imports preprocessing modules that use the names exported above.
# isort: split
from ._aggregated import aggregate

__all__ = ["X_to_CPU", "X_to_GPU", "aggregate", "anndata_to_CPU", "anndata_to_GPU"]
4 changes: 3 additions & 1 deletion src/rapids_singlecell/gr.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from .squidpy_gpu import *
from .squidpy_gpu import calculate_niche, co_occurrence, ligrec, spatial_autocorr

__all__ = ["calculate_niche", "co_occurrence", "ligrec", "spatial_autocorr"]
49 changes: 48 additions & 1 deletion src/rapids_singlecell/pp.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
from __future__ import annotations

from .preprocessing import *
from .preprocessing import (
bbknn,
calculate_qc_metrics,
filter_cells,
filter_genes,
harmony_integrate,
highly_variable_genes,
log1p,
neighbors,
normalize_pearson_residuals,
normalize_total,
pca,
regress_out,
scale,
scrublet,
scrublet_simulate_doublets,
sqrt,
)
from .preprocessing import (
filter_highly_variable as filter_highly_variable,
)
from .preprocessing import (
flag_gene_family as flag_gene_family,
)

__all__ = [
"bbknn",
"calculate_qc_metrics",
"filter_cells",
"filter_genes",
"harmony_integrate",
"highly_variable_genes",
"log1p",
"neighbors",
"normalize_pearson_residuals",
"normalize_total",
"pca",
"regress_out",
"scale",
"scrublet",
"scrublet_simulate_doublets",
"sqrt",
]

__deprecated_exports__ = {
"filter_highly_variable": "Deprecated; do not use in new analyses.",
"flag_gene_family": "Deprecated; do not use in new analyses.",
}
2 changes: 2 additions & 0 deletions src/rapids_singlecell/preprocessing/_neighbors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ def bbknn(
of a symmetrical matrix of connectivities.
n_pcs
Use this many PCs. If `n_pcs==0` and `use_rep is None`, use `.X`.
batch_key
Key in `adata.obs` containing the batch labels to balance. Required.
use_rep
Use the indicated representation. `'X'` or any key for `.obsm` is valid.
If `None`, the representation is chosen automatically: For `.n_vars < 50`, `.X`
Expand Down
2 changes: 1 addition & 1 deletion src/rapids_singlecell/preprocessing/_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def calculate_qc_metrics(
layer: str = None,
) -> None:
"""\
Calculates basic qc Parameters :cite:p:`McCarthy2017`.
Calculate basic quality-control metrics :cite:p:`McCarthy2017`.

Calculates number of genes per cell (n_genes) and number of counts per cell (n_counts).
Loosely based on calculate_qc_metrics from scanpy :cite:p:`Wolf2018`. Updates :attr:`~anndata.AnnData.obs` and :attr:`~anndata.AnnData.var` with columns with qc data.
Expand Down
36 changes: 35 additions & 1 deletion src/rapids_singlecell/ptg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
from __future__ import annotations

from .pertpy_gpu import *
from .pertpy_gpu import (
Distance,
GuideAssignment,
Mixscale,
Mixscape,
)
from .pertpy_gpu import (
MeanVar as MeanVar,
)

__all__ = ["Distance", "GuideAssignment", "Mixscale", "Mixscape"]

__deprecated_exports__ = {
"MeanVar": "Deprecated; do not use in new analyses.",
}

# Public class members are part of the installed API contract used by agent tooling.
# Keep these in sync with docs/api/pertpy_gpu.md.
__api_members__ = {
"Distance": [
"__call__",
"pairwise",
"onesided_distances",
"contrast_distances",
"create_contrasts",
"bootstrap",
],
"GuideAssignment": [
"assign_by_threshold",
"assign_to_max_guide",
"assign_mixture_model",
],
"Mixscale": ["perturbation_signature", "mixscale"],
"Mixscape": ["perturbation_signature", "mixscape", "lda"],
}
41 changes: 40 additions & 1 deletion src/rapids_singlecell/tl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
from __future__ import annotations

from .tools import *
from .tools import (
diffmap,
draw_graph,
embedding_density,
ingest,
leiden,
louvain,
pca,
rank_genes_groups,
score_genes,
score_genes_cell_cycle,
tsne,
umap,
)
from .tools import (
kmeans as kmeans,
)
from .tools import (
rank_genes_groups_logreg as rank_genes_groups_logreg,
)

__all__ = [
"diffmap",
"draw_graph",
"embedding_density",
"ingest",
"leiden",
"louvain",
"pca",
"rank_genes_groups",
"score_genes",
"score_genes_cell_cycle",
"tsne",
"umap",
]

__deprecated_exports__ = {
"kmeans": "Deprecated; do not use in new analyses.",
"rank_genes_groups_logreg": rank_genes_groups_logreg.__deprecated__,
}
1 change: 1 addition & 0 deletions src/rapids_singlecell_skills/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Agent-skill tools bundled with RAPIDS-singlecell."""
Loading
Loading