Ejemplo n.º 1
0
    # time = 0
    # for i in range(N):
    #     start = timeit.default_timer()
    #     lumping = do_lumping(
    #             system["equations"],
    #             [SparsePolynomial.from_string("C3GActive", system["variables"])],
    #             print_reduction=False,
    #             discard_useless_matrices=True,
    #     )
    #     time += timeit.default_timer() - start
    # print("Average Time: ", time/N)
    # check_lumping("BIOMD0000000033", system["equations"], lumping)
    

    # MODEL1502270000
    system = read_system("../examples/RationalFunctions/MODEL1502270000.ode")
    lumping = do_lumping(
            system["equations"],
            [SparsePolynomial.from_string("gmax*Kp+a", system["variables"])],
            print_reduction=False,
            discard_useless_matrices=True,
    )
    print("Lumping Size: ", len(lumping['rhs']))
    check_lumping("MODEL1502270000", system["equations"], lumping)
    lumping = do_lumping(
            system["equations"],
            [SparsePolynomial.from_string("si", system["variables"])],
            print_reduction=False,
            discard_useless_matrices=False,
    )
    print("Lumping Size: ", len(lumping['rhs']))
Ejemplo n.º 2
0
# Arthritis & rheumatology, 66(4), 979-989, 2014
# Source: https://www.ebi.ac.uk/biomodels/BIOMD0000000504
##

import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("BIOMD0000000504.ode")

obs_sets = [["cFos_P", "cJun_P"], ["MMP1_mRNA", "MMP13_mRNA", "TIMP1_mRNA"],
            ["MMP1", "MMP13", "ColFrag"],
            [
                "JAK1_P", "JNK_P", "cJun_P", "cJun_dimer", "STAT3_P_nuc",
                "STAT3_P_cyt"
            ]]

for obs_set in obs_sets:
    print("===============================================")
    obs_polys = [
        SparsePolynomial.from_string(s, system['variables']) for s in obs_set
    ]

    start = time.time()
Ejemplo n.º 3
0
# Model generated from:
# Borisov, N. M., Chistopolsky, A. S., Faeder, J. R., & Kholodenko, B. N.
# Domain-oriented reduction of rule-based network models. IET systems biology, 2(5), 342-351, 2008.
# Source: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2628550/bin/NIHMS80246-supplement-Supplement_4.doc
##
import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("OrderedPhosphorylation.ode")
obs = SparsePolynomial.from_string("s0", system['variables'])

start = time.time()
lumped = clue.do_lumping(system['equations'], [obs])
end = time.time()

print(f"The size of the original model is {len(system['equations'])}")
print(f"The size of the reduced model is {len(lumped['polynomials'])}")
print(f"Computation took {end - start} seconds")
import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("fceri_ji.ode")

obs_sets = [["S0"], ["S2", "S178", "S267", "S77"], ["S2 + S178 + S267 + S77"],
            ["S7"], ["S1"]]

for obs_set in obs_sets:
    print("===============================================")
    obs_polys = [
        SparsePolynomial.from_string(s, system['variables']) for s in obs_set
    ]

    start = time.time()
    lumped = clue.do_lumping(system['equations'], obs_polys)
    end = time.time()

    print(f"The size of the original model is {len(system['equations'])}")
    print(f"The size of the reduced model is {len(lumped['polynomials'])}")
    print(f"Computation took {end - start} seconds")
Ejemplo n.º 5
0
    lumped_polys_values = [evalp(p, specialization_lumped) for p in lumped_system]

    assert(polys_values_lumped == lumped_polys_values)
    print(test_name + ": lumping is correct")
        
###############################################

if __name__ == "__main__":
    # Example 1
    R = sympy.polys.rings.vring(["x0", "x1", "x2"], QQ)
    polys = [x0**2 + x1 + x2, x2, x1]
    lumping = do_lumping(polys, [x0], print_reduction=False, initial_conditions={"x0" : 1, "x1" : 2, "x2" : 5})
    check_lumping("Example 1", polys, lumping, 2)
    assert lumping["new_ic"] == [QQ(1), QQ(7)]

    # Example 2
    polys = [x1**2 + 4 * x1 * x2 + 4 * x2**2, x1 + 2 * x0**2, x2 - x0**2]
    lumping = do_lumping(polys, [x0], print_reduction=False)
    check_lumping("Example 2", polys, lumping, 2)

    # PP for n = 2
    system = read_system("e2.ode") 
    lumping = do_lumping(
            system["equations"],
            [SparsePolynomial.from_string("S0", system["variables"])], 
            print_reduction=False
    )
    check_lumping("PP for n = 2", system["equations"], lumping, 12)
    
############################################ 
# Generated from http://www.ebi.ac.uk/biomodels-main/MODEL1001150000

import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("MODEL1001150000.ode")

obs_sets = [
    [
        "CaM_0_0 + CaM_1_0 + CaM_0_1 + CaM_1_1 + CaM_2_2 + CaM_2_0 + CaM_0_2 + CaM_2_1 + CaM_1_2"
    ],
]

for obs_set in obs_sets:
    print("===============================================")
    obs_polys = [
        SparsePolynomial.from_string(s, system['variables']) for s in obs_set
    ]

    start = time.time()
    lumped = clue.do_lumping(system['equations'], obs_polys)
    end = time.time()
# A stochastic model of Escherichia coli AI‐2 quorum signal circuit reveals alternative synthesis pathways.
# Molecular systems biology, 2(1), 2006
# Source: https://www.ebi.ac.uk/biomodels/MODEL8262229752
##

import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("MODEL8262229752.ode")
obs = [
    SparsePolynomial.from_string("Pfs_mRNA", system['variables']),
    SparsePolynomial.from_string("LuxS_mRNA", system['variables']),
    SparsePolynomial.from_string("AI2_intra", system['variables'])
]

start = time.time()
lumped = clue.do_lumping(system['equations'], obs)
end = time.time()

print(f"The size of the original model is {len(system['equations'])}")
print(f"The size of the reduced model is {len(lumped['polynomials'])}")
print(f"Computation took {end - start} seconds")
Ejemplo n.º 8
0
import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("Barua.ode")

obs_sets = [["aS000"], ["aS027"]]

for obs_set in obs_sets:
    print("===============================================")
    obs_polys = [
        SparsePolynomial.from_string(s, system['variables']) for s in obs_set
    ]

    start = time.time()
    lumped = clue.do_lumping(system['equations'], obs_polys)
    end = time.time()

    print(f"The size of the original model is {len(system['equations'])}")
    print(f"The size of the reduced model is {len(lumped['polynomials'])}")
    print(f"Computation took {end - start} seconds")
Ejemplo n.º 9
0
# Models e2.bngl-e8.bngl from http://michaelsneddon.net/nfsim/pages/models/multisite_phos.zip

import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

for n in range(2, 9):

    system = parser.read_system(f"e{n}.ode")

    print("===============================================")
    obs = [
        clue.SparsePolynomial.from_string("S0", system['variables']),
        clue.SparsePolynomial.from_string("S1", system['variables'])
    ]

    start = time.time()
    lumped = clue.do_lumping(system['equations'], obs)
    end = time.time()

    print(f"Model for n = {n}")
    print(f"The size of the original model is {len(system['equations'])}")
    print(f"The size of the reduced model is {len(lumped['polynomials'])}")
Ejemplo n.º 10
0
import sys
import time

from sympy import QQ

sys.path.insert(0, "../")
sys.path.insert(0, "./../../")
import parser
import clue
from sparse_polynomial import SparsePolynomial

system = parser.read_system("BIOMD0000000033.ode")
obs = SparsePolynomial.from_string("AktInactive", system['variables'])

start = time.time()
lumped = clue.do_lumping(system['equations'], [obs], print_system=True)
end = time.time()

print(f"The size of the original model is {len(system['equations'])}")
print(f"The size of the reduced model is {len(lumped['polynomials'])}")
print(f"Computation took {end - start} seconds")