def test_lipo_sites_builder_abbrev():
    model_dict = {'builder': 'lipo_sites',
                  'activation': 1,
                  'baxtranslocation': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
    eq_(bd.model.name, 'ls_Baxtr1Activ1')
def test_one_cpt_builder_abbrev():
    model_dict = {'builder': 'one_cpt',
                  'activation': 1,
                  'baxtranslocation': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
    eq_(bd.model.name, '1c_Baxtr1Activ1')
def test_translocation_1():
    """Check translocation by checking for Bax_mono_translocates_sol_to_ves."""
    model_dict = {'baxtranslocation': 1,
                  'bidtranslocation': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
    print bd.model.rules
    ok_(bd.model.rules['tBid_translocates_sol_to_ves'])
    ok_(bd.model.rules['Bax_mono_translocates_sol_to_ves'])
Exemplo n.º 4
0
from tbidbaxlipo.models.one_cpt import Builder
from pylab import *
from pysb.integrate import odesolve

b = Builder()
b.build_model_t()

# Do liposome titration
lipo_concs = logspace (-9, 3, 50)
t = linspace(0, 500, 200)

ion()
figure()
tBid_0 = b.model.parameters['tBid_0'].value
Bax_0 = b.model.parameters['Bax_0'].value

tBid_fracs_bound = np.zeros(len(lipo_concs))
Bax_fracs_bound = np.zeros(len(lipo_concs))

for i, lipo_conc in enumerate(lipo_concs):
    b.model.parameters['Vesicles_0'].value = lipo_conc
    x = odesolve(b.model, t)
    plot(t, x['mtBid'] / tBid_0)
    plot(t, x['mBax'] / Bax_0)
    tBid_fracs_bound[i] = x['mtBid'][-1] / tBid_0
    Bax_fracs_bound[i] = x['mBax'][-1] / Bax_0

show()

figure()
plot(lipo_concs, tBid_fracs_bound)
Exemplo n.º 5
0
        'Bax_NBD_0': 100.,
        'tBid_0': 20.,
        'tBid_transloc_kf': 10**-1.89187047,
        'tBid_transloc_kr': 10**-4.22923156,
        'Bax_transloc_kf': 10**-5.47509186,
        'Bax_transloc_kr': 10**-4.50648375,
        'tBid_Bax_mem_bh3_kf': 10**-5.07143377,
        'tBid_Bax_mem_bh3_kr': 10**3.70925668,
        'tBid_Bax_ins_bh3_kc': 10**-1.46660821,
        'c1_scaling': 10**0.982916,
        'c2_scaling': 10**0.32449226,
        'bid_fret1': 10**1.92229914,
}
"""

bd = Builder(params_dict=params_dict)
bd.build_model_from_dict(model_dict)
print(bd.model.parameters)
t = time_36
s = Solver(bd.model, t)
s.run()

n_species = s.y.shape[1]

plt.ion()
for spec_ix in range(n_species):
    plt.figure()
    plt.title(bd.model.species[spec_ix])
    plt.plot(t, s.y[:,spec_ix])

#plt.ion()
Exemplo n.º 6
0
            'model' not in kwargs or \
            'nbd_observables' not in kwargs:
        raise Exception('One or more needed arguments was not specified! ' \
                'Arguments must include nbd_sites, random_seed, model, ' \
                'nbd_observables and nsteps.')

    # Because the NBD site(s) to fit has to be specified when the model
    # builder object is created, we get this arg first.
    # If more than one NBD site has been specified, it should be separated:
    nbd_sites = kwargs['nbd_sites'].split(SEP_CHAR)
    for site in nbd_sites:
        if site not in nbd_site_names:
            raise Exception('%s is not an allowed NBD site!' % site)

    # Now that we have the NBD site we can instantiate the Builder:
    builder = Builder(nbd_sites=nbd_sites)

    # The observable associated with the NBD site signal also has to be
    # specified:
    observables = [o.name for o in builder.model.observables]

    # Again, parse in case there is more than one observable:
    nbd_observables = kwargs['nbd_observables'].split(SEP_CHAR)
    for nbd_obs in nbd_observables:
        if nbd_obs not in observables:
            raise Exception('%s is not an allowed NBD observable!' % nbd_obs)

    # Make sure the number of nbd sites matches the number of observables:
    if len(nbd_sites) != len(nbd_observables):
        raise Exception('The number of nbd_sites must match the number of '
                        'nbd_observables!')
from tbidbaxlipo.models.one_cpt import Builder
from pysb.integrate import Solver
import numpy as np
from matplotlib import pyplot as plt
from tbidbaxlipo.util import fitting

b = Builder()
#b.build_model_nbd_2_conf()
b.build_model_nbd_2_conf_dimer()

t = np.linspace(0, 100000, 1e3)
sol = Solver(b.model, t)

plt.ion()
plt.close('all')

bax_concs = np.logspace(0, 3, 30)
k_list = []
fmax_list = []

for bax_ix, bax_conc in enumerate(bax_concs):
    b.model.parameters['Bax_0'].value = bax_conc
    #b.model.parameters['Vesicles_0'].value = bax_conc
    sol.run()
    plt.figure('NBD')
    plt.plot(t, sol.yexpr['NBD'])
    fmax = fitting.Parameter(5.)
    k = fitting.Parameter(5e-4)
    def exp_func(t):
        return fmax()*(1 - np.exp(-k()*t)) + 1.
    fitting.fit(exp_func, [k, fmax], sol.yexpr['NBD'], t)
Exemplo n.º 8
0
    nbd_site = '47'
    activator = 'Bid'
    rep_index = 1
    rt = df[(activator, 'Release', nbd_site, rep_index, 'TIME')].values
    ry = df[(activator, 'Release', nbd_site, rep_index, 'VALUE')].values
    nt = df[(activator, 'NBD', nbd_site, rep_index, 'TIME')].values
    ny = df[(activator, 'NBD', nbd_site, rep_index, 'VALUE')].values
    ry = ry / 100.
    t = rt
    lipo_conc = 1.9

    # Build the MCMCOpts
    # ==================
    from tbidbaxlipo.models.one_cpt import Builder
    #from tbidbaxlipo.models.enz_cpt import Builder
    builder = Builder()
    #builder.build_model_nbd_terbium()
    builder.build_model_nbd_terbium_c2_pores()

    # We set the random_seed here because it affects our choice of initial
    # values
    random_seed = 1
    np.random.seed(random_seed)

    opts = bayessb.MCMCOpts()
    opts.model = builder.model
    opts.tspan = t
    opts.estimate_params = builder.estimate_params
    #opts.estimate_params = [p for p in b.model.parameters
    #                        if not p.name.endswith('_0')]
    #opts.initial_values = [p.value for p in b.estimate_params]
Exemplo n.º 9
0
from tbidbaxlipo.models.one_cpt import Builder
import numpy as np
from matplotlib import pyplot as plt
from pysb.integrate import odesolve

b = Builder()
b.translocate_Bax()
b.basal_Bax_activation()
b.Bax_nmerizes(4)
b.pores_from_Bax_nmers(4)

t = np.linspace(0, 10000, 1000)
x = odesolve(b.model, t)
plt.ion()
plt.figure()
plt.plot(t, x['pores'])
Exemplo n.º 10
0
def test_error_on_bleach_without_nbd():
    model_dict = {'baxtranslocation': 1,
                  'activation': 1,
                  'bleach': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
Exemplo n.º 11
0
def test_key_error_on_unknown_feature():
    model_dict = {'asdf': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
Exemplo n.º 12
0
def test_error_on_unknown_implementation():
    model_dict = {'baxtranslocation': 9}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
Exemplo n.º 13
0
def test_model_name_sort_order():
    model_dict = {'activation': 1,
                  'baxtranslocation': 1}
    bd = Builder()
    bd.build_model_from_dict(model_dict)
    eq_(bd.model.name, 'Baxtr1Activ1')