Closed crptcusco closed 3 years ago
i don't understand anything you write
i update the question
can you use code formatting? I can read anything.
now the code is okey.
1) if you want to find all attractors for a network in which all constants are replaced by inputs (see 3.4.4 input combinations, p.39), use the example given in the reference for create_inputs
(p.63):
constants = find_constants(primes)
create_inputs(primes, constants)
stg = StateTransitionGraphs.primes2stg(primes, "synchronous")
attractors = Attractors.compute_attractors_tarjan(stg)
You can also use input_combinations
if you want to group by "signals":
constants = find_constants(primes)
create_inputs(primes, constants)
for signal in input_combinations(primes, "dict"):
print("signal: {}".format(signal))
primes_modified = create_constants(primes, signal, Copy=True)
stg = StateTransitionGraphs.primes2stg(primes_modified, "synchronous")
steadystates, cyclic = Attractors.compute_attractors_tarjan(stg)
2) explain what you mean with "the variables of the previous prime remain". Add print(list(l_primes[v_cont].keys()))
to you program and show me the output.
the output of print(list(l_primes[v_cont].keys()))
is :
['v1', 'v2', 'v3', 'v4', 'v5', 'v6', 'v7', 'v8']
in the Boolean Network 1 and
['v1', 'v10', 'v11', 'v12', 'v13', 'v2', 'v3', 'v6', 'v7', 'v8', 'v9']
in the Boolean Network 2
but v1, v2, v3 must not exist in the Boolean network 2, this is the mean of "the variables of the previous prime remain", because the Networks only have 5 variables and 3 constants = 8 variables , i attach the files of the description of the network and the output of the program.
The file rdda2_r3_v5.txt
does contain the variables v1, v2
and v3
. They are used by the update function of v10
. A network needs to define all its variables. How would you define v1
, v2
and v3
? PyBoolNet assumes that they are inputs, defined by
v1, v1
v2, v2
v3, v3
escuse me , i pass the wrong file rdda2_r3_v5.txt , now it is working well , but i dont understand why in the output of Attractors.compute_attractors_tarjan(stg)
have [] in blank. i attach again the files of the description of the network and the output of the program.
Have one form to order the output variables in the atractors ['v1', 'v11', 'v12', 'v13', 'v14', 'v15', 'v2', 'v3']
like ['v1', 'v2', 'v3', 'v11', 'v12', 'v13', 'v14', 'v15']
. I want recognized in this order.
have you read the documentation for Attractors.compute_attractors_tarjan(stg)
? It returns two objects, the steady states and the cyclic attractors. It should be called like this:
steadystates, cyclic = Attractors.compute_attractors_tarjan(stg)
Oh thats rigth , it have two list one for steady states and other for the cyclic attractors , thanks you very much. The problem has been solved, now I can find the attractors of several different Boolean networks, I leave the code with which it worked.
#IMPORTS
import PyBoolNet
#import sys
from PyBoolNet import Attractors
from PyBoolNet import PrimeImplicants
from PyBoolNet import StateTransitionGraphs
from itertools import product
from os import listdir
#route of the Boolean Network files ( in bnet format)
v_path = "files/rddas_r3_v5/"
#save the name of each Boolean Network file
list_directory = listdir(v_path)
l_primes =[]
v_cont = 0
#for every Boolean Network file, we find the attractors
for bnet in list_directory:
print (v_path + bnet)
primes = PyBoolNet.FileExchange.bnet2primes(v_path + bnet)
l_primes.append(primes)
l_signals_acoplament = PrimeImplicants.find_constants(l_primes[v_cont])
v_num_signal_acoplament = len(l_signals_acoplament)
#create and modify a static variables
for v_permutacion in product(list('01'), repeat=v_num_signal_acoplament):
v_cont_signal = 0
l_added_variables = []
print(v_permutacion)
for v_signal_value in zip(l_signals_acoplament,v_permutacion):
PrimeImplicants.create_variables(l_primes[v_cont], { v_signal_value[0] : v_signal_value[1]})
v_cont_signal = v_cont_signal + 1
stg = StateTransitionGraphs.primes2stg(l_primes[v_cont], "synchronous")
l_attractors = Attractors.compute_attractors_tarjan(stg)
#print (l_attractors)
for v_atrator in l_attractors:
print (v_atrator)
#for v_atrator in l_attractors:
# print (v_atrator)
print(list(l_primes[v_cont].keys()))
v_cont = v_cont + 1
print ("-------------------------")
Let me know how you are using PyBoolNet in the future. I am happy to make suggestions and help if I can.
Escuse Me, hklarner
I want to create several boolean networks in the same script. But when trying this the variables of the previous prime remain. I perceive this when I try to calculate the attractors, they have more states. The code I am using is below. Thanks