def create_supplement_figure_8(): """ plots EARM observable """ from models.earm_lopez_embedded_flat import model time = np.linspace(0, 20000, 101) observable_name = 'aSmac' new_params = load_params('Params/earm_parameter_set_one.txt') save_name = 'supp_figure_8_earm_output_parameter_set_one' update_param_vals(model, new_params) solver = pysb.integrate.Solver(model, time, rtol=RTOL, atol=ATOL, integrator='lsoda', mxstep=mxstep) solver.run() ysim_momp_norm = solver.yobs[observable_name] / np.nanmax( solver.yobs[observable_name]) st, sc, sk = scipy.interpolate.splrep(time, ysim_momp_norm) try: t10 = scipy.interpolate.sproot((st, sc - 0.10, sk))[0] t90 = scipy.interpolate.sproot((st, sc - 0.90, sk))[0] except IndexError: t10 = 0 t90 = 0 td = (t10 + t90) / 2 plt.figure() plt.plot(time / 3600, ysim_momp_norm, 'b-', linewidth=2) plt.xlabel("Time (hr)", fontsize=16) plt.ylabel('aSmac / SMAC_0', fontsize=16) plt.plot(td / 3600, .5, 'ok', ms=15, mfc='none', mew=3) plt.axvline(td / 3600, linestyle='dashed', color='black') plt.ylim(-.05, 1.05) plt.xticks(fontsize=16) plt.yticks(fontsize=16) plt.savefig('%s/%s_%s.png' % ('Figures', save_name, observable_name), dpi=150) plt.savefig('%s/%s_%s.eps' % ('Figures', save_name, observable_name)) plt.close() print_model_stats(model)
outdir = '/Users/lopezlab/temp/EARM/' outfiles = {} for name in obj_names: outfiles[name+'_sens'] = os.path.join(outdir,name+"_sens_scipy.txt") outfiles[name+'_sens_t'] = os.path.join(outdir,name+"_sens_t_scipy.txt") outfiles[name+'_sens_2'] = os.path.join(outdir,name+"_sens_2_scipy.txt") OUTPUT = {key : open(file, 'a') for key,file in outfiles.items()} for file in OUTPUT.values(): file.write("-----"+str(datetime.datetime.now())+"-----\n") file.write("n") for i in range(len(model.parameters_rules())): file.write("\t"+"p_"+str(i)) file.write("\n") # Best fit parameters param_dict = load_params("/Users/lopezlab/git/earm/EARM_2_0_M1a_fitted_params.txt") for param in model.parameters: if param.name in param_dict: param.value = param_dict[param.name] # Load experimental data file exp_data = np.genfromtxt('/Users/lopezlab/git/earm/xpdata/forfits/EC-RP_IMS-RP_IC-RP_data_for_models.csv', delimiter=',', names=True) # Time points (same as for experiments) tspan = exp_data['Time'] # plt.figure() # plt.plot(tspan,exp_data['ECRP'],linewidth=3,label='ECRP') # plt.plot(tspan,exp_data['norm_ECRP'],linewidth=3,label='norm_ECRP') # plt.legend(loc='lower right') #
import numpy as np import matplotlib matplotlib.use('AGG') import matplotlib.pyplot as plt import scipy.interpolate import pysb from earm.lopez_embedded import model from pysb.bng import generate_equations from pysb.integrate import odesolve from pysb.util import update_param_vals, load_params from pysb_cupsoda import set_cupsoda_path, CupsodaSolver tspan = np.linspace(0, 20000, 2000) option = '911' if option == '911': new_params = load_params('Params/pars_embedded_911.txt') savename = 'parameters_911_gpu_new' directory = 'OUT' if option == '486': new_params = load_params('Params/pars_embedded_486.txt') savename = 'parameters_486_gpu_new' directory = 'OUT' update_param_vals(model, new_params) set_cupsoda_path("/home/pinojc/git/cupSODA") run = 'cupSODA' #run = 'scipy' ATOL = 1e-6 RTOL = 1e-6
import numpy as np import scipy.interpolate import matplotlib.pyplot as plt import datetime from multiprocessing import Pool, Value, Queue import multiprocessing import multiprocessing as mp import math obj_names = ['emBid', 'ecPARP', 'e2'] # observables = ['mBid', 'aSmac' , 'cPARP'] # Best fit parameters param_dict = load_params("/home/pinojc/Projects/earm/EARM_2_0_M1a_fitted_params.txt") for param in model.parameters: if param.name in param_dict: param.value = param_dict[param.name] # Load experimental data file exp_data = np.genfromtxt('/home/pinojc/Projects/earm/xpdata/forfits/EC-RP_IMS-RP_IC-RP_data_for_models.csv', delimiter=',', names=True) # Build time points for the integrator, using the same time scale as the # experimental data but with greater resolution to help the integrator converge. #ntimes = len(exp_data['Time']) # Factor by which to increase time resolution #tmul = 20 # Do the sampling such that the original experimental timepoints can be # extracted with a slice expression instead of requiring interpolation. #tspan = np.linspace(0.0, exp_data['Time'][-1], (ntimes-1) * tmul + 1)
for name in obj_names: outfiles[name + '_sens'] = os.path.join(outdir, name + "_sens_scipy.txt") outfiles[name + '_sens_t'] = os.path.join(outdir, name + "_sens_t_scipy.txt") outfiles[name + '_sens_2'] = os.path.join(outdir, name + "_sens_2_scipy.txt") OUTPUT = {key: open(file, 'a') for key, file in outfiles.items()} for file in OUTPUT.values(): file.write("-----" + str(datetime.datetime.now()) + "-----\n") file.write("n") for i in range(len(model.parameters_rules())): file.write("\t" + "p_" + str(i)) file.write("\n") # Best fit parameters param_dict = load_params( "/Users/lopezlab/git/earm/EARM_2_0_M1a_fitted_params.txt") for param in model.parameters: if param.name in param_dict: param.value = param_dict[param.name] # Load experimental data file exp_data = np.genfromtxt( '/Users/lopezlab/git/earm/xpdata/forfits/EC-RP_IMS-RP_IC-RP_data_for_models.csv', delimiter=',', names=True) # Time points (same as for experiments) tspan = exp_data['Time'] # plt.figure() # plt.plot(tspan,exp_data['ECRP'],linewidth=3,label='ECRP')
import multiprocessing import multiprocessing as mp import math from earm.lopez_embedded_different_max_pore import createModel minpore = '5' maxpore = '5' model = createModel(int(minpore),int(maxpore)) obj_names = ['emBid', 'ecPARP', 'e2'] # observables = ['mBid', 'aSmac' , 'cPARP'] # Best fit parameters #param_dict = load_params("/home/pinojc/Projects/earm/EARM_2_0_M1a_fitted_params.txt") param_dict=load_params('/home/pinojc/Projects/EARM_sensitivity_to_pore/DiffMaxPore/min5_max_5_fitted_params.txt') for param in model.parameters: if param.name in param_dict: param.value = param_dict[param.name] # Load experimental data file exp_data = np.genfromtxt('/home/pinojc/Projects/earm/xpdata/forfits/EC-RP_IMS-RP_IC-RP_data_for_models.csv', delimiter=',', names=True) # # Build time points for the integrator, using the same time scale as the # # experimental data but with greater resolution to help the integrator converge. # ntimes = len(exp_data['Time']) # # Factor by which to increase time resolution # tmul = 20 # # Do the sampling such that the original experimental timepoints can be # # extracted with a slice expression instead of requiring interpolation.