Пример #1
0
class Earm10ODESuite(object):
    def setup(self):
        self.nsims = 100
        self.timer = timeit.default_timer
        self.model = earm_1_0.model
        self.model.reset_equations()
        self.parameter_set = np.repeat(
            [[p.value for p in self.model.parameters]], self.nsims, axis=0)
        integrator_options_common = {
            'model': self.model,
            'tspan': np.linspace(0, 1000, 101),
            'atol': 1e-6,
            'rtol': 1e-6,
            'mxsteps': 20000,
            'param_values': self.parameter_set
        }

        self.sim_lsoda = ScipyOdeSimulator(integrator='lsoda',
                                           **integrator_options_common)
        self.sim_cupsoda = CupSodaSimulator(**integrator_options_common)

    def time_scipy_lsoda(self):
        self.sim_lsoda.run()

    def time_cupsoda(self):
        self.sim_cupsoda.run()
Пример #2
0
    def setup(self):
        self.nsims = 100
        self.timer = timeit.default_timer
        self.model = earm_1_0.model
        self.model.reset_equations()
        self.parameter_set = np.repeat(
            [[p.value for p in self.model.parameters]], self.nsims, axis=0)
        integrator_options_common = {
            'model': self.model,
            'tspan': np.linspace(0, 20000, 101),
            'param_values': self.parameter_set
        }

        self.sim_lsoda = ScipyOdeSimulator(
            integrator='lsoda',
            compiler='cython',
            integrator_options={'atol': 1e-6, 'rtol': 1e-6, 'mxstep': 20000},
            **integrator_options_common
        )
        self.sim_lsoda_no_compiler_directives = ScipyOdeSimulator(
            integrator='lsoda',
            compiler='cython',
            cython_directives={},
            integrator_options={'atol': 1e-6, 'rtol': 1e-6, 'mxstep': 20000},
            **integrator_options_common
        )

        self.sim_cupsoda = CupSodaSimulator(
            integrator_options={'atol': 1e-6, 'rtol': 1e-6, 'max_steps': 20000},
            **integrator_options_common
        )
Пример #3
0
    def setup(self):
        self.nsims = 100
        self.timer = timeit.default_timer
        self.model = earm_1_0.model
        self.model.reset_equations()
        self.parameter_set = np.repeat(
            [[p.value for p in self.model.parameters]], self.nsims, axis=0)
        integrator_options_common = {
            'model': self.model,
            'tspan': np.linspace(0, 20000, 101),
            'param_values': self.parameter_set
        }

        self.sim_lsoda = ScipyOdeSimulator(integrator='lsoda',
                                           compiler='cython',
                                           integrator_options={
                                               'atol': 1e-6,
                                               'rtol': 1e-6,
                                               'mxstep': 20000
                                           },
                                           **integrator_options_common)
        self.sim_lsoda_no_compiler_directives = ScipyOdeSimulator(
            integrator='lsoda',
            compiler='cython',
            cython_directives={},
            integrator_options={
                'atol': 1e-6,
                'rtol': 1e-6,
                'mxstep': 20000
            },
            **integrator_options_common)

        self.sim_cupsoda = CupSodaSimulator(integrator_options={
            'atol': 1e-6,
            'rtol': 1e-6,
            'max_steps': 20000
        },
                                            **integrator_options_common)
    elif parameter_idx in [91]:
        samples = np.random.uniform(low=602214.086, high=1806642.258, size=size)
        return samples
    else:
        raise ValueError('Distribution is not defined for parameter index {}'.format(parameter_idx))


parameters = np.array([p.value for p in model.parameters])

nsamples = 50000
repeated_parameter_values = np.tile(parameters, (nsamples, 1))

for par_idx in kr_pars_to_sample:
    repeated_parameter_values[:, par_idx] = sample_kr_uniform(nsamples)

for kf_idx, kr_idx in zip(kf_pars_to_calculate, kr_pars_to_sample):
    repeated_parameter_values[:, kf_idx] = repeated_parameter_values[:, kr_idx] / sample_kd_uniform(kr_idx, nsamples)
np.save('pars_sampled_kd_bcl2.npy', repeated_parameter_values)
#
tspan = np.linspace(0, 20000, 100)

vol= 1e-19
integrator_opt = {'rtol': 1e-6, 'atol': 1e-6, 'mxsteps': 20000}
sims = CupSodaSimulator(model, tspan=tspan, gpu=0, memory_usage='shared_constant', vol=vol,
                        integrator_options=integrator_opt).run(param_values=repeated_parameter_values)
sims.save('simulations_sampled_kd_bcl2.h5')

signatures = run_tropical_multi(model=model, simulations=sims, cpu_cores=20, verbose=True)

with open('signatures_sampled_kd_bcl2.pickle', 'wb') as handle:
    pickle.dump(signatures, handle, protocol=pickle.HIGHEST_PROTOCOL)
Пример #5
0
def cupsoda(model, start=0, finish=10, points=10, path='/opt/conda/bin/'):
    set_path('cupsoda', path)
    return CupSodaSimulator(model, linspace(start, finish,
                                            points + 1)).run().dataframe
Пример #6
0
unique_pars = unique_pars[max_idx[:5000]]
par_set_calibrated = np.copy(param_values)
all_par_set_calibrated = np.tile(par_set_calibrated, (len(unique_pars), 1))
all_par_set_calibrated[:, rates_of_interest_mask] = 10**unique_pars

tspan = np.linspace(0, 60, 100)

arrestin_idx = 44
kcat_idx = [36, 37]

tspan_eq = np.linspace(0, 100, 100)
integrator_opt = {'rtol': 1e-6, 'atol': 1e-6, 'mxsteps': 20000}

cupsoda_solver = CupSodaSimulator(model,
                                  tspan=tspan_eq,
                                  gpu=0,
                                  obs_species_only=False,
                                  memory_usage='shared_constant',
                                  integrator_options=integrator_opt)

pars_eq = np.copy(all_par_set_calibrated)
pars_eq[:, kcat_idx] = 0
conc_eq = pre_equilibration(cupsoda_solver, param_values=pars_eq)[1]

sims_final = CupSodaSimulator(model,
                              tspan=tspan,
                              gpu=0,
                              obs_species_only=False,
                              memory_usage='shared_constant',
                              integrator_options=integrator_opt).run(
                                  param_values=all_par_set_calibrated,
                                  initials=conc_eq)
Пример #7
0
max_arrestin = 100
arrestin_initials = np.linspace(0, max_arrestin, n_conditions)
par_clus1 = par_set_calibrated

arrestin_idx = 44
kcat_idx = [36, 37]
repeated_parameter_values = np.tile(par_clus1, (n_conditions, 1))
repeated_parameter_values[:, arrestin_idx] = arrestin_initials
np.save('arrestin_diff_IC_par0.npy', repeated_parameter_values)

tspan_eq = np.linspace(0, 100, 100)
integrator_opt = {'rtol': 1e-6, 'atol': 1e-6, 'mxsteps': 20000}

cupsoda_solver = CupSodaSimulator(model,
                                  tspan=tspan_eq,
                                  gpu=0,
                                  obs_species_only=False,
                                  memory_usage='shared_constant',
                                  integrator_options=integrator_opt)

pars_eq = np.copy(repeated_parameter_values)
pars_eq[:, kcat_idx] = 0
conc_eq = pre_equilibration(cupsoda_solver, param_values=pars_eq)[1]

sims_final = CupSodaSimulator(model,
                              tspan=tspan,
                              gpu=0,
                              obs_species_only=False,
                              memory_usage='shared_constant',
                              integrator_options=integrator_opt).run(
                                  param_values=repeated_parameter_values,
                                  initials=conc_eq)