Пример #1
0
def two_subs_one_prod_random_rev():
    """Reversible two substrates, one product random order mechanism."""
    print("Two substrates, one product random reversible mechanism.")

    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_one_prod_rand_rev"))
    crn.remove(rapid_eq = [('ea', 'e+a'), ('eb', 'e+b')], \
                         qss = ['eab'], \
                         cons_law = ('e', ConsLaw('e + ea + eb + eab', 'et')))

    constants = dict(
        Vf=parse_expr("et*k5"),
        Vr=parse_expr("et*(k_3+k_4)"),
        kia=parse_expr("k_1/k1"),
        kib=parse_expr("k_2/k2"),
        Kmb=parse_expr("k1*k_2*(k5 + k_3 + k_4)/(k1*k3*k_2 + k2*k4*k_1)"),
        Kmp=parse_expr("(k5 + k_3 + k_4)/k_5"))

    rateab = parse_expr(
        "Vf/(kia*Kmb)/(1+a/kia+b/kib+a*b/(kia*Kmb)+p/Kmp)").subs(constants)
    ratep = parse_expr("Vr/Kmp/(1+a/kia+b/kib+a*b/(kia*Kmb)+p/Kmp)").subs(
        constants)

    rateab = rateab.expand().factor().factor()
    ratep = ratep.expand().factor().factor()
    indab = crn.complexes.index(parse_complex('a + b'))
    indp = crn.complexes.index(parse_complex('p'))
    diffab = crn.laplacian[indab, indab] - rateab
    diffab = diffab.factor()
    diffp = crn.laplacian[indp, indp] - ratep
    diffp = diffp.factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffp, 0)
Пример #2
0
def two_subs_one_prod_compulsory_rev():
    """Reversible two substrate, one product compulsory order mechanism.
    Rates compared to http://www.cogsys.cs.uni-tuebingen.de/software/SBMLsqueezer/doc/KineticLaws2.pdf."""
    print("Two substrates, one product compulsory reversible mechanism.")
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_one_prod_compul_rev"))
    crn.qss(cons_law=('e', ConsLaw('e + ea + eab', 'et')))

    constants = dict(kpluscat=parse_expr("k3"),
                     kminuscat=parse_expr("k_1*k_2/(k_1+k_2)"),
                     kia=parse_expr("k_1/k1"),
                     kip=parse_expr("k3/k_3"),
                     Kma=parse_expr("k3/k1"),
                     Kmb=parse_expr("(k_2+k3)/k2"),
                     Kmp=parse_expr("k_1*(k_2+k3)/(k_3*(k_1+k_2))"))

    rateab = parse_expr(
        "kpluscat*et/(kia*Kmb)/(1+a/kia+Kma*b/(kia*Kmb)+a*b/(Kmb*kia)+Kma*b*p/(kia*Kmb*kip)+p/Kmp)"
    ).subs(constants)
    indab = crn.complexes.index(parse_complex('a + b'))
    diffab = (rateab - crn.laplacian[indab, indab]).factor()
    ratep = parse_expr(
        "kminuscat*et/Kmp/(1+a/kia+Kma*b/(kia*Kmb)+a*b/(Kmb*kia)+Kma*b*p/(kia*Kmb*kip)+p/Kmp)"
    ).subs(constants)
    indp = crn.complexes.index(parse_complex('p'))
    diffp = (ratep - crn.laplacian[indp, indp]).factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffp, 0)
Пример #3
0
def two_subs_two_prods_compulsory():
    """Irreversible and reversible two substrates, two products compulsory order mechanism."""
    print("Two substrates, two products compulsory mechanism.")
    # Full version, without using conservation law
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_compul"))
    crn.qss('eab')
    crn.qss('ea')
    crn.remove_all_constants()

    # Full version
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_compul"))
    crn.qss(cons_law=('e', ConsLaw('e + ea + eab', 'et')))
    rate = parse_expr(
        "k3*et*a*b/(k_1*(k_2+k3)/(k1*k2)+(k_2+k3)/k2*a+k3/k1*b+a*b)")
    fail_if_not_equal((crn.rates[0] - rate).factor(), 0)

    # Cornish-Bowden version, 6.3
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_compul_ternary"))
    crn.qss(cons_law=('e', ConsLaw('e + ea + eq + eab', 'et')))

    constants = dict(Vf=parse_expr("k3*k4*et/(k3+k4)"),
                     Vr=parse_expr("k_1*k_2*et/(k_1+k_2)"),
                     kia=parse_expr("k_1/k1"),
                     kib=parse_expr("(k_1+k_2)/k2"),
                     kip=parse_expr("(k3+k4)/k_3"),
                     kiq=parse_expr("k4/k_4"),
                     Kma=parse_expr("k3*k4/k1/(k3+k4)"),
                     Kmb=parse_expr("(k_2+k3)*k4/k2/(k3+k4)"),
                     Kmp=parse_expr("k_1*(k_2+k3)/(k_1+k_2)/k_3"),
                     Kmq=parse_expr("k_1*k_2/(k_1+k_2)/k_4"))

    rateab = parse_expr(
        "Vf/(kia*Kmb)/(1+a/kia+b*Kma/(kia*Kmb)+p*Kmq/(kiq*Kmp)+q/kiq+a*b/(kia*Kmb)+Kmq*a*p/(kia*Kmp*kiq)+\
                                       Kma*b*q/(kia*Kmb*kiq)+p*q/(Kmp*kiq)+a*b*p/(kia*Kmb*kip)+b*p*q/(kib*Kmp*kiq))"
    ).subs(constants)
    ratepq = parse_expr(
        "Vr/(kiq*Kmp)/(1+a/kia+b*Kma/(kia*Kmb)+p*Kmq/(kiq*Kmp)+q/kiq+a*b/(kia*Kmb)+Kmq*a*p/(kia*Kmp*kiq)+\
                                       Kma*b*q/(kia*Kmb*kiq)+p*q/(Kmp*kiq)+a*b*p/(kia*Kmb*kip)+b*p*q/(kib*Kmp*kiq))"
    ).subs(constants)

    rateab = rateab.factor()
    ratepq = ratepq.factor()
    indab = crn.complexes.index(parse_complex('a + b'))
    indpq = crn.complexes.index(parse_complex('p + q'))
    diffab = crn.laplacian[indab, indab] - rateab
    diffab = diffab.factor()
    diffpq = crn.laplacian[indpq, indpq] - ratepq
    diffpq = diffpq.factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffpq, 0)
Пример #4
0
def two_subs_one_prod_random_irr():
    """Irreversible two substrates, one product random order mechanism.
    (random order bi-uni mechanism, http://www.ebi.ac.uk/sbo/main/SBO:0000432)."""
    print("Two substrates, one product random irreversible mechanism.")

    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_one_prod_rand_irr"))

    crn.remove(rapid_eq = [('ea', 'e+a'), ('eb', 'e+b')], \
               qss = ['eab'], \
               cons_law = ('e', ConsLaw('e + ea + eb + eab', 'et')))

    constants = dict(
        Vf=parse_expr("et*k5"),
        Vr=parse_expr("et*(k_3+k_4)"),
        kia=parse_expr("k_1/k1"),
        kib=parse_expr("k_2/k2"),
        Kmb=parse_expr("k1*k_2*(k5 + k_3 + k_4)/(k1*k3*k_2 + k2*k4*k_1)"),
        Kmp=parse_expr("(k5 + k_3 + k_4)/k_5"))
    rateab = parse_expr("Vf/(kia*Kmb)/(1+a/kia+b/kib+a*b/(kia*Kmb))").subs(
        constants)

    indab = crn.complexes.index(parse_complex('a + b'))
    diff = crn.laplacian[indab, indab] - rateab
    diff = diff.factor()
    fail_if_not_equal(diff, 0)
Пример #5
0
def ternary_compulsory():
    """Transfer of a radioactive atom (a_s -> p_s), in a ternary compulsory mechanism. Cornish-Bowden, 6.8."""
    print("Example of transfer of a radioactive atom.")
    # Exchange requires a_s to bind to e. Inhibited by high concentrations of a and q, as they also bind to e.
    crn = from_react_file(os.path.join(input_reactions, "ternary_compulsory"))
    with warnings.catch_warnings(record=True) as w:
        # Use 'e + ea + eab + eq' instead of proper conservation 'e + ea + ea_s + eab + ea_sb + eq')
        crn.remove(rapid_eq = [('eab', 'ea + b'), ('ea', 'e + a'), ('eq', 'e + q')], \
                             cons_law = ('e' , ConsLaw('e + ea + eab + eq', 'et')))

        crn.remove(qss=['ea_sb', 'ea_s'])
        # unlabelled species assumed constant
        for s in ['a', 'p', 'b', 'q']:
            crn.remove_constant(s)
        for ws in w:
            assert "not constant." in str(ws.message)

    # page 122
    ratea_s = parse_expr(
        'k1*k2*k3*et*b/((1+k1*a/k_1+k1*k2*a*b/(k_1*k_2)+k_4*q/k4)*(k_1*(k_2+k3)+k2*k3*b))'
    )
    ratep_s = parse_expr(
        'k_1*k_2*k_3*k_4/k4*et*q/((1+k1*a/k_1+k1*k2*a*b/(k_1*k_2)+k_4*q/k4)*(k_1*(k_2+k3)+k2*k3*b))'
    )
    ratea_s = ratea_s.expand().factor().factor()
    ratep_s = ratep_s.expand().factor().factor()
    inda_s = crn.complexes.index(parse_complex('a_s'))
    indp_s = crn.complexes.index(parse_complex('p_s'))
    diffa_s = crn.laplacian[inda_s, inda_s] - ratea_s
    diffa_s = diffa_s.factor()
    diffp_s = crn.laplacian[indp_s, indp_s] - ratep_s
    diffp_s = diffp_s.factor()
    fail_if_not_equal(diffa_s, 0)
    fail_if_not_equal(diffp_s, 0)

    # Full version
    crn = from_react_file(os.path.join(input_reactions, "ternary_compulsory"))
    #for c in ['a', 'p', 'b', 'q']: crn.remove_constant(c)
    crn.remove(rapid_eq = [('eab', 'ea + b'), ('ea', 'e + a'), ('eq', 'e + q')], \
                         qss = ['ea_sb', 'ea_s'], \
                         cons_law = ('e' , ConsLaw('e + ea + ea_s + eab + ea_sb + eq', 'et')))
Пример #6
0
def allosteric_activation():
    """Allosteric activation (Ingalls 3.7.8)."""
    print("Allosteric activation.")
    crn = from_react_file(
        os.path.join(input_reactions, "allosteric_activation"))
    crn.qss(cons_law = ('E', ConsLaw('E + ER + ERS', 'Etot')), \
            remove_const = True, merge_reacts = True)
    #crn.remove_all_constants()
    inds = crn.complexes.index(parse_complex('S'))
    fail_if_not_equal(
        sp.factor(crn.laplacian[inds, inds] - parse_expr(
            "R*k3*Etot/(R * (k_2 + k3)/k2 + k_1*(k_2 + k3)/(k1*k2) + S*R)")),
        0)
Пример #7
0
def two_subs_one_prod_compulsory_irr():
    """Irreversible two substrate, one product compulsory order mechanism.
    Rates compared to http://www.cogsys.cs.uni-tuebingen.de/software/SBMLsqueezer/doc/KineticLaws2.pdf."""
    print("Two substrates, one product compulsory irreversible mechanism.")
    # Irreversible
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_one_prod_compul_irr"))
    crn.qss(cons_law=('e', ConsLaw('e + ea + eab', 'et')))
    rateab = parse_expr("k3*et/(kia*Kmb)/(1+a/kia+Kma*b/(kia*Kmb)+a*b/(Kmb*kia))").subs("kia", parse_expr("k_1/k1")) \
                                                                                  .subs("Kma", parse_expr("k3/k1")) \
                                                                                  .subs("Kmb", parse_expr("(k_2+k3)/k2"))
    indab = crn.complexes.index(parse_complex('a + b'))
    fail_if_not_equal((rateab - crn.laplacian[indab, indab]).factor(), 0)
Пример #8
0
def two_subs_two_prods_subs_enzyme():
    """Substituted-enzyme (ping-pong) mechanism. From Cornish-Bowden, section 6.1."""
    print("Substituted enzyme mechanism.")
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_subs_enzyme"))
    crn.qss(cons_law=('e', ConsLaw('e + e1 + ea + e1b', 'et')))

    constants = dict(Vf=parse_expr("k2*k4*et/(k2+k4)"),
                     Vr=parse_expr("k_1*k_3*et/(k_1+k_3)"),
                     kia=parse_expr("k_1/k1"),
                     kib=parse_expr("k_3/k3"),
                     kip=parse_expr("k2/k_2"),
                     kiq=parse_expr("k4/k_4"),
                     Kma=parse_expr("(k_1+k2)*k4/k1/(k2+k4)"),
                     Kmb=parse_expr("k2/k3*(k_3+k4)/(k2+k4)"),
                     Kmp=parse_expr("k_3/k_2*(k_1+k2)/(k_1+k_3)"),
                     Kmq=parse_expr("k_1/k_4*(k_3+k4)/(k_1+k_3)"))

    rateab = parse_expr(
        "Vf/(kia*Kmb)/(a/kia+b*Kma/(kia*Kmb)+p/kip+q*Kmp/(kip*Kmq)+a*b/(kia*Kmb)+a*p/(kia*kip)+\
                                       Kma*b*q/(kia*Kmb*kiq)+p*q/(Kmq*kip))"
    ).subs(constants)

    ratepq = parse_expr(
        "Vr/(kip*Kmq)/(a/kia+b*Kma/(kia*Kmb)+p/kip+q*Kmp/(kip*Kmq)+a*b/(kia*Kmb)+a*p/(kia*kip)+\
                                       Kma*b*q/(kia*Kmb*kiq)+p*q/(Kmq*kip))"
    ).subs(constants)

    rateab = rateab.expand().factor().factor()
    ratepq = ratepq.expand().factor().factor()
    indab = crn.complexes.index(parse_complex('a + b'))
    indpq = crn.complexes.index(parse_complex('p + q'))
    diffab = crn.laplacian[indab, indab] - rateab
    diffab = diffab.factor()
    diffpq = crn.laplacian[indpq, indpq] - ratepq
    diffpq = diffpq.factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffpq, 0)
Пример #9
0
def two_subs_two_prods_random():
    """Reversible two substrates, two products random order mechanism."""
    print("Two substrates, two products random mechanism.")
    # Cornish-Bowden version, section 6.1
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_rand"))
    crn.remove(rapid_eq = [('ea', 'e+a'), ('ep', 'e+p'), ('eb', 'e+b'), ('eq', 'e+q')], \
               qss = ['eab', 'epq'], \
               cons_law = ('e', ConsLaw('e + ea + eb + ep + eq + eab + epq', 'et')), \
               merge_reacts = True)

    constants = dict(
        Vf=parse_expr("et*k9*(k5 + k6)/(k5 + k6 + k9 + k_9)"),
        Vr=parse_expr("et*k_9*(k_3 + k_4)/(k9 + k_3 + k_4 + k_9)"),
        kia=parse_expr("k_1/k1"),
        kib=parse_expr("k_2/k2"),
        kip=parse_expr("k7/k_7"),
        kiq=parse_expr("k8/k_8"),
        Kmb=parse_expr(
            "k1*k_2*(k5*k9 + k5*k_3 + k5*k_4 + k6*k9 + k6*k_3 + k6*k_4 + k_3*k_9 + k_4*k_9)/((k1*k3*k_2 + k2*k4*k_1)*(k5 + k6 + k9 + k_9))"
        ),
        Kmp=parse_expr(
            "k7*k_8*(k5*k9 + k5*k_3 + k5*k_4 + k6*k9 + k6*k_3 + k6*k_4 + k_3*k_9 + k_4*k_9)/((k8*k_6*k_7 + k7*k_5*k_8)*(k9 + k_3 + k_4 + k_9))"
        ))

    rateab = parse_expr(
        "Vf/(kia*Kmb)/(1+a/kia+b/kib+p/kip+q/kiq+a*b/(kia*Kmb)+p*q/(Kmp*kiq))"
    ).subs(constants)
    ratepq = parse_expr(
        "Vr/(Kmp*kiq)/(1+a/kia+b/kib+p/kip+q/kiq+a*b/(kia*Kmb)+p*q/(Kmp*kiq))"
    ).subs(constants)

    indab = crn.complexes.index(parse_complex('a + b'))
    indpq = crn.complexes.index(parse_complex('p + q'))
    diffab = crn.laplacian[indab, indab] - rateab
    diffab = diffab.factor()
    diffpq = crn.laplacian[indpq, indpq] - ratepq
    diffpq = diffpq.factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffpq, 0)

    # Simplified version
    crn = from_react_file(
        os.path.join(input_reactions, "two_subs_two_prods_rand_v2"))
    crn.remove(rapid_eq = [('ea', 'e+a'), ('ep', 'e+p'), ('eb', 'e+b'), ('eq', 'e+q')], \
                         qss = ['eab'], \
                         cons_law = ('e', ConsLaw('e + ea + eb + ep + eq + eab', 'et')))

    constants = dict(
        Vf=parse_expr("et*(k5+k6)"),
        Vr=parse_expr("et*(k_3+k_4)"),
        kia=parse_expr("k_1/k1"),
        kib=parse_expr("k_2/k2"),
        kip=parse_expr("k7/k_7"),
        kiq=parse_expr("k8/k_8"),
        Kmb=parse_expr("k1*k_2*(k5 + k6 + k_3 + k_4)/(k1*k3*k_2 + k2*k4*k_1)"),
        Kmp=parse_expr(
            "k7*k_8*(k5 + k6 + k_3 + k_4)/(k8*k_6*k_7 + k7*k_5*k_8)"))

    rateab = parse_expr(
        "Vf/(kia*Kmb)/(1+a/kia+b/kib+p/kip+q/kiq+a*b/(kia*Kmb)+p*q/(Kmp*kiq))"
    ).subs(constants)
    ratepq = parse_expr(
        "Vr/(Kmp*kiq)/(1+a/kia+b/kib+p/kip+q/kiq+a*b/(kia*Kmb)+p*q/(Kmp*kiq))"
    ).subs(constants)

    indab = crn.complexes.index(parse_complex('a + b'))
    indpq = crn.complexes.index(parse_complex('p + q'))
    diffab = crn.laplacian[indab, indab] - rateab
    diffab = diffab.factor()
    diffpq = crn.laplacian[indpq, indpq] - ratepq
    diffpq = diffpq.factor()
    fail_if_not_equal(diffab, 0)
    fail_if_not_equal(diffpq, 0)