def cycle_4(self, i):

        if i == "Ls":
            Parameter('k_p_on_zap_species',
                      self.rate_constants.k_p_on_zap_species)
            Parameter('k_p_off_zap_species',
                      self.rate_constants.k_p_off_zap_species)

        previous_product = self.cycle_3(i)
        product = "RP{0}_Lck_Zap_P".format(i)
        self.add_new_monomer(product)

        Rule(
            '{0}_cat'.format(product),
            eval('{0}()'.format(previous_product))
            | eval('{0}()'.format(product)), k_p_on_zap_species,
            k_p_off_zap_species)
        add_observable(product)

        no_ligand = self.unbind_ligand(i, product)

        if i == "Ls":
            no_lck = self.lck_off(no_ligand, k_off="k_lck_off_zap_R")
            self.dephosphorylate_zap(no_lck)

        return product
    def non_specific_step_8(self, i):

        if i == "Ls":
            if self.p_flag:
                Parameter('k_grb_on', self.parameters['k_8_1'])
                Parameter('k_grb_product', self.parameters['k_8_2'])
            else:
                Parameter('k_grb_on', 0.00005)
                Parameter('k_grb_product', 0.01)

        previous_product = self.step_8(i)
        intermediate_product = "LATP_Grb"
        product = "final_product"

        if i == "Ls":
            self.add_new_monomer(intermediate_product)
            Rule(
                "{0}_convert".format(intermediate_product),
                eval('{0}()'.format(previous_product)) + Grb()
                | eval('{0}()'.format(intermediate_product)), k_grb_on,
                k_p_off_R_pmhc)

            self.add_new_monomer(product)
            Rule(
                "{0}_cat".format(product),
                eval('{0}()'.format(intermediate_product)) >>
                LATP() + eval('{0}()'.format(product)), k_grb_product)
            Rule("{0}_uncat".format(product),
                 eval('{0}()'.format(product)) >> Grb(), k_p_off_R_pmhc)

            add_observable(product)

        return product
Пример #3
0
def test_integrate_with_expression():
    """Ensure a model with Expressions simulates."""

    Monomer('s1')
    Monomer('s9')
    Monomer('s16')
    Monomer('s20')

    # Parameters should be able to contain s(\d+) without error
    Parameter('ks0', 2e-5)
    Parameter('ka20', 1e5)

    Initial(s9(), Parameter('s9_0', 10000))

    Observable('s1_obs', s1())
    Observable('s9_obs', s9())
    Observable('s16_obs', s16())
    Observable('s20_obs', s20())

    Expression('keff', (ks0 * ka20) / (ka20 + s9_obs))

    Rule('R1', None >> s16(), ks0)
    Rule('R2', None >> s20(), ks0)
    Rule('R3', s16() + s20() >> s16() + s1(), keff)

    time = np.linspace(0, 40)

    solver = Solver(model, time)
    solver.run()

    assert solver.yexpr_view.shape == (len(time),
                                       len(model.expressions_dynamic()))
    assert solver.yobs_view.shape == (len(time), len(model.observables))
Пример #4
0
    def setUp(self):
        Monomer('A', ['a'])
        Monomer('B', ['b'])

        Parameter('ksynthA', 100)
        Parameter('ksynthB', 100)
        Parameter('kbindAB', 100)

        Parameter('A_init', 0)
        Parameter('B_init', 0)

        Initial(A(a=None), A_init)
        Initial(B(b=None), B_init)

        Observable("A_free", A(a=None))
        Observable("B_free", B(b=None))
        Observable("AB_complex", A(a=1) % B(b=1))

        Rule('A_synth', None >> A(a=None), ksynthA)
        Rule('B_synth', None >> B(b=None), ksynthB)
        Rule('AB_bind', A(a=None) + B(b=None) >> A(a=1) % B(b=1), kbindAB)

        self.model = model

        # Convenience shortcut for accessing model monomer objects
        self.mon = lambda m: self.model.monomers[m]

        # This timespan is chosen to be enough to trigger a Jacobian evaluation
        # on the various solvers.
        self.time = np.linspace(0, 1)
        self.sim = ScipyOdeSimulator(self.model,
                                     tspan=self.time,
                                     integrator='vode')
    def add_step_9(self, i):
        previous_product = self.add_step_8_sos(i)
        product_rd = previous_product + "_Ras_GDP"

        if i == "Ls":
            Parameter('k_sos_on_rgdp', 0.0024)
            Parameter('k_sos_off_rgdp', 3.0)

        self.add_new_monomer(product_rd)

        Rule(
            '{0}_bind'.format(product_rd),
            eval('{0}()'.format(previous_product)) + Ras_GDP()
            | eval('{0}()'.format(product_rd)), k_sos_on_rgdp, k_sos_off_rgdp)

        product_rt = previous_product + "_Ras_GTP"

        if i == "Ls":
            Parameter('k_sos_on_rgtp', 0.0022)
            Parameter('k_sos_off_rgtp', 0.4)

        self.add_new_monomer(product_rt)

        Rule(
            '{0}_bind'.format(product_rt),
            eval('{0}()'.format(previous_product)) + Ras_GTP()
            | eval('{0}()'.format(product_rt)), k_sos_on_rgtp, k_sos_off_rgtp)

        return product_rd, product_rt
Пример #6
0
def test_integrate_with_expression():
    """Ensure a model with Expressions simulates."""

    Monomer('s1')
    Monomer('s9')
    Monomer('s16')
    Monomer('s20')

    # Parameters should be able to contain s(\d+) without error
    Parameter('ks0', 2e-5)
    Parameter('ka20', 1e5)

    Initial(s9(), Parameter('s9_0', 10000))

    Observable('s1_obs', s1())
    Observable('s9_obs', s9())
    Observable('s16_obs', s16())
    Observable('s20_obs', s20())

    Expression('keff', (ks0 * ka20) / (ka20 + s9_obs))

    Rule('R1', None >> s16(), ks0)
    Rule('R2', None >> s20(), ks0)
    Rule('R3', s16() + s20() >> s16() + s1(), keff)

    time = np.linspace(0, 40)
    sim = ScipyOdeSimulator(model, tspan=time)
    simres = sim.run()
    keff_vals = simres.expressions['keff']
    assert len(keff_vals) == len(time)
    assert np.allclose(keff_vals, 1.8181818181818182e-05)
Пример #7
0
    def setUp(self):
        Monomer('A', ['a'])
        Monomer('B', ['b'])

        Parameter('ksynthA', 100)
        Parameter('ksynthB', 100)
        Parameter('kbindAB', 100)

        Parameter('A_init', 0)
        Parameter('B_init', 0)

        Initial(A(a=None), A_init)
        Initial(B(b=None), B_init)

        Observable("A_free", A(a=None))
        Observable("B_free", B(b=None))
        Observable("AB_complex", A(a=1) % B(b=1))

        Rule('A_synth', None >> A(a=None), ksynthA)
        Rule('B_synth', None >> B(b=None), ksynthB)
        Rule('AB_bind', A(a=None) + B(b=None) >> A(a=1) % B(b=1), kbindAB)

        self.model = model

        # This timespan is chosen to be enough to trigger a Jacobian evaluation
        # on the various solvers.
        self.time = np.linspace(0, 1)
        self.solver = Solver(self.model, self.time, integrator='vode')
Пример #8
0
def test_integrate_with_expression():
    """Ensure a model with Expressions simulates."""

    Monomer('s1')
    Monomer('s9')
    Monomer('s16')
    Monomer('s20')

    # Parameters should be able to contain s(\d+) without error
    Parameter('ks0', 2e-5)
    Parameter('ka20', 1e5)

    Initial(s9(), Parameter('s9_0', 10000))

    Observable('s1_obs', s1())
    Observable('s9_obs', s9())
    Observable('s16_obs', s16())
    Observable('s20_obs', s20())

    Expression('keff', (ks0 * ka20) / (ka20 + s9_obs))

    Rule('R1', None >> s16(), ks0)
    Rule('R2', None >> s20(), ks0)
    Rule('R3', s16() + s20() >> s16() + s1(), keff)

    time = np.linspace(0, 40)
    x = odesolve(model, time)
Пример #9
0
def add_gf_bolus(model, name: str, created_monomers: List[str]):
    bolus = Monomer(f'{name}_ext')
    Initial(bolus(), Parameter(f'{name}_0', 0.0), fixed=True)
    for created_monomer in created_monomers:
        koff = Parameter(f'{name}_{created_monomer}_koff', 0.1)
        kd = Parameter(f'{name}_{created_monomer}_kd', 1.0)
        kon = Expression(f'{name}_{created_monomer}_kon', kd * koff)
        Rule(f'{name}_ext_to_{created_monomer}',
             bolus() | model.monomers[created_monomer](inh=None), kon, koff)
Пример #10
0
def add_abundance_observables(model):
    """
    Adds an observable that tracks the normalized absolute abundance of a
    protein
    """
    for monomer in model.monomers:
        obs = Observable(f'total_{monomer.name}', monomer())
        scale = Parameter(f't{monomer.name}_scale', 1.0)
        offset = Parameter(f't{monomer.name}_offset', 1.0)
        Expression(f't{monomer.name}_obs', sp.log(scale * (obs + offset)))
Пример #11
0
def add_phospho_observables(model):
    """
    Adds an observable that tracks the normalized absolute abundance of a
    phosphorylated site
    """
    for monomer in model.monomers:
        for site in monomer.site_states:
            if re.match(r'[YTS][0-9]+$', site):
                obs = Observable(f'p{monomer.name}_{site}',
                                 monomer(**{site: 'p'}))
                scale = Parameter(f'p{monomer.name}_{site}_scale', 1.0)
                offset = Parameter(f'p{monomer.name}_{site}_offset', 1.0)
                Expression(f'p{monomer.name}_{site}_obs',
                           sp.log(scale * (obs + offset)))
Пример #12
0
def get_create_parameter(model, name, value, unique=True):
    """Return parameter with given name, creating it if needed.

    If unique is false and the parameter exists, the value is not changed; if
    it does not exist, it will be created. If unique is true then upon conflict
    a number is added to the end of the parameter name.
    """

    parameter = model.parameters.get(name)

    if not unique and parameter is not None:
        return parameter

    if unique:
        pnum = 1
        while True:
            pname = name + '_%d' % pnum
            if model.parameters.get(pname) is None:
                break
            pnum += 1
    else:
        pname = name

    parameter = Parameter(pname, value)
    model.add_component(parameter)
    return parameter
Пример #13
0
def merge_parameters(model, new_name, parameters):
    unique_values = {parameter.value for parameter in parameters}
    if len(unique_values) > 1:
        raise ValueError("Given parameters have different values: %s" %
                         (', '.join('%s=%g' % (p.name, p.value)
                                    for p in parameters)))
    value = parameters[0].value
    rules = ComponentSet()
    for parameter in parameters:
        rules |= rules_using_parameter(model, parameter)
    if not rules:
        raise ValueError("Model has no rules using given parameters: %s" %
                         ', '.join(p.name for p in parameters))
    try:
        new_parameter = model.parameters[new_name]
        if new_parameter.value != value:
            raise ValueError("Parameter %s is already present in the model "
                             "with the value %g, which differs from the "
                             "common value of the given parameters, %g" %
                             (new_parameter.name, new_parameter.value, value))
    except KeyError:
        new_parameter = Parameter(new_name, value)
        model.add_component(new_parameter)
    for rule in rules:
        for attr in 'rate_forward', 'rate_reverse':
            if getattr(rule, attr) in parameters:
                setattr(rule, attr, new_parameter)
    def add_step_8_sos(self, i):

        if i == "Ls":
            self.model.parameters['Sos_0'].value = 2000
            Parameter('k_sos_on', 0.0002 / 4)
            Parameter('k_sos_off', 0.005)

        previous_product = self.cycle_4(i)
        product = previous_product + "_Sos"
        self.add_new_monomer(product)

        Rule(
            "{0}_bind".format(product),
            eval('{0}()'.format(previous_product)) + Sos()
            | eval('{0}()'.format(product)), k_sos_on, k_sos_off)
        add_observable(product)

        return product
Пример #15
0
 def get_context(model):
     # TODO: Here we will have to query the context
     # for now it is hard coded
     kras = model.monomers['KRAS']
     try:
         p = Parameter('kras_act_0', 100)
         model.add_component(p)
         model.initial(kras(act='active'), p)
     except ComponentDuplicateNameError:
         model.parameters['kras_act_0'].value = 100
Пример #16
0
def _get_gk_model():
    SelfExporter.do_export = True
    Model()
    Monomer('DUSP6', ['mapk1'])
    Monomer('MAP2K1', ['mapk1'])
    Monomer('MAPK1', ['phospho', 'map2k1', 'dusp6'], {'phospho': ['u', 'p']})

    Parameter('kf_mm_bind_1', 1e-06)
    Parameter('kr_mm_bind_1', 0.001)
    Parameter('kc_mm_phos_1', 0.001)
    Parameter('kf_dm_bind_1', 1e-06)
    Parameter('kr_dm_bind_1', 0.001)
    Parameter('kc_dm_dephos_1', 0.001)
    Parameter('DUSP6_0', 100.0)
    Parameter('MAP2K1_0', 100.0)
    Parameter('MAPK1_0', 100.0)

    Rule('MAP2K1_phospho_bind_MAPK1_phospho_1', MAP2K1(mapk1=None) + \
         MAPK1(phospho='u', map2k1=None) >>
         MAP2K1(mapk1=1) % MAPK1(phospho='u', map2k1=1), kf_mm_bind_1)
    Rule('MAP2K1_phospho_MAPK1_phospho_1', MAP2K1(mapk1=1) % \
         MAPK1(phospho='u', map2k1=1) >>
        MAP2K1(mapk1=None) + MAPK1(phospho='p', map2k1=None), kc_mm_phos_1)
    Rule(
        'MAP2K1_dissoc_MAPK1',
        MAP2K1(mapk1=1) % MAPK1(map2k1=1) >>
        MAP2K1(mapk1=None) + MAPK1(map2k1=None), kr_mm_bind_1)
    Rule(
        'DUSP6_dephos_bind_MAPK1_phospho_1',
        DUSP6(mapk1=None) + MAPK1(phospho='p', dusp6=None) >>
        DUSP6(mapk1=1) % MAPK1(phospho='p', dusp6=1), kf_dm_bind_1)
    Rule(
        'DUSP6_dephos_MAPK1_phospho_1',
        DUSP6(mapk1=1) % MAPK1(phospho='p', dusp6=1) >>
        DUSP6(mapk1=None) + MAPK1(phospho='u', dusp6=None), kc_dm_dephos_1)
    Rule(
        'DUSP6_dissoc_MAPK1',
        DUSP6(mapk1=1) % MAPK1(dusp6=1) >>
        DUSP6(mapk1=None) + MAPK1(dusp6=None), kr_dm_bind_1)

    Initial(DUSP6(mapk1=None), DUSP6_0)
    Initial(MAP2K1(mapk1=None), MAP2K1_0)
    Initial(MAPK1(phospho='u', map2k1=None, dusp6=None), MAPK1_0)
    SelfExporter.do_export = False
    return model
Пример #17
0
def add_inhibitor(model: Model, name: str, targets: List[str]):
    inh = Parameter(f'{name}_0', 0.0)
    kd = Parameter(f'{name}_kd', 0.0)
    affinities = {
        target:
        Expression(f'inh_{target}',
                   Observable(f'target_{target}', model.monomers[target]) / kd)
        for target in targets
    }

    for expr in model.expressions:
        if expr.name.startswith('inh_'):
            continue
        target = next(
            (next(mp.monomer.name for cp in s.reaction_pattern.complex_patterns
                  for mp in cp.monomer_patterns if mp.monomer.name in targets)
             for s in expr.expr.free_symbols
             if isinstance(s, Observable) and any(
                 mp.monomer.name in targets
                 for cp in s.reaction_pattern.complex_patterns
                 for mp in cp.monomer_patterns)), None)
        if target is None:
            continue
        expr.expr *= 1 / (1 + inh * affinities[target])
Пример #18
0
def test_stop_if():
    Model()
    Monomer('A')
    Rule('A_synth', None >> A(), Parameter('k', 1))
    Observable('Atot', A())
    Expression('exp_const', k + 1)
    Expression('exp_dyn', Atot + 1)
    sim = BngSimulator(model, verbose=5)
    tspan = np.linspace(0, 100, 101)
    x = sim.run(tspan, stop_if='Atot>9', seed=_BNG_SEED)
    # All except the last Atot value should be <=9
    assert all(x.observables['Atot'][:-1] <= 9)
    assert x.observables['Atot'][-1] > 9
    # Starting with Atot > 9 should terminate simulation immediately
    y = sim.run(tspan, initials=x.species[-1], stop_if='Atot>9')
    assert len(y.observables) == 1
Пример #19
0
def set_base_initial_condition(model, monomer, value):
    # Build up monomer pattern dict
    sites_dict = {}
    for site in monomer.sites:
        if site in monomer.site_states:
            sites_dict[site] = monomer.site_states[site][0]
        else:
            sites_dict[site] = None
    mp = monomer(**sites_dict)
    pname = monomer.name + '_0'
    try:
        p = model.parameters[pname]
        p.value = value
    except KeyError:
        p = Parameter(pname, value)
        model.add_component(p)
        model.initial(mp, p)
Пример #20
0
def test_hpp():
    model = robertson.model
    # Reset equations from any previous network generation
    model.reset_equations()

    A = robertson.model.monomers['A']
    klump = Parameter('klump', 10000, _export=False)
    model.add_component(klump)

    population_maps = [PopulationMap(A(), klump)]

    sim = BngSimulator(model, tspan=np.linspace(0, 1))
    x = sim.run(n_runs=1,
                method='nf',
                population_maps=population_maps,
                seed=_BNG_SEED)
    observables = np.array(x.observables)
    assert len(observables) == 50
Пример #21
0
def set_parameters(model):
    if model.name.startswith('ATM'):
        atm_atr = 'ATM'
    else:
        atm_atr = 'ATR'

    # Set activation parameters to 1e-7
    for param in model.parameters:
        if param.name.startswith('kf') and param.name.find('act') != -1:
            param.value = 1e-7

    # Update Wip1 -| p53 parameter
    model.parameters['kf_pt_act_1'].value = 5e-7

    # Update the Wip1 -| ATM parameter in ATM models
    if atm_atr == 'ATM':
        if not (model.name.endswith('v4a') or model.name.endswith('v4b')):
            model.parameters['kf_pa_act_1'].value = 1e-5
        else:
            model.parameters['kf_pa_dephosphorylation_1'].value = 1e-5

    # Update ATR/ATM autoactivation parameter in v3/v4 models
    if model.name.endswith('v3'):
        model.parameters['kf_aa_act_1'].value = 5e-7
    elif model.name.endswith('v4a'):
        model.parameters['kf_a_autophos_1'].value = 5e-7
    elif model.name.endswith('v4b'):
        model.parameters['kf_aa_phosphorylation_1'].value = 5e-7

    # Set some of the transcription/degradation parameters in v4 models:
    if model.name.startswith('ATM_v4'):
        model.parameters['MDM2_0'].value = 0
        model.parameters['kf_m_deg_1'].value = 8e-2
        model.parameters['kf_tm_synth_1'].value = 2e-2

    # Start with some initial active/phosphorylated ATR/ATM
    model.add_component(Parameter('%sa_0' % atm_atr, 1))
    atm_atr_m = model.monomers[atm_atr]
    if not model.name.startswith('ATM_v4'):
        model.initial(atm_atr_m(activity='active'),
                      model.parameters['%sa_0' % atm_atr])
    else:
        model.initial(atm_atr_m(phospho='p'),
                      model.parameters['%sa_0' % atm_atr])
    def add_positive_feedback_nonspecific(self, i):

        if i == "Ls":
            if self.p_flag:
                Parameter('k_latp_product', self.parameters['k_9_1'])
                Parameter('k_latp_product_grb', self.parameters['k_9_2'])
                Parameter('k_positive_fb', self.parameters['k_9_3'])
            else:
                Parameter('k_latp_product', 0.0003)
                Parameter('k_latp_product_grb', 0.0004)
                Parameter('k_positive_fb', 5.0)

        previous_product = self.non_specific_step_8(i)
        intermediate_product = "LATP_" + previous_product
        intermediate_product_2 = "LATP_" + previous_product + "_Grb"

        if i == "Ls":
            self.add_new_monomer(intermediate_product)
            Rule(
                "{0}_bind".format(intermediate_product),
                LATP() + eval('{0}()'.format(previous_product))
                | eval('{0}()'.format(intermediate_product)), k_latp_product,
                k_p_off_R_pmhc)

            # self.add_observable(intermediate_product)
            self.add_new_monomer(intermediate_product_2)
            Rule(
                "{0}_bind".format(intermediate_product_2),
                eval('{0}()'.format(intermediate_product)) + Grb()
                | eval('{0}()'.format(intermediate_product_2)),
                k_latp_product_grb, k_p_off_R_pmhc)

            Rule(
                "{0}_cat".format(intermediate_product_2),
                eval('{0}()'.format(intermediate_product_2)) >>
                eval('{0}()'.format(intermediate_product)) +
                eval('{0}()'.format(previous_product)), k_positive_fb)

        return previous_product
Пример #23
0
# https://github.com/RuleWorld/bionetgen/blob/master/bng2/Models2/localfunc.bngl
#
# This model demonstrates the use of MultiState and local functions in PySB
#
# Requires Python 3.x or greater (will give a SyntaxError on Python 2.7)

from pysb import Model, Monomer, Parameter, Expression, Rule, \
    Observable, Initial, Tag, MultiState

Model()

Monomer('A', ['b', 'b', 'b'])
Monomer('B', ['a'])
Monomer('C')

Parameter('kp', 0.5)
Parameter('km', 0.1)
Parameter('k_synthC', 1e3)
Parameter('k_degrC', 0.5)
Parameter('Ab_b_b_0', 1.0)
Parameter('Ba_0', 3.0)
Parameter('C_0', 0.0)

Observable('Atot', A())
Observable('Btot', B())
Observable('Ctot', C())
Observable('AB0', A(b=MultiState(None, None, None)), match='species')
Observable('AB1', A(b=MultiState(1, None, None)) % B(a=1), match='species')
Observable('AB2',
           A(b=MultiState(1, 2, None)) % B(a=1) % B(a=2),
           match='species')
    def add_step_10(self, i):
        previous_product_rd, previous_product_rt = self.add_step_9(i)
        product_rt_rd = previous_product_rt + "_Ras_GDP"

        if i == "Ls":
            Parameter('k_rgdp_on_sos_rgtp', 0.001)
            Parameter('k_rgdp_off_sos_rgtp', 0.1)
            Parameter('k_cat_3', 0.038 * 1.7)

        self.add_new_monomer(product_rt_rd)

        Rule(
            '{0}_bind'.format(product_rt_rd),
            eval('{0}()'.format(previous_product_rt)) + Ras_GDP()
            | eval('{0}()'.format(product_rt_rd)), k_rgdp_on_sos_rgtp,
            k_rgdp_off_sos_rgtp)

        Rule(
            '{0}_cat'.format(product_rt_rd),
            eval('{0}()'.format(product_rt_rd)) >>
            eval('{0}()'.format(previous_product_rt)) + Ras_GTP(), k_cat_3)

        product_rd_rd = previous_product_rd + "_Ras_GDP"

        if i == "Ls":
            Parameter('k_rgdp_on_sos_rgdp', 0.0014)
            Parameter('k_rgdp_off_sos_rgdp', 1.0)
            Parameter('k_cat_4', 0.003)

        self.add_new_monomer(product_rd_rd)

        Rule(
            '{0}_bind'.format(product_rd_rd),
            eval('{0}()'.format(previous_product_rd)) + Ras_GDP()
            | eval('{0}()'.format(product_rd_rd)), k_rgdp_on_sos_rgdp,
            k_rgdp_off_sos_rgdp)

        Rule(
            '{0}_cat'.format(product_rd_rd),
            eval('{0}()'.format(product_rd_rd)) >>
            eval('{0}()'.format(previous_product_rd)) + Ras_GTP(), k_cat_4)

        # Deactivate - convert Ras_GTP to Ras_GDP

        product = "Ras_GAP_Ras_GTP"
        new_product = "Ras_GTP"

        if i == "Ls":
            Parameter('k_rgap_on_rgtp', 0.0348)
            Parameter('k_rgap_off_rgtp', 0.2)
            Parameter('k_cat_5', 0.1)

            self.add_new_monomer(product)

            Rule('{0}_bind'.format(product),
                 Ras_GAP() + Ras_GTP() | eval('{0}()'.format(product)),
                 k_rgap_on_rgtp, k_rgap_off_rgtp)

            add_observable(product)

            Rule('{0}_cat'.format(product),
                 eval('{0}()'.format(product)) >> Ras_GAP() + Ras_GDP(),
                 k_cat_5)

            add_observable(new_product)

        return new_product
from pysb import ANY, WILD, Model, Monomer, Parameter, Expression, Initial, Observable, Rule
from pysb.macros import *

Model()

###################################################################################################
# DNA
Monomer('DNA_rpoA', ['type'], {'type': ['P1', 'RBS', 'CDS', 'T1']})
Initial(DNA_rpoA(type = 'P1'), Parameter('t0_DNA_rpoA_P1', 1))
Initial(DNA_rpoA(type = 'RBS'), Parameter('t0_DNA_rpoA_RBS', 1))
Initial(DNA_rpoA(type = 'CDS'), Parameter('t0_DNA_rpoA_CDS', 1))
Initial(DNA_rpoA(type = 'T1'), Parameter('t0_DNA_rpoA_T1', 1))

Monomer('DNA_rpoB', ['type'], {'type': ['P1', 'RBS', 'CDS', 'T1']})
Initial(DNA_rpoB(type = 'P1'), Parameter('t0_DNA_rpoB_P1', 1))
Initial(DNA_rpoB(type = 'RBS'), Parameter('t0_DNA_rpoB_RBS', 1))
Initial(DNA_rpoB(type = 'CDS'), Parameter('t0_DNA_rpoB_CDS', 1))

Monomer('DNA_rpoC', ['type'], {'type': ['RBS', 'CDS', 'T1']})
Initial(DNA_rpoC(type = 'RBS'), Parameter('t0_DNA_rpoC_RBS', 1))
Initial(DNA_rpoC(type = 'CDS'), Parameter('t0_DNA_rpoC_CDS', 1))
Initial(DNA_rpoC(type = 'T1'), Parameter('t0_DNA_rpoC_T1', 1))

Monomer('DNA_rpoD', ['type'], {'type': ['P1', 'RBS', 'CDS', 'T1']})
Initial(DNA_rpoD(type = 'P1'), Parameter('t0_DNA_rpoD_P1', 1))
Initial(DNA_rpoD(type = 'RBS'), Parameter('t0_DNA_rpoD_RBS', 1))
Initial(DNA_rpoD(type = 'CDS'), Parameter('t0_DNA_rpoD_CDS', 1))
Initial(DNA_rpoD(type = 'T1'), Parameter('t0_DNA_rpoD_T1', 1))

Monomer('DNA_rpoE', ['type'], {'type': ['P1', 'RBS', 'CDS', 'T1']})
Initial(DNA_rpoE(type = 'P1'), Parameter('t0_DNA_rpoE_P1', 1))
# Import of \IFN January 2018\Simplified SOCS model - alpha model from
#   Rulebender to PySB. This is just a model file - must be run from a run file
from pysb import Model, Parameter, Expression, Initial, Monomer, Observable, Rule, WILD
# Begin Model
Model()
# =============================================================================
# # Parameters
# =============================================================================
Parameter('NA', 6.022E23)  # Avogadro's number (molecues/mol)
Parameter('PI', 3.142)  # no unit

Parameter('rad_cell', 30E-6)  # radius of cell in m approx 30 micron
Parameter('cell_thickness', 8E-6)  # height, m
Parameter('cell_dens', 1E5)  # density of cells , /L
Parameter('width_PM', 1E-6)  # effective width of membrane , m

Expression('volEC', 1 / cell_dens)  # vol. extracellular space , L
Expression(
    'volPM', 2 * rad_cell**2 +
    rad_cell * cell_thickness * 4)  # virtual vol. of plasma membrane , L
Expression('volCP', cell_thickness * rad_cell**2)  # vol. of cytoplasm , L

Parameter('IFN', 1E-9)  # initial concentration in Molar
Expression('I', IFN * volEC *
           NA)  # number of copies per cell (~ 6.022e8 copies per cell)
Expression('Ia', I)
#Expression('Ib', I)
#Parameter('r', 0) # Receptor assymmetry
#Parameter('R', 0) #
Parameter('R1', 2000)  #(2000/7.2e-15)*volCP#(8000/2.76e-9)*volPM#R -r#
Parameter(
Пример #27
0
    'S222': ['u', 'p']
})
Monomer('MAP2K2', ['S226', 'S222', 'inh'], {
    'S226': ['u', 'p'],
    'S222': ['u', 'p']
})
Monomer('MAPK1', ['Y187', 'T185', 'inh'], {
    'Y187': ['u', 'p'],
    'T185': ['u', 'p']
})
Monomer('MAPK3', ['T202', 'Y204', 'inh'], {
    'T202': ['u', 'p'],
    'Y204': ['u', 'p']
})

Parameter('EGF_eq', 100.0)
Parameter('EGF_0', 0.0)
Parameter('EGF_EGF_koff', 0.1)
Parameter('EGF_EGF_kd', 1.0)
Parameter('EGFR_eq', 100.0)
Parameter('EGFR_dephosphorylation_Y1173_base_kcat', 1.0)
Parameter('INPUT_EGFR_dephosphorylation_Y1173_base_kcat', 0.0)
Parameter('ERBB2_eq', 100.0)
Parameter('ERBB2_dephosphorylation_Y1248_base_kcat', 1.0)
Parameter('INPUT_ERBB2_dephosphorylation_Y1248_base_kcat', 0.0)
Parameter('EGFR_phosphorylation_Y1173_EGF_kcat', 1.0)
Parameter('INPUT_EGFR_phosphorylation_Y1173_EGF_kcat', 0.0)
Parameter('ERBB2_phosphorylation_Y1248_EGFR__Y1173_p_kcat', 1.0)
Parameter('INPUT_ERBB2_phosphorylation_Y1248_EGFR__Y1173_p_kcat', 0.0)
Parameter('RAF1_eq', 100.0)
Parameter('RAF1_dephosphorylation_S338_base_kcat', 1.0)
# Import of \IFN January 2018\Detailed IFN model - alpha model from
# Rulebender to PySB. This is just a model file - must be run from a run file
# Importantly, there cannot be any use of PySB Expressions in order to use
# the export functions from PySB.
# =============================================================================
# The major difference in usage for this file is that one cannot simply pass the
# concentration of IFN as a parameter for the simulation any more. Instead, pass
# the pre-calculated value of IFN*volEC*NA to the parameter I
# =============================================================================

from pysb import Model, Parameter, Rule, Monomer, Initial, Observable, WILD
Model()
# =============================================================================
# # Parameters
# =============================================================================
Parameter('NA', 6.022E23)  # Avogadro's number (molecues/mol)
Parameter('PI', 3.142)  # no unit

Parameter('rad_cell', 30E-6)  # radius of cell in m approx 30 micron
Parameter('cell_thickness', 8E-6)  # height, m
Parameter('cell_dens', 1E5)  # density of cells , /L
Parameter('width_PM', 1E-6)  # effective width of membrane , m

#vol. extracellular space , L
Parameter('volEC', 1E-5)  # = 1/cell_dens

# virtual vol. of plasma membrane , L
Parameter('volPM', 2.76e-09)  # = 2*rad_cell**2 + rad_cell*cell_thickness*4

# vol. of cytoplasm , L
Parameter('volCP', 7.2e-15)  # = cell_thickness*rad_cell**2
Пример #29
0
"""

from pysb import Model, Monomer, Parameter, Initial, Rule, Observable
from pysb.macros import bind, bind_complex, catalyze

Model()

#Define individual species in model
Monomer('COX2', ['allo', 'cat'])  #Cyclooxygenase-2 enzyme
Monomer('AG', ['b'])  #2-arachidonoylglycerol, a substrate of COX2
Monomer('AA', ['b'])  #arachidonic acid, a substrate of COX2
Monomer('PG')  #Prostaglandin, product of COX2 turnover of AA
Monomer('PGG')  #Prostaglandin glycerol, product of COX2 turnover of 2-AG

#Initial starting concentrations in micromolar
Parameter('COX2_0', 15e-3)
Parameter('AG_0', 16)
Parameter('AA_0', 16)
Parameter('PG_0', 0)
Parameter('PGG_0', 0)

Initial(COX2(allo=None, cat=None), COX2_0)
Initial(AG(b=None), AG_0)
Initial(AA(b=None), AA_0)
Initial(PG(), PG_0)
Initial(PGG(), PGG_0)

#All kf parameters are in units of inverse microM*s
#All kr parameters are in units of inverse s
#All kcat parameters are in units of inverse s
#the forward reaction is association; the reverse is disassociation
Пример #30
0
Monomer('Bcl2', ['bf', 'state'], {'state': ['C', 'M']})
Monomer('BclxL', ['bf', 'state'], {'state': ['C', 'M']})
Monomer('Mcl1', ['bf', 'state'], {'state': ['C', 'M']})
Monomer('Bad', ['bf', 'state'], {'state': ['C', 'M']})
Monomer('Noxa', ['bf', 'state'], {'state': ['C', 'M']})
Monomer('CytoC', ['bf', 'state'], {'state': ['M', 'C', 'A']})
Monomer('Smac', ['bf', 'state'], {'state': ['M', 'C', 'A']})
Monomer('Apaf', ['bf', 'state'], {'state': ['I', 'A']})
Monomer('Apop', ['bf'])
Monomer('C3', ['bf', 'state'], {'state': ['pro', 'A', 'ub']})
Monomer('C6', ['bf', 'state'], {'state': ['pro', 'A']})
Monomer('C9', ['bf'])
Monomer('PARP', ['bf', 'state'], {'state': ['U', 'C']})
Monomer('XIAP', ['bf'])

Parameter('L_0', 3000.0)
Parameter('R_0', 200.0)
Parameter('Flip_0', 100.0)
Parameter('C8_0', 20000.0)
Parameter('BAR_0', 1000.0)
Parameter('bind_L_R_to_LR_kf', 4e-07)
Parameter('bind_L_R_to_LR_kr', 0.001)
Parameter('convert_LR_to_DISC_kc', 1e-05)
Parameter('bind_DISC_C8pro_to_DISCC8pro_kf', 1e-06)
Parameter('bind_DISC_C8pro_to_DISCC8pro_kr', 0.001)
Parameter('catalyze_DISCC8pro_to_DISC_C8A_kc', 1.0)
Parameter('bind_C8A_BidU_to_C8ABidU_kf', 1e-06)
Parameter('bind_C8A_BidU_to_C8ABidU_kr', 0.001)
Parameter('catalyze_C8ABidU_to_C8A_BidT_kc', 1.0)
Parameter('bind_DISC_flip_kf', 1e-06)
Parameter('bind_DISC_flip_kr', 0.001)