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:
- Build a markov state model from a genotype-phenotype-map.
- Find clusters of genotypes that represent metastable states of the system, using PCCA+.
- Compute fluxes and pathways between pairs of genotypes and/or clusters of interest, using Transition Path Theory.
- 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 trajectory flux between the 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 .
Metadata
Release files for gpvolve 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gpvolve-0.2.0.tar.gz | 1.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gpvolve-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 1.7 MB
Release files / gpvolve-0.2.0.tar.gz
| Download URL | gpvolve-0.2.0.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ee0acc929e999f52b22376f3dc51625fcedf908c78f15a580b41dd5407b271b
|
|
BLAKE2b-256 checksum How to use checksums |
eaff2251a47019db56b9601c6cb32c6cfdba0810dd60c8b04530ea72591fb3bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7
|
Release files / gpvolve-0.2.0-py2.py3-none-any.whl
| Download URL | gpvolve-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 33.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6085af7aa667d4f00b2553a48b386bb61d7bbf0f493675965e3182b57dd9d4ec
|
|
BLAKE2b-256 checksum How to use checksums |
55e72ed2e89ff9e1dd80c872c7eed8af2e50c02f710b85f32624fe10feee7cb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7
|