Metadata-Version: 2.4
Name: cafe-cellxgene
Version: 0.0.1
Summary: Non-invasive CAFE launcher for cellxgene
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# cafe-cellxgene

CAFE trajectory visualization and analysis tools in a floating CELLxGENE plugin
window. The CLI launches a patched runtime copy (overlay), leaving the installed
CELLxGENE source unchanged. Compatibility still depends on the host version.

![cafe-cellxgene](docs/images/cafe-cellxgene.png)

## 📋 Current features

| Module | Available now |
| --- | --- |
| Plot | Main-panel trajectory overlay and synchronized preview; shared Preference setting for solid milestone nodes, labels, fixed-palette colors, node size, edge width/color and arrow size; static plots |
| Data | Prior information, trajectory history, embeddings, cache import and exports; optional AnnData-Web validation card |
| Method | Method/runtime selection, parameter forms, job status/logs/cancellation and result visualization; availability depends on installed runtimes |
| Explorer | Explicit pseudotime Spearman benchmark with a reference/root; Downstream Analysis groups Driver Gene, GRN, Enrichment and Pathway views |
| Agent | **Local Preview** of stored structure, metrics and limitations; not a reasoning agent or autonomous analysis workflow |

New trajectory/benchmark results are kept in the live session. Export them from
Data when needed; the input `.h5ad` is not automatically overwritten. Downstream
cards do not imply a complete GRN, enrichment or pathway workflow is implemented.

## 🔧 Quick start

Use Python 3.10+ with working CELLxGENE and Cafe installations in the same
environment. These dependencies are not installed by this launcher. For stored
trajectory visualization, use a Cafe/FateAnnData `.h5ad` with trajectory results.

Install this plugin from the repository in that environment:

```bash
# Source checkout: Node.js/npm required once to generate release assets.
npm --prefix client ci
npm --prefix client run build
python -m pip install -e .
```

### 1. Command line: launch a saved dataset

```bash
cafe-cellxgene launch /path/to/dataset.h5ad --port 5006
```

Open [localhost:5006](http://localhost:5006/) and click **Cafe Plugins**.
The installed launcher uses the bundled assets. Installing a prebuilt wheel does
not require Node.js; a fresh Git clone needs the build above. Normal CELLxGENE
launch options are passed through.

### 2. Python / Notebook: launch an existing FateAnnData

Use a Cafe version supporting `wait=False` in the notebook kernel environment:

```python
import cafe

# fadata is an existing cafe.data.FateAnnData with trajectory results.
# If its trajectory has no saved UMAP projection, prepare it once:
cafe.plot.plot_trajectory(fadata, basis="X_umap", color="clusters")

server = fadata.launch_cellxgene(
    use_cellxgene_cafe=True, port=5020, wait=False, open_browser=False,
    conda_env=None,  # use the current kernel's environment
)
# Open http://localhost:5020/ and click Cafe Plugins.

# Run separately after browsing:
server.terminate()
server.wait()
```

Choose `basis` and `color` from your own data (the example uses `X_umap` and
`clusters`). Startup returns only after HTTP readiness. The unique temporary
snapshot is removed after stopping; browser changes do not write back to `fadata`.

## ⚙️ Development

```bash
# In WSL/Linux, from the repository root
conda activate cafe
test -f .env || cp .env.example .env
bash scripts/dev.sh
```

Set `CELLXGENE_SOURCE_ROOT`, `CELLXGENE_CONDA_ENV` and `CELLXGENE_DATASET` in
`.env`, following [.env.example](.env.example). Development also needs Node.js/npm and a CELLxGENE
source checkout. Open backend port **5006**, not frontend asset ports **3100/3101**;
these defaults avoid the legacy application's **5005/3000/3001** ports. Existing
port conflicts are reported rather than force-killed by default.

Unlike the overlay CLI, `dev.sh` patches/copies files into the configured host
checkout. Use a dedicated development checkout. See [Development](docs/development.md)
for source launches, tests, packaging and launcher options.

## 📚 Project guide

- [Architecture and directories](ARCHITECTURE.md): folder responsibilities and `cafe_cellxgene` vs `server`
- [Development](docs/development.md): commands, asset synchronization and troubleshooting
- [Performance](docs/performance.md): startup/API measurement and troubleshooting
- [Release](docs/releasing.md): tagged PyPI publishing and authentication setup
- [Documentation index](docs/README.md): current user and developer guides
