# campmc

**campmc** is a third-party, Scanpy-style Python package for [CAMP](https://github.com/danrongLi/CAMP) metacell partitioning on [AnnData](https://anndata.readthedocs.io/) objects.

Online documentation: [campmc.readthedocs.io](https://campmc.readthedocs.io/en/latest/)

```{note}
This site documents the **campmc** package — an independent port for portable use with Scanpy.
It is **not** the official documentation of the CAMP paper authors.
For the reference implementation and paper benchmarks, see [upstream CAMP](https://github.com/danrongLi/CAMP).
```

## Quick start

```{eval-rst}
.. exec-jupyter::

 import campmc as cp
 import scanpy as sc
 adata = sc.datasets.pbmc68k_reduced()
 cp.partition(adata, method="camp3", gamma=50, random_state=0)
 cp.mt.quality(adata, partition_key="camp", label_key="louvain")[["metacell_id", "size", "purity"]].head()
```

For raw counts, run {func}`campmc.preprocess` first so ``obsm['X_pca']`` is available.

::::{grid} 1 2 2 4
:gutter: 2

:::{grid-item-card} Installation {octicon}`plug;1em;`
:link: installation
:link-type: doc

Install with `pip install campmc` (or from a clone for development).
:::

:::{grid-item-card} User guide {octicon}`book;1em;`
:link: user_guide
:link-type: doc

Workflow overview, CAMP1–4 methods, and AnnData keys.
:::

:::{grid-item-card} Tutorials {octicon}`play;1em;`
:link: tutorials/index
:link-type: doc

Walk through partitioning on Scanpy example datasets.
:::

:::{grid-item-card} API reference {octicon}`list-unordered;1em;`
:link: api/index
:link-type: doc

Functions in `pp`, `tl`, `mt`, and related modules.
:::

::::

```{toctree}
:hidden:
:maxdepth: 1

installation
user_guide
tutorials/index
api/index
references
```
