This python package aims to be a Gene Regulatory Network Graph generator that is fully customizable parameters such as sparsity, directed graphs, weight of edges, type of system (binary or spin) and etc.
Aug 23: Work in progress
- take a dict or list of lists as input and converting them to graphs
- take a graph as an input to the system
In the terminal, type:
pip install grnpy
In the code, import grnpy and the class BoltzmannGRN
from grnpy import BoltzmannGRN
Generates a graph based on the parameters :
- n - int - number of nodes
- sparsity - float - define the sparsity of the graph (1 being sparse, and 0 being dense) [0,1]
- on_p - float - the probability of a node being on at the beginning [0,1]
- directed - bool - if the graph is directed
returns graph
Generates an edge weight matrix
- size - int - size of the graph
- weight - defined set weight of the graph (going to be removed or chagned in later versions)
returns np array
Generates the h value at timestep t for node i
returns H_{i,t}
returns probability of a node being at state "1"
returns p
Updates the state of all nodes in G
returns NONE
returns the state of node n in graph G returns state(node)
For each timestep, iterate through all nodes in G and update their state
- timestep - int - number of timesteps to be updated
- size - int - size of the graph
- G - nx.Graph - Graph of nodes
- field - float - constant that is added as a probablity
- time - list - list of timesteps
- states_mean - list - mean state value across timesteps
- list_states - list - list of list containing the specific states of each node for each timestep
returns time, states_mean, list_states
shows plot of state transitions
Define the model
BoltzmannModel = BoltzmannGRN(size, gene_start_probability, weight, sparsity, directed, 'binary')
Define the graph
BoltzmannGraph = BoltzmannModel.graph
Drawing the graph
nx.draw(BoltzmannGraph)
plt.show()
Run the state transition model
time, states_mean, states = BoltzmannModel.update(size, BoltzmannGraph, 100, field)