跳转到主要内容

从基因-表型映射中提取进化轨迹的Python包

项目描述

gpvolve

从基因-表型映射中提取进化轨迹的Python包

一个用于模拟和分析基因型-表型空间进化的Python API。您可以使用这个库来

  1. 从基因型-表型映射中构建马尔可夫状态模型。
  2. 使用PCCA+找到代表系统亚稳态的基因型簇。
  3. 使用过渡路径理论计算感兴趣基因型对之间的通量和路径。
  4. 可视化上述所有输出。

基本示例

从基因型-表型映射中构建马尔可夫模型。

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

应用进化模型来描述基因型之间的转变。

# 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')

计算并绘制野生型和三倍突变体之间的轨迹通量。

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

安装

从PyPI安装

pip install gpvolve

安装开发版本

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

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

gpvolve-0.2.0.tar.gz (1.6 MB 查看哈希值)

上传时间

构建分布

gpvolve-0.2.0-py2.py3-none-any.whl (33.0 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面