Metadata-Version: 2.4
Name: cell_search
Version: 0.0.1
Summary: A library for a cell search app that helps users find similar cells in an embedding based on a growing suite of feature sets.
Keywords: cell-search,neuroscience,embedding,dash,visualization
Author: Leila Elabbady
Author-email: Leila Elabbady <leila.elabbady@alleninstitute.org>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Dist: caveclient>=8.0.1
Requires-Dist: chardet<6
Requires-Dist: cloud-volume>=12.12.1
Requires-Dist: dash>=4.0.0
Requires-Dist: imageryclient>=1.0.4
Requires-Dist: matplotlib>=3.10.8
Requires-Dist: nglui>=4.7.1
Requires-Dist: pandas>=2.3.3
Requires-Dist: pyperclip>=1.11.0
Requires-Dist: scikit-learn>=1.7.2
Requires-Dist: seaborn>=0.13.2
Requires-Dist: dash-connectivity-viewer
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/lelabbady/cell_search_app
Project-URL: Repository, https://github.com/lelabbady/cell_search_app
Project-URL: Documentation, https://lelabbady.github.io/cell_search/
Project-URL: Issues, https://github.com/lelabbady/cell_search_app/issues
Description-Content-Type: text/markdown

# Cell Search

A Python package for finding similar cells in embedding space and launching an interactive Dash interface for exploration.

## Installation

### From PyPI

```bash
pip install cell_search
```

### From Source (development)

This repository uses uv for dependency management and poe for tasks.

```bash
uv sync
```

## Deployment

This package can run as a standalone local app, in Docker, or embedded in a Flask host application.

## Execution Modes

This package supports three execution modes via the app factory in `src/cell_search/app.py`:

1. **Standalone (local)**: `create_dash_app(data_path=None)` launched by `scripts/Cell_Search_App.py`.
2. **Docker deployment**: `create_dash_app(data_path=None)` launched in a containerized environment.
3. **Embedded in dash_on_flask**: `create_app(name, config=None, server=None, ...)` integrates as a registered Dash app within a multi-app Flask host.

## Standalone (Local)

```bash
# Optional: set custom parquet path
export CELL_SEARCH_DATA_PATH=/absolute/path/to/microns_SomaData_AllCells_v661.parquet

# Optional: set CAVE token for CAVE/Neuroglancer operations
export CAVE_TOKEN=<your-token>

# Run standalone app
uv run python scripts/Cell_Search_App.py
```

Default URL: `http://localhost:8050`

## Docker Deployment

```bash
export CAVE_TOKEN=<your-token>
docker compose up --build
```

Default URL: `http://localhost:8050`

If your data file is not in the repository default location, set:

```bash
export CELL_SEARCH_DATA_PATH=/absolute/path/to/microns_SomaData_AllCells_v661.parquet
```

before launching Docker.

## Embedded in dash_on_flask (Local POC)

Use this mode when validating integration with a multi-app Flask host.

1. In dash_on_flask, add `cell_search.create_app` into `DASH_DATASTACK_SUPPORT` for the target datastack.
2. Install this package into the dash_on_flask environment from PyPI:

```bash
pip install cell_search
```

3. Provide runtime environment in dash_on_flask:

```bash
export CELL_SEARCH_DATA_PATH=/data/microns_SomaData_AllCells_v661.parquet
export CAVE_TOKEN=<your-token>
```

4. Launch dash_on_flask and visit:

`/dash/datastack/<datastack>/apps/cell_search/`

For local proof-of-concept environments using middle_auth_client, `AUTH_DISABLED=true` is often used.

## Development

### Setup

```bash
uv sync
```

### Jupyter

```bash
poe lab
```

### Running Tests

```bash
poe test
```

### Building Documentation

```bash
poe doc-preview
```

### Versioning

```bash
# Dry run to see what will change
poe drybump patch

# Actually bump the version
poe bump patch  # or minor, or major
```



## Profiling

```bash
# Profile with scalene (CPU + memory)
poe profile-all <your script>

# Profile with pyinstrument (CPU only, nicer output)
poe profile <your script>
```

## License

MIT License - see LICENSE file for details.
