campmc 0.1.0__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.
Files changed (58) hide show
  1. campmc-0.1.0/.github/workflows/ci.yml +62 -0
  2. campmc-0.1.0/.github/workflows/publish.yml +37 -0
  3. campmc-0.1.0/.gitignore +14 -0
  4. campmc-0.1.0/.pre-commit-config.yaml +42 -0
  5. campmc-0.1.0/.python-version +1 -0
  6. campmc-0.1.0/.readthedocs.yml +17 -0
  7. campmc-0.1.0/LICENSE +21 -0
  8. campmc-0.1.0/PKG-INFO +93 -0
  9. campmc-0.1.0/README.md +74 -0
  10. campmc-0.1.0/docs/_static/custom.css +5 -0
  11. campmc-0.1.0/docs/api/coreset.md +16 -0
  12. campmc-0.1.0/docs/api/index.md +32 -0
  13. campmc-0.1.0/docs/api/io.md +17 -0
  14. campmc-0.1.0/docs/api/metrics.md +14 -0
  15. campmc-0.1.0/docs/api/pl.md +15 -0
  16. campmc-0.1.0/docs/api/pp.md +14 -0
  17. campmc-0.1.0/docs/api/rare.md +15 -0
  18. campmc-0.1.0/docs/api/robustness.md +18 -0
  19. campmc-0.1.0/docs/api/tl.md +20 -0
  20. campmc-0.1.0/docs/conf.py +82 -0
  21. campmc-0.1.0/docs/index.md +48 -0
  22. campmc-0.1.0/docs/installation.md +36 -0
  23. campmc-0.1.0/docs/references.md +24 -0
  24. campmc-0.1.0/docs/tutorials/index.md +9 -0
  25. campmc-0.1.0/docs/tutorials/partition_pbmc68k.md +21 -0
  26. campmc-0.1.0/examples/partition_pbmc68k.py +16 -0
  27. campmc-0.1.0/pyproject.toml +96 -0
  28. campmc-0.1.0/src/campmc/__init__.py +13 -0
  29. campmc-0.1.0/src/campmc/_logging.py +13 -0
  30. campmc-0.1.0/src/campmc/coreset.py +54 -0
  31. campmc-0.1.0/src/campmc/io.py +31 -0
  32. campmc-0.1.0/src/campmc/metrics/__init__.py +5 -0
  33. campmc-0.1.0/src/campmc/metrics/quality.py +105 -0
  34. campmc-0.1.0/src/campmc/pl/__init__.py +5 -0
  35. campmc-0.1.0/src/campmc/pl/plots.py +45 -0
  36. campmc-0.1.0/src/campmc/pp/__init__.py +5 -0
  37. campmc-0.1.0/src/campmc/pp/preprocess.py +49 -0
  38. campmc-0.1.0/src/campmc/rare/__init__.py +5 -0
  39. campmc-0.1.0/src/campmc/rare/recovery.py +72 -0
  40. campmc-0.1.0/src/campmc/robustness/__init__.py +9 -0
  41. campmc-0.1.0/src/campmc/robustness/sweeps.py +93 -0
  42. campmc-0.1.0/src/campmc/tl/__init__.py +5 -0
  43. campmc-0.1.0/src/campmc/tl/assign/__init__.py +18 -0
  44. campmc-0.1.0/src/campmc/tl/assign/camp1.py +24 -0
  45. campmc-0.1.0/src/campmc/tl/assign/camp2.py +43 -0
  46. campmc-0.1.0/src/campmc/tl/assign/camp3.py +37 -0
  47. campmc-0.1.0/src/campmc/tl/assign/camp4.py +40 -0
  48. campmc-0.1.0/src/campmc/tl/partition.py +126 -0
  49. campmc-0.1.0/tests/conftest.py +21 -0
  50. campmc-0.1.0/tests/test_camp4.py +11 -0
  51. campmc-0.1.0/tests/test_coreset.py +34 -0
  52. campmc-0.1.0/tests/test_io.py +13 -0
  53. campmc-0.1.0/tests/test_metrics.py +16 -0
  54. campmc-0.1.0/tests/test_partition_blobs.py +42 -0
  55. campmc-0.1.0/tests/test_partition_pbmc.py +21 -0
  56. campmc-0.1.0/tests/test_pl.py +13 -0
  57. campmc-0.1.0/tests/test_rare.py +20 -0
  58. campmc-0.1.0/uv.lock +3240 -0
@@ -0,0 +1,62 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+ push:
7
+ branches: [main]
8
+ workflow_call:
9
+
10
+ concurrency:
11
+ group: ci-${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ pre-commit:
16
+ name: pre-commit / ${{ matrix.hook }}
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ hook:
22
+ - trailing-whitespace
23
+ - end-of-file-fixer
24
+ - check-yaml
25
+ - check-toml
26
+ - check-added-large-files
27
+ - ruff-check
28
+ - ruff-format
29
+ - complexipy
30
+ - ty
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+
34
+ - name: Install uv
35
+ uses: astral-sh/setup-uv@v6
36
+
37
+ - name: Set up Python
38
+ run: uv python install 3.12
39
+
40
+ - name: Install dependencies
41
+ run: uv sync --group dev
42
+
43
+ - name: Run ${{ matrix.hook }}
44
+ run: uvx pre-commit run ${{ matrix.hook }} --all-files --show-diff-on-failure
45
+
46
+ test:
47
+ name: pytest
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+
52
+ - name: Install uv
53
+ uses: astral-sh/setup-uv@v6
54
+
55
+ - name: Set up Python
56
+ run: uv python install 3.12
57
+
58
+ - name: Install dependencies
59
+ run: uv sync --group dev
60
+
61
+ - name: Run tests
62
+ run: uv run pytest -q
@@ -0,0 +1,37 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ ci:
12
+ uses: ./.github/workflows/ci.yml
13
+
14
+ publish:
15
+ name: Publish to PyPI
16
+ needs: ci
17
+ runs-on: ubuntu-latest
18
+ environment:
19
+ name: pypi
20
+ url: https://pypi.org/p/campmc
21
+ permissions:
22
+ id-token: write
23
+ contents: read
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v6
29
+
30
+ - name: Set up Python
31
+ run: uv python install 3.12
32
+
33
+ - name: Build
34
+ run: uv build
35
+
36
+ - name: Publish
37
+ run: uv publish
@@ -0,0 +1,14 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Sphinx
13
+ docs/_build/
14
+ docs/generated/
@@ -0,0 +1,42 @@
1
+ default_install_hook_types:
2
+ - pre-commit
3
+ - commit-msg
4
+
5
+ repos:
6
+ - repo: https://github.com/pre-commit/pre-commit-hooks
7
+ rev: v6.0.0
8
+ hooks:
9
+ - id: trailing-whitespace
10
+ - id: end-of-file-fixer
11
+ - id: check-yaml
12
+ - id: check-toml
13
+ - id: check-added-large-files
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.15.21
17
+ hooks:
18
+ - id: ruff-check
19
+ args: [--fix]
20
+ - id: ruff-format
21
+
22
+ - repo: local
23
+ hooks:
24
+ - id: complexipy
25
+ name: complexipy
26
+ entry: uv run complexipy
27
+ language: system
28
+ types: [python]
29
+ args: [--max-complexity-allowed=15]
30
+ require_serial: true
31
+
32
+ - repo: https://github.com/astral-sh/ty-pre-commit
33
+ rev: v0.0.58
34
+ hooks:
35
+ - id: ty
36
+ args: [--isolated]
37
+
38
+ - repo: https://github.com/compilerla/conventional-pre-commit
39
+ rev: v4.4.0
40
+ hooks:
41
+ - id: conventional-pre-commit
42
+ stages: [commit-msg]
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,17 @@
1
+ # version: 2
2
+ # Scanpy-style Read the Docs config (uv + sphinx-build)
3
+
4
+ build:
5
+ os: ubuntu-24.04
6
+ tools:
7
+ python: "3.12"
8
+ jobs:
9
+ create_environment:
10
+ - asdf plugin add uv
11
+ - asdf install uv latest
12
+ - asdf global uv latest
13
+ install:
14
+ - uv sync --group doc
15
+ build:
16
+ html:
17
+ - uv run sphinx-build -M html docs $READTHEDOCS_OUTPUT
campmc-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 danrongLi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
campmc-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: campmc
3
+ Version: 0.1.0
4
+ Summary: Third-party portable Python package for CAMP metacell partitioning (not the official paper repo)
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: anndata>=0.11
9
+ Requires-Dist: celltypist
10
+ Requires-Dist: matplotlib
11
+ Requires-Dist: numpy
12
+ Requires-Dist: pandas
13
+ Requires-Dist: scanpy>=1.10
14
+ Requires-Dist: scikit-learn
15
+ Requires-Dist: scipy
16
+ Requires-Dist: seaborn
17
+ Requires-Dist: seacells
18
+ Description-Content-Type: text/markdown
19
+
20
+ # CAMP (Coreset Accelerated Metacell Partitioning)
21
+
22
+ Third-party, installable Python reimplementation of the CAMP metacell methods for use with [AnnData](https://anndata.readthedocs.io/) and [Scanpy](https://scanpy.readthedocs.io/).
23
+
24
+ ## About this project
25
+
26
+ **This repository is not maintained by the authors of the CAMP paper.** It is an independent packaging effort that ports the research code from the upstream [CAMP](https://github.com/danrongLi/CAMP) repository into a reusable library (`import campmc as cp`, PyPI name **campmc**).
27
+
28
+ Goals of this project:
29
+
30
+ - Make CAMP1–4 and related helpers **portable** (no hardcoded cluster paths, scanpy-style API).
31
+ - Provide tests, documentation, and a normal Python package layout.
32
+
33
+ For the **official reference implementation**, paper benchmarks, and experiment scripts, use the upstream CAMP repository. Behavior here should match the published algorithms in spirit, but this package is maintained separately.
34
+
35
+ If you use the CAMP method, please cite the [bioRxiv preprint](https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1) (Li, Ko & Canzar, 2025; [doi:10.64898/2025.12.11.693725](https://doi.org/10.64898/2025.12.11.693725)) — see [Citation](#citation) below.
36
+
37
+ ## Install
38
+
39
+ ```bash
40
+ cd mycamp
41
+ uv sync --group dev
42
+ ```
43
+
44
+ ## Usage (scanpy-style)
45
+
46
+ ```python
47
+ import campmc as cp
48
+ import scanpy as sc
49
+
50
+ adata = sc.datasets.pbmc68k_reduced()
51
+ cp.tl.partition(adata, method="camp3", gamma=25, random_state=0)
52
+ cp.metrics.quality(adata, partition_key="camp", label_key="louvain")
53
+ ```
54
+
55
+ ## Documentation
56
+
57
+ Build HTML docs locally (same stack as [Scanpy](https://scanpy.readthedocs.io/): Sphinx, MyST, `scanpydoc` theme):
58
+
59
+ ```bash
60
+ uv sync --group doc
61
+ uv run sphinx-build -M html docs docs/_build
62
+ ```
63
+
64
+ ## Citation
65
+
66
+ If you use the CAMP method, please cite the preprint:
67
+
68
+ > Li, D., Ko, Y. K., & Canzar, S. (2025). CAMP: Coreset Accelerated Metacell Partitioning enables scalable analysis of single-cell data. *bioRxiv*. [https://doi.org/10.64898/2025.12.11.693725](https://doi.org/10.64898/2025.12.11.693725)
69
+
70
+ Preprint: [bioRxiv](https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1)
71
+
72
+ ```bibtex
73
+ @article{li2025camp,
74
+ title = {CAMP: Coreset Accelerated Metacell Partitioning enables scalable analysis of single-cell data},
75
+ author = {Li, Danrong and Ko, Young Kun and Canzar, Stefan},
76
+ journal = {bioRxiv},
77
+ year = {2025},
78
+ doi = {10.64898/2025.12.11.693725},
79
+ url = {https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1}
80
+ }
81
+ ```
82
+
83
+ This **campmc** package is a third-party implementation; citing the preprint refers to the CAMP method, not this repository.
84
+
85
+ ## Tests
86
+
87
+ ```bash
88
+ uv run pytest -q
89
+ ```
90
+
91
+ ## License
92
+
93
+ MIT — see [LICENSE](LICENSE). Algorithm code is adapted from the upstream [CAMP](https://github.com/danrongLi/CAMP) repository (MIT, © danrongLi). This **campmc** package is a separate third-party distribution; it is not affiliated with or endorsed by the original CAMP authors unless they state otherwise.
campmc-0.1.0/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # CAMP (Coreset Accelerated Metacell Partitioning)
2
+
3
+ Third-party, installable Python reimplementation of the CAMP metacell methods for use with [AnnData](https://anndata.readthedocs.io/) and [Scanpy](https://scanpy.readthedocs.io/).
4
+
5
+ ## About this project
6
+
7
+ **This repository is not maintained by the authors of the CAMP paper.** It is an independent packaging effort that ports the research code from the upstream [CAMP](https://github.com/danrongLi/CAMP) repository into a reusable library (`import campmc as cp`, PyPI name **campmc**).
8
+
9
+ Goals of this project:
10
+
11
+ - Make CAMP1–4 and related helpers **portable** (no hardcoded cluster paths, scanpy-style API).
12
+ - Provide tests, documentation, and a normal Python package layout.
13
+
14
+ For the **official reference implementation**, paper benchmarks, and experiment scripts, use the upstream CAMP repository. Behavior here should match the published algorithms in spirit, but this package is maintained separately.
15
+
16
+ If you use the CAMP method, please cite the [bioRxiv preprint](https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1) (Li, Ko & Canzar, 2025; [doi:10.64898/2025.12.11.693725](https://doi.org/10.64898/2025.12.11.693725)) — see [Citation](#citation) below.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ cd mycamp
22
+ uv sync --group dev
23
+ ```
24
+
25
+ ## Usage (scanpy-style)
26
+
27
+ ```python
28
+ import campmc as cp
29
+ import scanpy as sc
30
+
31
+ adata = sc.datasets.pbmc68k_reduced()
32
+ cp.tl.partition(adata, method="camp3", gamma=25, random_state=0)
33
+ cp.metrics.quality(adata, partition_key="camp", label_key="louvain")
34
+ ```
35
+
36
+ ## Documentation
37
+
38
+ Build HTML docs locally (same stack as [Scanpy](https://scanpy.readthedocs.io/): Sphinx, MyST, `scanpydoc` theme):
39
+
40
+ ```bash
41
+ uv sync --group doc
42
+ uv run sphinx-build -M html docs docs/_build
43
+ ```
44
+
45
+ ## Citation
46
+
47
+ If you use the CAMP method, please cite the preprint:
48
+
49
+ > Li, D., Ko, Y. K., & Canzar, S. (2025). CAMP: Coreset Accelerated Metacell Partitioning enables scalable analysis of single-cell data. *bioRxiv*. [https://doi.org/10.64898/2025.12.11.693725](https://doi.org/10.64898/2025.12.11.693725)
50
+
51
+ Preprint: [bioRxiv](https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1)
52
+
53
+ ```bibtex
54
+ @article{li2025camp,
55
+ title = {CAMP: Coreset Accelerated Metacell Partitioning enables scalable analysis of single-cell data},
56
+ author = {Li, Danrong and Ko, Young Kun and Canzar, Stefan},
57
+ journal = {bioRxiv},
58
+ year = {2025},
59
+ doi = {10.64898/2025.12.11.693725},
60
+ url = {https://www.biorxiv.org/content/10.64898/2025.12.11.693725v1}
61
+ }
62
+ ```
63
+
64
+ This **campmc** package is a third-party implementation; citing the preprint refers to the CAMP method, not this repository.
65
+
66
+ ## Tests
67
+
68
+ ```bash
69
+ uv run pytest -q
70
+ ```
71
+
72
+ ## License
73
+
74
+ MIT — see [LICENSE](LICENSE). Algorithm code is adapted from the upstream [CAMP](https://github.com/danrongLi/CAMP) repository (MIT, © danrongLi). This **campmc** package is a separate third-party distribution; it is not affiliated with or endorsed by the original CAMP authors unless they state otherwise.
@@ -0,0 +1,5 @@
1
+ /* CAMP docs — small tweaks on top of scanpydoc / sphinx-book-theme */
2
+
3
+ .bd-main .bd-content {
4
+ max-width: 60rem;
5
+ }
@@ -0,0 +1,16 @@
1
+ # Coreset
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.coreset
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ ```{eval-rst}
9
+ .. autosummary::
10
+ :nosignatures:
11
+ :toctree: ../generated/
12
+
13
+ coreset.compute_q
14
+ coreset.sample_coreset
15
+ coreset.gammas_to_m
16
+ ```
@@ -0,0 +1,32 @@
1
+ # API
2
+
3
+ Import CAMP as:
4
+
5
+ ```
6
+ import campmc as cp
7
+ ```
8
+
9
+ The API mirrors Scanpy’s module layout:
10
+
11
+ | Module | Role |
12
+ |--------|------|
13
+ | {mod}`campmc.pp` | Preprocessing (filter, normalize, HVG, PCA) |
14
+ | {mod}`campmc.tl` | Metacell partitioning (CAMP1–4) |
15
+ | {mod}`campmc.metrics` | Quality metrics on partitions |
16
+ | {mod}`campmc.rare` | Rare-cell recovery scores |
17
+ | {mod}`campmc.robustness` | HVG/PCA cache helpers for sweeps |
18
+ | {mod}`campmc.pl` | Plotting helpers |
19
+
20
+ ```{toctree}
21
+ :maxdepth: 2
22
+ :hidden:
23
+
24
+ pp
25
+ tl
26
+ coreset
27
+ io
28
+ metrics
29
+ rare
30
+ robustness
31
+ pl
32
+ ```
@@ -0,0 +1,17 @@
1
+ # I/O
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.io
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ Membership CSV read/write (compatible with upstream CAMP partition exports).
9
+
10
+ ```{eval-rst}
11
+ .. autosummary::
12
+ :nosignatures:
13
+ :toctree: ../generated/
14
+
15
+ io.write_membership
16
+ io.read_membership
17
+ ```
@@ -0,0 +1,14 @@
1
+ # Metrics
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.metrics
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ ```{eval-rst}
9
+ .. autosummary::
10
+ :nosignatures:
11
+ :toctree: ../generated/
12
+
13
+ metrics.quality
14
+ ```
@@ -0,0 +1,15 @@
1
+ # Plotting: `pl`
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.pl
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ ```{eval-rst}
9
+ .. autosummary::
10
+ :nosignatures:
11
+ :toctree: ../generated/
12
+
13
+ pl.metric_ecdf
14
+ pl.metric_lines
15
+ ```
@@ -0,0 +1,14 @@
1
+ # Preprocessing: `pp`
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.pp
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ ```{eval-rst}
9
+ .. autosummary::
10
+ :nosignatures:
11
+ :toctree: ../generated/
12
+
13
+ pp.preprocess
14
+ ```
@@ -0,0 +1,15 @@
1
+ # Rare-cell recovery
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.rare
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ ```{eval-rst}
9
+ .. autosummary::
10
+ :nosignatures:
11
+ :toctree: ../generated/
12
+
13
+ rare.identify_rare_types
14
+ rare.recovery_scores
15
+ ```
@@ -0,0 +1,18 @@
1
+ # Robustness
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.robustness
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ Cached preprocessing for HVG/PCA parameter sweeps.
9
+
10
+ ```{eval-rst}
11
+ .. autosummary::
12
+ :nosignatures:
13
+ :toctree: ../generated/
14
+
15
+ robustness.build_or_load_base_cache
16
+ robustness.build_or_load_hvg_pca_cache
17
+ robustness.run_hvg_pca_sweep
18
+ ```
@@ -0,0 +1,20 @@
1
+ # Tools: `tl`
2
+
3
+ ```{eval-rst}
4
+ .. module:: campmc.tl
5
+ .. currentmodule:: campmc
6
+ ```
7
+
8
+ Metacell partitioning (CAMP1–4). Writes labels to `adata.obs` and metadata to `adata.uns`.
9
+
10
+ ```{eval-rst}
11
+ .. autosummary::
12
+ :nosignatures:
13
+ :toctree: ../generated/
14
+
15
+ tl.partition
16
+ ```
17
+
18
+ ## Assigners (internal)
19
+
20
+ Lower-level assignment kernels live in {mod}`campmc.tl.assign` and are called from {func}`campmc.tl.partition`.
@@ -0,0 +1,82 @@
1
+ """Configuration for CAMP Sphinx documentation (scanpy / scverse style)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from importlib.metadata import version as get_version
7
+ from pathlib import Path
8
+
9
+ HERE = Path(__file__).parent
10
+ sys.path.insert(0, str(HERE.parent / "src"))
11
+
12
+ project = "campmc"
13
+ author = "CAMP contributors"
14
+ copyright = "2025, CAMP contributors"
15
+ version = get_version("campmc").replace(".dirty", "")
16
+ release = version
17
+
18
+ master_doc = "index"
19
+ templates_path = ["_templates"]
20
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
21
+
22
+ extensions = [
23
+ "myst_nb",
24
+ "sphinx_copybutton",
25
+ "sphinx.ext.autodoc",
26
+ "sphinx.ext.intersphinx",
27
+ "sphinx.ext.napoleon",
28
+ "sphinx.ext.autosummary",
29
+ "sphinx_autodoc_typehints",
30
+ "sphinx_design",
31
+ "scanpydoc",
32
+ ]
33
+
34
+ autosummary_generate = True
35
+ autodoc_typehints = "none"
36
+ autodoc_member_order = "bysource"
37
+ autodoc_default_options = {
38
+ "members": False,
39
+ "show-inheritance": True,
40
+ }
41
+
42
+ napoleon_google_docstring = False
43
+ napoleon_numpy_docstring = True
44
+ napoleon_use_rtype = True
45
+ napoleon_use_param = True
46
+
47
+ myst_enable_extensions = [
48
+ "colon_fence",
49
+ "deflist",
50
+ "dollarmath",
51
+ "html_admonition",
52
+ ]
53
+ myst_heading_anchors = 3
54
+ nb_output_stderr = "remove"
55
+
56
+ intersphinx_mapping = {
57
+ "python": ("https://docs.python.org/3", None),
58
+ "numpy": ("https://numpy.org/doc/stable/", None),
59
+ "pandas": ("https://pandas.pydata.org/docs/", None),
60
+ "anndata": ("https://anndata.readthedocs.io/en/stable/", None),
61
+ "scanpy": ("https://scanpy.readthedocs.io/en/stable/", None),
62
+ }
63
+
64
+ html_theme = "scanpydoc"
65
+ html_theme_options = {
66
+ "repository_url": "https://github.com/danrongLi/CAMP",
67
+ "repository_branch": "master",
68
+ "use_repository_button": True,
69
+ }
70
+ html_context = {
71
+ "github_user": "danrongLi",
72
+ "github_repo": "CAMP",
73
+ "github_version": "master",
74
+ }
75
+ html_static_path = ["_static"]
76
+ html_css_files = ["custom.css"]
77
+ html_show_sphinx = False
78
+ html_title = "campmc"
79
+
80
+
81
+ def setup(app):
82
+ return {"parallel_read_safe": True, "parallel_write_safe": True}
@@ -0,0 +1,48 @@
1
+ ```{include} ../README.md
2
+ :end-before: '## Tests'
3
+ ```
4
+
5
+ ```{note}
6
+ This documentation describes the **campmc** package — a third-party reimplementation. It is **not** the official site of the CAMP paper authors. See [upstream CAMP](https://github.com/danrongLi/CAMP) for the reference code and benchmarks.
7
+ ```
8
+
9
+ ::::{grid} 1 2 3 3
10
+ :gutter: 2
11
+
12
+ :::{grid-item-card} Installation {octicon}`plug;1em;`
13
+ :link: installation
14
+ :link-type: doc
15
+
16
+ Install `campmc` with uv and optional dev tools.
17
+ :::
18
+
19
+ :::{grid-item-card} Tutorials {octicon}`play;1em;`
20
+ :link: tutorials/index
21
+ :link-type: doc
22
+
23
+ Walk through metacell partitioning on built-in Scanpy datasets.
24
+ :::
25
+
26
+ :::{grid-item-card} API reference {octicon}`book;1em;`
27
+ :link: api/index
28
+ :link-type: doc
29
+
30
+ Detailed reference for `campmc.pp`, `campmc.tl`, and related modules.
31
+ :::
32
+
33
+ :::{grid-item-card} Upstream CAMP (official) {octicon}`mark-github;1em;`
34
+ :link: https://github.com/danrongLi/CAMP
35
+
36
+ Paper authors’ reference scripts and benchmarks — not this package.
37
+ :::
38
+ ::::
39
+
40
+ ```{toctree}
41
+ :hidden:
42
+ :maxdepth: 1
43
+
44
+ installation
45
+ tutorials/index
46
+ api/index
47
+ references
48
+ ```