动力学图分析工具
项目描述
动力学图分析
Python包,用于使用T.L. Hill开发的图示方法分析生化动力学图。
警告:此软件处于动态变化中,且API不稳定。
示例
KDA具有许多功能,所有功能都从定义系统的连接和反应速率(如有需要)开始。这是通过构建一个NxN
数组来完成的,其中对角线值设为零,非对角线值(i, j)
代表状态i
和j
之间的连接(和反应速率)。如有需要,这些可以是边权重(表示为kij
),但它们可以稍后指定。
以下是一个具有所有节点连接的简单3状态模型的示例
import numpy as np
import networkx as nx
from kda import graph_utils, calculations
# define matrix with reaction rates set to 1
K = np.array(
[
[0, 1, 1],
[1, 0, 1],
[1, 1, 0],
]
)
# initialize an empty graph object
G = nx.MultiDiGraph()
# populate the edge data
graph_utils.generate_edges(G, K, val_key="val", name_key="name")
# calculate the state probabilities
state_probabilities = calculations.calc_state_probs(G, key="val")
# get the state probabilities in expression form
state_probability_str = calculations.calc_state_probs(G, key="name", output_strings=True)
# print results
print("State probabilities: \n", state_probabilities)
print("State 1 probability expression: \n", state_probability_str[0])
上述示例的输出
$ python example_script.py
State probabilities:
[0.33333333 0.33333333 0.33333333]
State 1 probability expression:
(k21*k31 + k21*k32 + k23*k31)/(k12*k23 + k12*k31 + k12*k32 + k13*k21 + k13*k23 + k13*k32 + k21*k31 + k21*k32 + k23*k31)
正如预期的那样,状态概率是相等的,因为所有边权重都设置为1。
继续前面的示例,KDA的diagrams
和plotting
模块可以用来显示导致上述概率表达式的图
import os
from kda import diagrams, plotting
# generate the set of directional diagrams for G
directional_diagrams = diagrams.generate_directional_diagrams(G)
# get the current working directory
cwd = os.getcwd()
# specify the positions of all nodes in NetworkX fashion
node_positions = {0: [0, 1], 1: [-0.5, 0], 2: [0.5, 0]}
# plot and save the input diagram
plotting.draw_diagrams(G, pos=node_positions, path=cwd, label="input")
# plot and save the directional diagrams as a panel
plotting.draw_diagrams(
directional_diagrams,
pos=node_positions,
path=cwd,
cbt=True,
label="directional_panel",
)
这将在您的当前工作目录中生成两个文件,input.png
和directional_panel.png
input.png
directional.png
注意:更多示例(如下所示)请访问KDA 示例仓库
安装
从源码开发版本
要从源码安装最新开发版本,请运行
git clone git@github.com:Becksteinlab/kda.git
cd kda
python setup.py install
版权
版权所有(c)2020,Nikolaus Awtrey
致谢
本项目基于计算分子科学 Python Cookiecutter版本1.2。
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
kda-0.3.0.tar.gz (74.6 kB 查看哈希值)
构建分发
kda-0.3.0-py3-none-any.whl (64.9 kB 查看哈希值)
关闭
kda-0.3.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f11e69f175f4548f3e1e987bb943546a7785cc30cbc44d5c0461837b56c6efa5 |
|
MD5 | 61364b1f6bfe2df21bc4f5efe66fd36a |
|
BLAKE2b-256 | f3e51fb1952561f1bec1208eaa0c4f91ebbcde3fe3a37823d20e3ec3c5b0fc88 |
关闭
kda-0.3.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 14e144928e82379fb401e47a4d2a6a8aaf996d69f1eab7ecde92cd772e0142a6 |
|
MD5 | 071a296198d6cdd7796d9180c697e4e2 |
|
BLAKE2b-256 | 90d8436e0e94eced0248718e4a79b96fd52f9a2dff7ea006d9aae820c5d84279 |