# This program implements a simple 2-node boolean network, and computes transitions from all possible states of the network (4 of them). # The Boolean update equations for the 2 nodes (gene_0 and gene_1) are: # gene_0 = NOT gene_1 # gene_1 = gene_0 AND gene_1 # Below is the set of all possible states of 2-gene boolen network # For your 10-gene network, you have to create this list of all possible states programmatically. DO NOT hard-code them. possible_states = [(False, False), (False, True), (True, False), (True, True)] ## One way to automatically generate the set of all possible states in as follows: # possible_states = [(x, y) for x in [False, True] for y in [False, True]] ## Alternatively, you may also use the packages 'itertools': http://docs.python.org/2/library/itertools.html#itertools.product for (i, j) in possible_states: genes = [i, j] updated_genes = [False, False] # initially set to some default value, which will then get updated in the loop below # Below, I have created my own simple boolean expressions. You have to use the expressions given in the paper # Gene0 = NOT Gene1 # Gene1 = Gene0 AND Gene1 # state of the network = [value of Gene 0, value of Gene 1] updated_genes[0] = not genes[1] # Boolean expression for updating gene 1 updated_genes[1] = genes[0] and genes[1] # Boolean expression for updating gene 2 print (genes, '===>', updated_genes)