Skip to main content

A python package for extracting tevolutionary trajectories from genotype-phenotype-maps

Project description

gpvolve

A python package for extracting tevolutionary trajectories from genotype-phenotype-maps

A Python API for the simulation and analysis of evolution in genotype-phenotype space. You can use this library to:

  1. Build a markov state model from a genotype-phenotype-map.
  2. Find clusters of genotypes that represent metastable states of the system, using PCCA+.
  3. Compute fluxes and pathways between pairs of genotypes and/or clusters of interest, using Transition Path Theory.
  4. Visualize the outputs of all of the above.

Basic Example

Build a Markov model from a genotype-phenotype map.

# Import base class, Transition Path Theory class and functions for building Markov Model.
from gpvolve import GenotypePhenotypeMSM, TransitionPathTheory, linear_skew, mccandlish, find_max

# Import visualization tool.
from gpvolve.visualization import plot_network

# Import GenotypePhenotypeMap class for handling genotype-phenotype data.
from gpmap import GenotypePhenotypeMap

# Helper functions.
from scipy.sparse import dok_matrix

# Genotype-phenotype map data.
wildtype = "AAA"
genotypes = ["AAA", "AAT", "ATA", "TAA", "ATT", "TAT", "TTA", "TTT"]
phenotypes = [0.8, 0.81, 0.88, 0.89, 0.82, 0.82, 0.95, 1.0]

# Instantiate Markov model class.
gpm = GenotypePhenotypeMap(wildtype=wildtype,
                            genotypes=genotypes,
                            phenotypes=phenotypes)


# Instantiate a evolutionary Markov State Model from the genotype-phenotype map.
gpmsm = GenotypePhenotypeMSM(gpm)

Apply an evolutionary model to describe transitions between genotypes.

# Map fitnesses to phenotypes.
gpmsm.apply_selection(fitness_function=linear_skew, selection_gradient=1)

# Build Markov State Model based on 'mccandlish' fixation probability function.
gpmsm.build_transition_matrix(fixation_model=mccandlish, population_size=100)

# Find global fitness peak.
fitness_peak = find_max(gpmsm=gpmsm, attribute='fitness')

Calculate and plot the fluxes between wildtype and triple mutant.

# Compute fluxes from wildtype to fitness peak.
fluxes = TransitionPathTheory(gpmsm, source=[0], target=[fitness_peak])

# Normalize flux.
norm_fluxes = fluxes.net_flux/fluxes.total_flux

# Plot the network and the fluxes
fig, ax = plot_network(gpmsm,
                        flux=dok_matrix(norm_fluxes),
                        edge_labels=True,
                        colorbar=True)

Install

To install from PyPI:

pip install gpvolve

To install a development version:

git clone https://github.com/harmslab/gpvolve
cd gpvolve
pip install  -e .

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

gpvolve-0.0.1.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

gpvolve-0.0.1-py2.py3-none-any.whl (24.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file gpvolve-0.0.1.tar.gz.

File metadata

  • Download URL: gpvolve-0.0.1.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for gpvolve-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ce8e0f24579f9ae3d7e358d7fb6febc26423790e5ab07b273e4a9e73a7076d96
MD5 53a48bc4c6df3623d77f4bee5d1cd967
BLAKE2b-256 b8c62d821fa7c2738dde7a47b5fff4c51cf50e02b1da4b4197679215be42ad80

See more details on using hashes here.

File details

Details for the file gpvolve-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: gpvolve-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for gpvolve-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ca33d6bdc3d159c76353e14695cc1486e8cbb189b143835409a1bcfbf0bce82d
MD5 3075fd078e2a6efcf1ad02b6765795d4
BLAKE2b-256 6e8c830e057532f43e11f416282a685e95dbbc73c2ca2d8900798a511353759c

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