Stellar atlas

From swaruplab/operon · View interactive version

Stellar atlas is an AI agent skill from the GitHub repository swaruplab/operon. Build deployable interactive web atlases from single-cell RNA-seq data using STELLAR. Turns a .h5ad (or Seurat .rds) into a UMAP + gene-expression + DE + hdWGCNA + CellChat + Milo + enrichment + AI-chat browser SPA. Covers the four-step CLI (init → ingest → build-frontend → serve/deploy), all six bu

How to use this skill

Skill file

STELLAR-Atlas: Deployable Interactive Single-Cell Browsers

Overview

STELLAR packages a single-cell dataset into a self-contained web app: UMAP scatter, gene expression overlay, per-cell-type violins, plus optional modules for differential expression, hdWGCNA co-expression modules, CellChat communication, Milo neighbourhood differential abundance, EnrichR pass-through, and a Claude-powered chat (with optional PubMed lookup). The reference deployment is swaruplab.bio.uci.edu/panad_atlas/ (~3M cells).

Tech stack under the hood:

The stellar.yaml config file declares which modules are enabled, where their input data lives, the project branding, and (for the Copilot module) API keys.

When to Use This Skill

Not for: real-time interactive analysis (it's a viewer, not a re-clusterer); raw data exploration before QC; datasets that aren't yet annotated.

Prerequisites

# Install
pip install 'stellar-atlas[full]'   # all modules
# OR pick what you need:
pip install 'stellar-atlas[de,hdwgcna,copilot]'

Module extras:

| Extra | What it adds |

|---|---|

| [de] | Differential expression viewer (volcano + sortable table) |

| [hdwgcna] | Co-expression modules + hub-gene radial network + optional DME |

| [cellchat] | Pathway heatmap + L-R table + group delta |

| [milo] | Beeswarm-on-UMAP of neighbourhood DA + table |

| [enrichment] | Live EnrichR pass-through |

| [copilot] | Claude chat with auto-discovered tools + optional PubMed |

| [full] | All modules + dev deps |

Quick Start — 5 Commands

# 1. Scaffold a new atlas project
stellar init my_atlas

# 2. Edit stellar.yaml — point at your .h5ad, enable modules, add branding
# (See "Configuration" below.)

# 3. Build the data stores (LanceDB + DuckDB + parquet)
stellar ingest

# 4. Verify everything is wired correctly
stellar doctor
# Expected: "stellar doctor: 0 issues — your project is healthy."

# 5. Serve locally
stellar serve
# → http://127.0.0.1:18901/my_atlas/

For a working end-to-end on PBMC 3K (~3 min first run):

pip install 'stellar-atlas[dev]' scanpy
python examples/pbmc_3k/bootstrap.py                                # writes data/raw/pbmc_3k.h5ad
stellar ingest --config examples/pbmc_3k/stellar.yaml
stellar doctor --config examples/pbmc_3k/stellar.yaml
stellar serve  --config examples/pbmc_3k/stellar.yaml

Configuration — `stellar.yaml`

stellar init writes a starter stellar.yaml. The structure (abbreviated):

project:
  name: my_atlas             # used in the URL path
  display_name: "My Atlas"   # shown in the SPA header
  description: "Brain atlas — 1.2M cells across 18 donors"

input:
  matrix:
    type: h5ad               # h5ad | rds
    path: data/raw/dataset.h5ad
  obsm_umap: X_umap          # which obsm key holds the UMAP
  layer: X                   # which layer to serve as expression

  groupings:                 # cell-type / cluster columns shown in the SPA
    - cell_type
    - cluster

  donors_column: donor       # for per-donor stratification

modules:
  de:
    enabled: true
    source_dir: data/external/de        # comparisons.parquet + results.parquet

  hdwgcna:
    enabled: true
    source_dir: data/external/hdwgcna   # modules.parquet, hubs.parquet, kme.parquet

  cellchat:
    enabled: true
    source_dir: data/external/cellchat  # 4 parquets, extracted from cellchat .rds

  milo:
    enabled: false

  enrichment:
    enabled: true                       # No source — calls EnrichR live

  copilot:
    enabled: true
    api_key_env: ANTHROPIC_API_KEY      # required at runtime
    pubmed_email_env: NCBI_EMAIL        # optional, for PubMed lookup

The full schema is auto-generated from the Pydantic models in the package; run stellar init --schema to print it.

Module-by-Module — What Goes In, What Shows Up

`core` — always on

`de` — differential expression viewer

`hdwgcna` — co-expression modules

`cellchat` — communication

`milo` — neighbourhood differential abundance

`enrichment` — live EnrichR

`copilot` — Claude chat

Full per-module spec including exact column types and validation rules: references/modules.md.

Ingest, Doctor, Serve, Deploy

stellar ingest [--config stellar.yaml] [--matrix MATRIX_NAME]
stellar doctor [--config stellar.yaml]
stellar serve [--config stellar.yaml] [--port 18901]
stellar build-frontend [--config stellar.yaml]
stellar deploy --target /var/www/html/my_atlas [--config stellar.yaml]

See references/deploy.md for production deployment patterns (nginx, systemd, Docker).

Converting Existing Analysis Outputs to STELLAR Parquets

The trickiest part of adopting STELLAR is exporting your existing analyses into the parquet shapes each module expects. Each script is small but specific to the source tool.

# Convert Seurat DE (FindMarkers output) → comparisons + results parquets
Rscript scripts/seurat_de_to_parquet.R --rds annotated.rds --out data/external/de/

# Convert hdWGCNA Seurat → 3 parquets
Rscript scripts/hdwgcna_to_parquet.R --rds seurat_hdwgcna.rds --out data/external/hdwgcna/

# Convert CellChat .rds → 4 parquets
Rscript scripts/cellchat_to_parquet.R --rds cellchat.rds --out data/external/cellchat/

# Convert milopy / miloR results → 3 parquets
Rscript scripts/milo_to_parquet.R --rds milo_results.rds --out data/external/milo/

These ship with the STELLAR repo under scripts/converters/. The hdwgcna and cellchat exporters consume outputs from the corresponding Operon protocols (protocols/hdwgcna, protocols/cellchat).

Best Practices

End-to-End Template

assets/stellar_template.sh is a shell script that sets up a new atlas project: downloads/locates the input .h5ad, runs the optional Seurat→h5ad conversion, writes a starter stellar.yaml, runs ingest + doctor + serve.

Convenience Scripts

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.