jcrozum / pystablemotifs

Python library for attractor identification and control in Boolean networks
MIT License
28 stars 7 forks source link

Complex attractor not displayed correctly #97

Open kyuhyongpark opened 2 months ago

kyuhyongpark commented 2 months ago
import pystablemotifs as sm

rules='''
n0, !n0 & n2 | n0 & !n2 | n0 & n2
n1, !n3 & !n4 | !n3 & n4 | n3 & !n4
n2, !n0 & !n1 | n0 & !n1 | n0 & n1
n3, !n4 & !n5
n4, !n3 & !n5
n5, !n5 & !n0 | n5 & n0
'''

primes = sm.format.create_primes(rules)

sm.format.pretty_print_prime_rules(primes)
print()

ar = sm.AttractorRepertoire.from_primes(primes, max_simulate_size=200)

ar.summary()

Outcome

n0* = n2 | n0
n1* = !n4 | !n3
n2* = !n1 | n0
n3* = !n4 & !n5
n4* = !n3 & !n5
n5* = !n0 & !n5 | n0 & n5

There are 4 attractors.
{'n0': 0, 'n1': 1, 'n2': 0, 'n3': '0', 'n4': '1', 'n5': '0'}

{'n0': 1, 'n1': 1, 'n2': 1, 'n3': 0, 'n4': 0, 'n5': 1}

{'n0': 1, 'n1': 1, 'n2': 1, 'n3': 1, 'n4': 0, 'n5': 0}

{'n0': 1, 'n1': 1, 'n2': 1, 'n3': 0, 'n4': 1, 'n5': 0}

The first should be a complex attractor. The stg of the attractor is correct, and hence this must be a problem with the ar.summary() I will check on it later.