从基因型-表型图中提取进化轨迹的python包
gpvolve的Python项目详细描述
gpvolve
一个python包,用于从基因型-表型图中提取进化轨迹
用于基因型-表型空间进化模拟和分析的python api。 您可以使用此库:
- 从基因型-表型图建立马尔可夫状态模型。
- 使用pcca+找到代表系统亚稳态的基因簇。
- 利用过渡路径理论计算基因型对和/或感兴趣的簇之间的通量和路径。
- 将以上所有的输出可视化。
基本示例
从基因型-表型图建立马尔可夫模型。
# Import base class, Transition Path Theory class and functions for building Markov Model.fromgpvolveimportGenotypePhenotypeMSM,TransitionPathTheory,linear_skew,mccandlish,find_max# Import visualization tool.fromgpvolve.visualizationimportplot_network# Import GenotypePhenotypeMap class for handling genotype-phenotype data.fromgpmapimportGenotypePhenotypeMap# Helper functions.fromscipy.sparseimportdok_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 fluxesfig,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 .