Skip to main content

ARGscape: interactive ARG visualization and analysis

Project description

ARGscape Banner

ARGscape is a visualization and analysis toolkit for ancestral recombination graphs (ARGs) encoded as tree sequences. Use it as a Python library in Jupyter notebooks, as a command-line tool, or through the web application.

import argscape
import msprime

ts = msprime.sim_ancestry(samples=10, sequence_length=1e4, recombination_rate=1e-8)
viz = argscape.visualize(ts)
viz.show()  # Opens interactive visualization in browser

Links

Installation

Python Package (Recommended)

# Basic installation (visualization only)
pip install argscape

# With spatial inference support
# Requires spatial dependencies pre-installed
# Conda installation recommended - see below
pip install argscape[spatial]

Conda Environment (Full Features)

For the complete toolkit including all inference methods:

# Download environment file from GitHub or argscape.com/install
conda env create -f environment.yml
conda activate argscape_local

Quick Start

Python API

import argscape

# Load and visualize a tree sequence
ts = tskit.load("example.trees")
viz = argscape.visualize(ts)
viz.display()  # Jupyter notebook
viz.show()     # Browser
viz.export("figure.png", dpi=300)  # Export

# Run spatial inference
result = argscape.infer(ts, method="fastgaia")
result.ts  # Tree sequence with inferred locations

Web Application

# Start the web app locally
argscape serve

# Or visit argscape.com for the hosted version

Command Line

# Run inference from terminal
argscape infer run --input data.trees --method fastgaia --output ./results

Features

Visualization

Feature Description
2D Force Graph Interactive force-directed ARG layout with D3.js
3D Spatial Geographic visualization with Three.js for spatially-embedded data
Themes Four built-in themes: liquid, tskit, paper, grayscale
Custom Colors Override any theme color for publication figures
Filtering Genomic range and temporal filtering with interactive sliders
Export PNG, SVG, and PDF export at custom DPI

Spatial Inference

Estimate ancestral locations from sample coordinates:

Method Description Speed
midpoint Weighted midpoint of descendants Fast
fastgaia Fast GAIA algorithm Fast
gaia-quadratic GAIA with quadratic cost Medium
gaia-linear GAIA with linear cost Medium
# Infer locations and visualize in 3D
result = argscape.infer(ts, method="fastgaia")
viz = argscape.visualize(result.ts, mode="spatial_3d")
viz.show()

Interactive Controls

When using .show() or .display(show_controls=True):

Control Key Description
Nodes N Adjust sizes, toggle labels
Edges E Width and opacity
Mutations M Toggle markers
Layout L Sample ordering, spacing
Theme T Switch themes
Stats I View ARG statistics
Export X Save visualization

Gallery

2D Network Visualization

2D ARG Visualization

3D Spatial Visualization

3D ARG Visualization

CLI Reference

argscape - Web Application

argscape [--port PORT] [--no-browser] [--no-tsdate]

argscape infer - Spatial Inference

# Interactive mode
argscape infer

# Direct execution
argscape infer run --input data.trees --method fastgaia --output ./results

# Session management
argscape infer load --file data.trees --name mydata
argscape infer list

argscape load - Session Storage

argscape load load --file data.trees --name mydata
argscape load list
argscape load rm --name mydata

Development

# Clone repository
git clone https://github.com/chris-a-talbot/argscape.git
cd argscape

# Backend
conda env create -f argscape/api/environment.yml
conda activate argscape_local
pip install -e .
uvicorn argscape.api.main:app --reload --port 8000

# Frontend (separate terminal)
cd frontend && npm install && npm run dev

Citation

If you use ARGscape in your research, please cite:

Talbot, C., & Bradburd, G. (2025). ARGscape: A modular, interactive tool for manipulation of spatiotemporal ancestral recombination graphs. arXiv. https://arxiv.org/abs/2510.07255

License

MIT License

Acknowledgments

  • tskit team for the tree sequence toolkit and feedback
  • Bradburd Lab for funding, support, and the GAIA algorithms
  • James Kitchens and Coop Lab for testing and the SPARG and spacetrees algorithms
  • Messer Lab for continued support

Documentation: argscape.com/docs | Issues: GitHub

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.7.1.tar.gz (54.8 MB view details)

Uploaded Source

Built Distribution

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

argscape-0.7.1-py3-none-any.whl (55.0 MB view details)

Uploaded Python 3

File details

Details for the file argscape-0.7.1.tar.gz.

File metadata

  • Download URL: argscape-0.7.1.tar.gz
  • Upload date:
  • Size: 54.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for argscape-0.7.1.tar.gz
Algorithm Hash digest
SHA256 b49fa97090e82365ab8a927933a85059b66262dd28946d8a3ffdf2f89d9aa9d8
MD5 704da3ba2dbdddc2617adce383cffc98
BLAKE2b-256 ba379fbd75a85744e646b513385f53194165433a46f044c3dd6cfe02b793ab9c

See more details on using hashes here.

File details

Details for the file argscape-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: argscape-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 55.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for argscape-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0154bd72d6e4b50da3a8369fdaed7923af7d29b8ead64b90b6f2b249cfb256c0
MD5 d94cdc761b3d62cd3714b9c306252be9
BLAKE2b-256 8403b658a814e6da59f46f56ed78a8458d242975cd8dad094d26664d2677dd5d

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