Skip to main content

A python package to facilitate spatially explicit coalescent modeling in msprime

Project description

spaceprime

image image

Overview

spaceprime is a Python package that facilitates the creation and analysis of spatially gridded coalescent models in the msprime library. The package is designed to make it easier for practitioners to convert spatial maps of habitat suitability into extensible two-dimensional stepping-stone models of gene flow, where each pixel of the map represents a deme and demes are able to migrate with their neighbors. Demes and migration rates are able to change over time according to habitat suitability model projections. These demographic parameters are then used to simulate genetic data under a coalescent model with msprime as the simulator, which can be used to infer the demographic history of the population. The package is designed to be user-friendly and intuitive, allowing users to easily simulate and analyze spatially explicit genetic data.

This page provides an overview of the package and its main features. For more detailed information, please refer to the documentation.

Note for R users: spaceprime is coded in Python, yet many interested users may come from an R background. I have a spaceprime for R users vignette that provides a brief introduction to the Python concepts necessary to use spaceprime in a practical walk-through of an example analysis. Additionally, it is possible to use Python code in R using the reticulate package. For more information on how to use Python code in R, see the reticulate documentation.

Main features

spaceprime includes a number of features:

  • Convert habitat suitability values into demographic parameters, including deme sizes, migration rates, and their change through time using very little code. Code complexity does not increase with model complexity, allowing users to focus on the biological questions they are interested in.
  • Simulate spatially explicit genetic data under a coalescent model with msprime. The modeling approach is fully coalescent with no forward-time component, allowing for computationally efficient simulations of large spatially explicit models.
  • Visualize demographic models to facilitate model interpretation and model checking.
  • Compute genetic summary statistics for simulated and empirical data to facilitate comparison with empirical data.
  • Extensibility: spaceprime is designed to be interoperable with msprime, where users can setup a model with spaceprime, then customize it using the full range of msprime functionality.

Installation

Stable release

spaceprime can be installed using pip or conda. Due to the package's reliance on msprime, the pip installation is only available on unix-based systems (MacOS, Linux). Windows users should install spaceprime using conda.

To install spaceprime using pip, run the following command in your terminal:

pip install spaceprime

To install spaceprime using conda, run the following command in your terminal:

conda install -c conda-forge spaceprime

The mamba package manager can also be used to install spaceprime using conda. mamba tends to be much faster than conda. To install spaceprime using mamba, install mamba, then run the following command in your terminal:

mamba install -c conda-forge spaceprime

From source

To install spaceprime from source, run this command in your terminal:

pip install git+https://github.com/connor-french/spaceprime

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

spaceprime-0.0.4.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

spaceprime-0.0.4-py2.py3-none-any.whl (222.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file spaceprime-0.0.4.tar.gz.

File metadata

  • Download URL: spaceprime-0.0.4.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for spaceprime-0.0.4.tar.gz
Algorithm Hash digest
SHA256 286182feb9f2114435c544b61c2e351e612cdbca58faa0eb7e3d02c734d55f28
MD5 5792bdb8548cf9f1d16bec609df74622
BLAKE2b-256 5bfbd7f223c2803f558c86371791f713ffe8a62386244258b77bc2fdfd33fdc9

See more details on using hashes here.

File details

Details for the file spaceprime-0.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: spaceprime-0.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 222.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for spaceprime-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1a99a2028c979aa1197ad05818b030215184d443997efb09d9b2e4a2653fe9be
MD5 edf40816762561a493927897b518c635
BLAKE2b-256 f7c659a1658d4d56c5fa672c5c0b03b70f3e3bcdfa7db188e7b44fc2e19e138f

See more details on using hashes here.

Supported by

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