Skip to main content

ARGscape: interactive ARG visualization and analysis

Project description

ARGscape Banner

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!)

ARGscape Homepage

Features

Core

  • File upload & management: Upload and visualize .trees / .tsz tree sequences
  • Tree sequence simulation: Generate data with msprime directly 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.

2D ARG Visualization

Genomic Filtering

Navigate through specific genomic regions using the interactive slider.

Genomic Slider

3D Spatial Visualization

Three-dimensional rendering of spatially-embedded tree sequences with geographic context.

3D ARG Visualization

Temporal Filtering

Explore different time periods using the temporal slider controls.

Temporal Slider

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

  1. Download the environment file:

  2. Navigate to the download folder:

    cd /path/to/your/folder
    
  3. Create the ARGscape environment:

    conda env create -f environment.yml
    

    Installation takes 5-15 minutes depending on your connection.

  4. Activate the environment:

    conda activate argscape_env
    
  5. Launch ARGscape:

    argscape
    
  6. 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-reinstall flag 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

  1. Clone the repository:

    git clone https://github.com/chris-a-talbot/argscape.git
    cd argscape
    
  2. 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
    
  3. Frontend setup (in new terminal):

    cd frontend
    npm install
    npm run dev
    
  4. Access the application:

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:

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 8000
      • argscape --no-tsdate (disable temporal inference to speed startup)
  • argscape_infer โ€“ run spatial/temporal inference

    • Subcommands:
      • load โ€“ load a .trees file into persistent session storage
      • run โ€“ 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 demo
      • argscape_infer run --name demo --method midpoint --output ./out
      • argscape_infer run --input /path/data.trees --method tsdate --output ./out
  • argscape_load โ€“ manage persistent session storage

    • Subcommands:
      • load โ€“ load a .trees file: argscape_load load --file /path/data.trees --name demo
      • list โ€“ list stored names: argscape_load list
      • rm โ€“ remove by name: argscape_load rm --name demo
      • clear โ€“ remove all files from the CLI session: argscape_load clear
      • load-with-locations โ€“ load .trees and 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.

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

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/new-feature)
  3. Follow clean code principles
  4. Add tests for new functionality
  5. Submit pull request

License

This project is licensed under the MIT License.

Citation

Acknowledgments

  • tskit development team for testing, feedback, and the tskit tree sequence simulation and analysis tools
  • Michael Grundler and the Bradburd Lab for funding, support, testing, feedback, and the gaia algorithms
  • James Kitchens and the Coop Lab for testing, feedback, and the sparg algorithm
  • Philipp Messer and the Messer Lab for continued support

Support

  • ๐ŸŒ Website: www.argscape.com
  • ๐Ÿ“– API Docs: Available at /docs endpoint
  • ๐Ÿ› 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

argscape-0.3.0.tar.gz (741.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

argscape-0.3.0-py3-none-any.whl (753.4 kB view details)

Uploaded Python 3

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

Hashes for argscape-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d605b398111a8c82778b380eecf96923d90ae44ba9ce7faeec3c294f5b180589
MD5 9c42cb6bf3bf26ec6b465ee8af6a8734
BLAKE2b-256 4d8ebf094621b9c37870cd2ef8586c8ddfc8892b7dffde11f0f23248b0550ab7

See more details on using hashes here.

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

Hashes for argscape-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a4f781111705c132cdc62f6d3417a94df997237e6ad02cffed8d59f5f8fdb66
MD5 531b5406ddb6efe664d5d84c21974ab3
BLAKE2b-256 80547332b8b2ab1c9263a52e40c35164a566c72c49df6c47e9da5643ef447e18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page