PyBoolNet tutorial#
Boolean networks#
from pyboolnet.file_exchange import bnet2primes, primes2bnet
from pyboolnet.prime_implicants import find_constants, create_variables
from pyboolnet.repository import get_primes
# Manual model definition
bnet = """
v1, !v1
v2, 1
v3, v2 & (!v1 | v3)
"""
primes = bnet2primes(bnet)
# finding nodes
find_constants(primes)
{'v2': 1}
# modifying networks
create_variables(primes, {"v4": "v4 | v2"})
create_variables(primes, {"v5": lambda v1,v2,v3: v1+v2+v3==1})
print(primes2bnet(primes))
v2,
v1, !v1
v3, v2 & v3 | !v1 & v2
v4, v4 | v2
v5, !v1 & !v2 & v3 | !v1 & v2 & !v3 | v1 & !v2 & !v3
From repository#
# reading from the repository
primes = get_primes("remy_tumorigenesis")
print(primes2bnet(primes))
DNA_damage, DNA_damage
EGFR_stimulus, EGFR_stimulus
FGFR3_stimulus, FGFR3_stimulus
Growth_inhibitors, Growth_inhibitors
AKT, PI3K
ATM_high, ATM_medium & DNA_damage & E2F1_medium
ATM_medium, ATM_high & ATM_medium | DNA_damage
Apoptosis_high, Apoptosis_medium & E2F1_high & E2F1_medium
Apoptosis_medium, E2F1_high & E2F1_medium | Apoptosis_high & Apoptosis_medium | TP53
CDC25A, !CHEK1_2_medium & E2F3_medium & !RBL2 | !CHEK1_2_medium & E2F1_medium & !RBL2
CHEK1_2_high, ATM_medium & CHEK1_2_medium & E2F1_medium
CHEK1_2_medium, CHEK1_2_high & CHEK1_2_medium | ATM_medium
CyclinA, CDC25A & E2F3_medium & !RBL2 & !p21CIP | CDC25A & E2F1_medium & !RBL2 & !p21CIP
CyclinD1, RAS & !p16INK4a & !p21CIP | AKT & !p16INK4a & !p21CIP
CyclinE1, CDC25A & E2F3_medium & !RBL2 & !p21CIP | CDC25A & E2F1_medium & !RBL2 & !p21CIP
E2F1_high, ATM_high & ATM_medium & CHEK1_2_high & CHEK1_2_medium & E2F1_medium & E2F3_high & E2F3_medium & !RB1 & !RBL2 | ATM_high & ATM_medium & CHEK1_2_high & CHEK1_2_medium & E2F1_medium & RAS & !RB1 & !RBL2
E2F1_medium, RAS & !RB1 & !RBL2 | E2F3_medium & !RB1 & !RBL2 | E2F1_high & E2F1_medium
E2F3_high, CHEK1_2_high & CHEK1_2_medium & E2F3_medium & RAS & !RB1
E2F3_medium, RAS & !RB1 | E2F3_high & E2F3_medium
EGFR, !FGFR3 & !GRB2 & SPRY | EGFR_stimulus & !FGFR3 & !GRB2
FGFR3, !EGFR & FGFR3_stimulus & !GRB2
GRB2, FGFR3 & !GRB2 & !SPRY | EGFR
MDM2, !ATM_medium & !RB1 & TP53 & !p14ARF | AKT & !ATM_medium & !RB1 & !p14ARF
PI3K, GRB2 & !PTEN & RAS
PTEN, TP53
RAS, GRB2 | FGFR3 | EGFR
RB1, !CyclinA & !CyclinD1 & !CyclinE1 & !p16INK4a
RBL2, !CyclinD1 & !CyclinE1
SPRY, RAS
TP53, E2F1_high & E2F1_medium & !MDM2 | ATM_medium & CHEK1_2_medium & !MDM2
p14ARF, E2F1_medium
p16INK4a, Growth_inhibitors & !RB1
p21CIP, !AKT & !CyclinE1 & TP53 | !AKT & !CyclinE1 & Growth_inhibitors
Growth_arrest, p21CIP | RBL2 | RB1
Proliferation, CyclinE1 | CyclinA
Trap spaces#
from pyboolnet.trap_spaces import compute_trap_spaces, compute_steady_states
from colomoto_jupyter import tabulate
This notebook has been executed using the docker image colomoto/colomoto-docker:2021-10-01
mints = compute_trap_spaces(primes, "min")
tabulate(mints)
p21CIP | p16INK4a | p14ARF | TP53 | SPRY | RBL2 | RB1 | RAS | Proliferation | PTEN | PI3K | MDM2 | Growth_inhibitors | Growth_arrest | GRB2 | FGFR3_stimulus | FGFR3 | EGFR_stimulus | EGFR | E2F3_medium | E2F3_high | E2F1_medium | E2F1_high | DNA_damage | CyclinE1 | CyclinD1 | CyclinA | CHEK1_2_medium | CHEK1_2_high | CDC25A | Apoptosis_medium | Apoptosis_high | ATM_medium | ATM_high | AKT | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|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 1.0 | 0 | 0.0 | 0 | 1 | 0.0 | 0.0 | 0.0 | 1 | 0 | 0.0 | 1 | 0 | 1 | 0 | 0.0 |
10 | 1.0 | 1 | 0.0 | 1 | NaN | 1.0 | 0.0 | NaN | 0.0 | 1 | 0.0 | 0.0 | 1 | 1.0 | NaN | 0 | 0 | 1 | NaN | NaN | 0 | 0.0 | 0 | 1 | 0.0 | 0.0 | 0.0 | 1 | 0 | 0.0 | 1 | 0 | 1 | 0 | 0.0 |
14 | NaN | 1 | 0.0 | 0 | NaN | 1.0 | 0.0 | NaN | 0.0 | 0 | NaN | NaN | 1 | 1.0 | NaN | 0 | 0 | 1 | NaN | NaN | 0 | 0.0 | 0 | 0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 0.0 | 0 | 0 | 0 | 0 | NaN |
max_trap_spaces = compute_trap_spaces(primes, "max")
tabulate(max_trap_spaces)
EGFR_stimulus | Growth_inhibitors | FGFR3_stimulus | DNA_damage | |
---|---|---|---|---|
5 | 0.0 | NaN | NaN | NaN |
0 | 1.0 | NaN | NaN | NaN |
2 | NaN | 0.0 | NaN | NaN |
1 | NaN | 1.0 | NaN | NaN |
4 | NaN | NaN | 0.0 | NaN |
3 | NaN | NaN | 1.0 | NaN |
7 | NaN | NaN | NaN | 0.0 |
6 | NaN | NaN | NaN | 1.0 |
steady = compute_steady_states(primes)
tabulate(steady)
p21CIP | p16INK4a | p14ARF | TP53 | SPRY | RBL2 | RB1 | RAS | Proliferation | PTEN | PI3K | MDM2 | Growth_inhibitors | Growth_arrest | GRB2 | FGFR3_stimulus | FGFR3 | EGFR_stimulus | EGFR | E2F3_medium | E2F3_high | E2F1_medium | E2F1_high | DNA_damage | CyclinE1 | CyclinD1 | CyclinA | CHEK1_2_medium | CHEK1_2_high | CDC25A | Apoptosis_medium | Apoptosis_high | ATM_medium | ATM_high | AKT | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|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