ARGscape: interactive ARG visualization and analysis
Project description
ARGscape (v0.3.0) is a comprehensive web application for visualizing and analyzing tree sequences (representing Ancestral Recombination Graphs, or ARGs). Built with React and FastAPI, it aims to provide an intuitive web interface, powerful computational backend, and simple command-line interface for spatiotemporal population genetics research.
๐ Live Demo: www.argscape.com (May be blocked on some networks - working on it!)
Features
Core
- File upload & management: Upload and visualize
.trees/.tsztree sequences - Tree sequence simulation: Generate data with
msprimedirectly in the app - Interactive visualization:
- 2D ARG (forceโdirected)
- 3D spatial ARG (for sequences with spatial coordinates)
- Spatial diff (compare two spatial sequences)
- Spatial inference: Estimate locations for internal nodes from genealogical signal
- Session storage: Persistent perโclient storage with autoโcleanup
- Export: Download processed tree sequences and rendered images
Visualization details
- 2D ARG: pan/zoom, node IDs, edge spans, optional sample ordering strategies
- 3D spatial ARG: geographic grid, temporal planes, adjustable node/edge styles
- Filtering: by genomic position, by tree index, and over time (temporal planes)
Session management
Files are stored in a perโclient session (locally at dev_storage/ in development) for up to 24h. You can download outputs any time and remove files manually.
Advanced
- Multiple files per session
- Light/dark theme and custom color accents
- Spatial diff view (two spatial sequences)
Visualization Gallery
2D Network Visualization
Interactive force-directed layouts showing genealogical relationships with node IDs and genomic spans.
Genomic Filtering
Navigate through specific genomic regions using the interactive slider.
3D Spatial Visualization
Three-dimensional rendering of spatially-embedded tree sequences with geographic context.
Temporal Filtering
Explore different time periods using the temporal slider controls.
Quick start
Option 1: Use the Live Website
Visit argscape.com to start visualizing tree sequences immediately - no installation required. Storage space and computational power is extremely limited. Please refer to Option 2 below for more intensive uses.
Option 2: Local installation (recommended)
Install ARGscape locally for better performance and offline use:
Prerequisites
- Anaconda, Miniconda, or another Conda distribution (Download here)
Installation Steps
-
Download the environment file:
- Visit argscape.com/install and click "Download environment.yml"
- Or download directly from GitHub
-
Navigate to the download folder:
cd /path/to/your/folder
-
Create the ARGscape environment:
conda env create -f environment.yml
Installation takes 5-15 minutes depending on your connection.
-
Activate the environment:
conda activate argscape_env
-
Launch ARGscape:
argscape
-
Open in browser: ARGscape opens automatically at http://127.0.0.1:8000. Wait 2-3 minutes for startup, then refresh if needed.
Commandโline options
argscape [--host HOST] [--port PORT] [--reload] [--no-browser] [--no-tsdate]
# Options:
# --host HOST Host to run the server on (default: 127.0.0.1)
# --port PORT Port to run the server on (default: 8000)
# --reload Enable auto-reload for development
# --no-browser Don't automatically open the web browser
# --no-tsdate Disable tsdate temporal inference (enabled by default)
Troubleshooting
- Conda not found? Check PATH or use Anaconda Prompt (Windows)
- Package conflicts? Add
--force-reinstallflag to conda command - Web interface not loading? Wait 2-3 minutes, then refresh browser
Option 3: Local development
Prerequisites
- Node.js 20+ and npm
- Python 3.11+ with conda/mamba
- Git
Setup
-
Clone the repository:
git clone https://github.com/chris-a-talbot/argscape.git cd argscape
-
Backend setup:
# Create and activate conda environment conda env create -f argscape/backend/environment.yml conda activate argscape # Install the package in development mode pip install -e . # Start the backend server uvicorn argscape.backend.main:app --reload --port 8000
-
Frontend setup (in new terminal):
cd frontend npm install npm run dev
-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API docs: http://localhost:8000/docs
Option 4: Docker development
# Clone and start the development environment
git clone https://github.com/chris-a-talbot/argscape.git
cd argscape
docker compose up --build
The Docker setup provides a complete development environment with hot-reloading for both frontend and backend. Access at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API docs: http://localhost:8000/docs
Note: The Docker setup mounts your local code directories, so changes to the code will be reflected immediately in the running containers.
API reference
Interactive API docs are served at /docs when running locally, and at the production /docs endpoint when hosted. The OpenAPI schema documents endpoints for upload, simulation, inference, visualization data, and session management.
Commandโline tools (v0.3.0)
ARGscape 0.3.0 includes a set of CLI tools for running the backend and performing inference from the terminal.
-
argscapeโ start the web app (API + UI)- Examples:
argscape --no-browser(local server at http://127.0.0.1:8000)argscape --host 0.0.0.0 --port 8000argscape --no-tsdate(disable temporal inference to speed startup)
- Examples:
-
argscape_inferโ run spatial/temporal inference- Subcommands:
loadโ load a.treesfile into persistent session storagerunโ run an inference method and save the output.trees- (no subcommand) โ interactive mode to pick file/method/output
- Methods:
midpoint,fastgaia,gaia-quadratic,gaia-linear,sparg,tsdate - Examples:
argscape_infer load --file /path/data.trees --name demoargscape_infer run --name demo --method midpoint --output ./outargscape_infer run --input /path/data.trees --method tsdate --output ./out
- Subcommands:
-
argscape_loadโ manage persistent session storage- Subcommands:
loadโ load a.treesfile:argscape_load load --file /path/data.trees --name demolistโ list stored names:argscape_load listrmโ remove by name:argscape_load rm --name democlearโ remove all files from the CLI session:argscape_load clearload-with-locationsโ load.treesand apply CSV locations:argscape_load load-with-locations \ --file /path/data.trees \ --sample-csv /path/sample_locations.csv \ --node-csv /path/node_locations.csv \ --name demo \ --output ./out
CSVs must include columns:node_id,x,y[,z]. Samples must cover all sample node IDs; node CSV must cover all internal node IDs.
- Subcommands:
Notes
- Session storage is keyed per client; the above commands use a stable CLI session so data is available to both the web UI and CLI.
- In 0.3.0 the visualization snapshot command (
argscape_vis) is temporarily disabled while itโs stabilized.
Development
Project structure
argscape/
โโโ argscape/ # Python package
โ โโโ __init__.py # Package version (__version__)
โ โโโ cli.py # argscape (server launcher)
โ โโโ spatial_cli.py # argscape_infer (CLI inference)
โ โโโ load_cli.py # argscape_load (storage management)
โ โโโ vis_cli.py # (disabled in v0.3.0)
โ โโโ frontend_dist/ # Built frontend (served by FastAPI)
โ โโโ backend/ # Backend app
โ โโโ main.py # FastAPI app with API + static mount
โ โโโ constants.py # DEFAULT_API_VERSION, tunables
โ โโโ session_storage.py # Persistent session storage
โ โโโ location_inference.py # FastGAIA/GAIA/midpoint wrappers
โ โโโ midpoint_inference.py # Midpoint algorithm
โ โโโ sparg_inference.py # SPARG algorithm integration
โ โโโ temporal_inference.py # tsdate integration
โ โโโ spatial_generation.py # Spatial data generation helpers
โ โโโ graph_utils.py # Graph conversion utilities
โ โโโ dev_storage_override.py # Dev storage path override
โ โโโ environment.yml # Conda env (reference)
โ โโโ Dockerfile # Backend container
โ โโโ geo_utils/ # Geographic tools & data
โ โโโ tskit_utils/ # Tree sequence IO helpers
โโโ frontend/ # React (Vite) web app
โ โโโ src/
โ โ โโโ components/ # UI & visualization components
โ โ โโโ context/ # React contexts
โ โ โโโ hooks/ # Custom hooks
โ โ โโโ lib/ # API client & helpers
โ โ โโโ config/ # App config
โ โโโ public/ # Static assets
โ โโโ package.json
โโโ dev_storage/ # Local persisted sessions (ignored in prod)
โโโ pyproject.toml # Build config (version 0.3.0)
โโโ package.json # Root npm config (version 0.3.0)
โโโ docker-compose.yml # Dev containers
โโโ Dockerfile # Root container (if used)
โโโ railway.toml # Railway deployment
โโโ README.md
File formats
Supported inputs
.trees: Standard tskit tree sequence format.tsz: Compressed tree sequence format
Generated outputs
- Tree sequences with updated inferred locations or node ages
- Visualization data
Performance notes
- File Size: Recommended < 100MB per upload
- Samples: Optimal performance with < 1000 nodes
- Sessions: Automatic cleanup after 24 hours (including on local hosting, for now)
Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/new-feature) - Follow clean code principles
- Add tests for new functionality
- Submit pull request
License
This project is licensed under the MIT License.
Citation
Acknowledgments
- tskit development team for testing, feedback, and the
tskittree sequence simulation and analysis tools - Michael Grundler and the Bradburd Lab for funding, support, testing, feedback, and the
gaiaalgorithms - James Kitchens and the Coop Lab for testing, feedback, and the
spargalgorithm - Philipp Messer and the Messer Lab for continued support
Support
- ๐ Website: www.argscape.com
- ๐ API Docs: Available at
/docsendpoint - ๐ Issues: GitHub Issues for bug reports
- ๐ฌ Discussions: GitHub Discussions for questions
Note: This is research software under active development. The API may change between versions. Data is stored temporarily and may be cleared during updates.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argscape-0.3.0.tar.gz.
File metadata
- Download URL: argscape-0.3.0.tar.gz
- Upload date:
- Size: 741.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d605b398111a8c82778b380eecf96923d90ae44ba9ce7faeec3c294f5b180589
|
|
| MD5 |
9c42cb6bf3bf26ec6b465ee8af6a8734
|
|
| BLAKE2b-256 |
4d8ebf094621b9c37870cd2ef8586c8ddfc8892b7dffde11f0f23248b0550ab7
|
File details
Details for the file argscape-0.3.0-py3-none-any.whl.
File metadata
- Download URL: argscape-0.3.0-py3-none-any.whl
- Upload date:
- Size: 753.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a4f781111705c132cdc62f6d3417a94df997237e6ad02cffed8d59f5f8fdb66
|
|
| MD5 |
531b5406ddb6efe664d5d84c21974ab3
|
|
| BLAKE2b-256 |
80547332b8b2ab1c9263a52e40c35164a566c72c49df6c47e9da5643ef447e18
|