def setUpClass(cls): mass_con_crnt_obj = crnt4sbml.CRNT("./sbml_files/Fig1Ci.xml") cls.mass_con_c_graph_list = cls.generate_c_graph_list( mass_con_crnt_obj, True) cls.mass_con_low_def_list = cls.generate_low_def_list( mass_con_crnt_obj) cls.mass_con_list = cls.generate_mass_con_list(mass_con_crnt_obj) semi_diff_crnt_obj = crnt4sbml.CRNT("./sbml_files/Fig1Cii.xml") cls.semi_diff_c_graph_list = cls.generate_c_graph_list( semi_diff_crnt_obj, False) cls.semi_diff_low_def_list = cls.generate_low_def_list( semi_diff_crnt_obj) cls.semi_diff_list = cls.generate_semi_diff_list(semi_diff_crnt_obj) low_def_crnt_obj = crnt4sbml.CRNT("./sbml_files/feinberg_ex3_13.xml") cls.low_def_c_graph_list = cls.generate_c_graph_list( low_def_crnt_obj, False) cls.low_def_low_def_list = cls.generate_low_def_list(low_def_crnt_obj)
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/open_fig5B.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() approach = network.get_semi_diffusive_approach() print("") approach.print_decision_vector() print("Key species:") print(approach.get_key_species()) print("") print("Non key species:") print(approach.get_non_key_species()) print("") print("Boundary species:") print(approach.get_boundary_species()) bounds = [(1e-3, 1e2)]*17 params_for_global_min, obj_fun_val_for_params = approach.run_optimization(bounds=bounds, iterations=50)
import sys sys.path.insert(0, "..") import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/conradi_paper.xml") #network = crnt4sbml.CRNT("../sbml_files/Song2.xml") #network = crnt4sbml.CRNT("../sbml_files/GuanyuWang.xml") network.basic_report() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() opt = network.get_mass_conservation_approach() #sys.exit() bounds, concentration_bounds = opt.get_optimization_bounds() print(bounds) print(concentration_bounds) print(opt.get_conservation_laws()) params_for_global_min, obj_fun_val_for_params = opt.run_optimization( bounds=bounds, iterations=1000, concentration_bounds=concentration_bounds) # multistable_param_ind, plot_specifications = opt.run_greedy_continuity_analysis(species="s1", parameters=params_for_global_min, # auto_parameters={'PrincipalContinuationParameter': 'C2'})
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/p85-p110-PTEN.xml") approach = network.get_mass_conservation_approach() bounds, concentration_bounds = approach.get_optimization_bounds() params_for_global_min, obj_fun_val_for_params = approach.run_optimization( bounds=bounds, iterations=5000, concentration_bounds=concentration_bounds, parallel_flag=True) if approach.get_my_rank() == 0: network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") print("Decision Vector:") print(approach.get_decision_vector()) print("") print("Species for concentration bounds:")
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/conradi2007.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") opt = network.get_mass_conservation_approach() print("Decision Vector:") print(opt.get_decision_vector()) print("") print("Species for concentration bounds:") print(opt.get_concentration_bounds_species()) bounds = [(1e-2, 1e2)] * 20 concentration_bounds = [(1e-2, 1e2)] * 7 params_for_global_min, obj_fun_val_for_params = opt.run_optimization( bounds=bounds, concentration_bounds=concentration_bounds, iterations=100) multistable_param_ind, plot_specifications = opt.run_continuity_analysis( species='s1',
import numpy import pandas import sympy import scipy.integrate as itg #from plotnine import ggplot, aes, geom_line, ylim, scale_color_distiller, facet_wrap, theme_bw, geom_path, geom_point import time import sys import sys sys.path.insert(0, "..") import crnt4sbml # 1. network = crnt4sbml.CRNT("../sbml_files/DoublePhos.xml") signal = 'C2' response = 's4' # 2. # network = crnt4sbml.CRNT("../sbml_files/Fig4C_closed.xml") # 3. #network = crnt4sbml.CRNT("../sbml_files/closed_fig5A.xml") # 4. # network = crnt4sbml.CRNT("../sbml_files/irene2014.xml") # 5. # network = crnt4sbml.CRNT("../sbml_files/irene2009.xml")
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/closed_fig5A.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") approach = network.get_mass_conservation_approach() print("Decision Vector:") print(approach.get_decision_vector()) print("") print("Species for concentration bounds:") print(approach.get_concentration_bounds_species()) bounds = [(1e-2, 1e2)] * 12 concentration_bounds = [(1e-2, 1e2)] * 6 params_for_global_min, obj_fun_val_for_params = approach.run_optimization( bounds=bounds, concentration_bounds=concentration_bounds, iterations=100) multistable_param_ind, plot_specifications = approach.run_continuity_analysis( species="s9",
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/feinberg_ex3_13.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() opt = network.get_mass_conservation_approach()
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/hervagault_canu.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") approach = network.get_mass_conservation_approach() print("Decision Vector:") print(approach.get_decision_vector()) print("") print("Species for concentration bounds:") print(approach.get_concentration_bounds_species()) bounds = [(1e-2, 1e2)] * 11 concentration_bounds = [(1e-2, 1e2)] * 4 params_for_global_min, obj_fun_val_for_params = approach.run_optimization( bounds=bounds, concentration_bounds=concentration_bounds, iterations=100) multistable_param_ind, plot_specifications = approach.run_continuity_analysis( species="s1",
y_r_matrix = approach.get_y_r_matrix() f = io.StringIO() with contextlib.redirect_stdout(f): approach.print_decision_vector() print_decision_vector = f.getvalue() f.close() return [ boundary_species, decision_vector, key_species, non_key_species, mu_vector, s_to_matrix, symbolic_objective_fun, symbolic_polynomial_fun, y_r_matrix, print_decision_vector ] mass_con_crnt_obj = crnt4sbml.CRNT("../sbml_files/Fig1Ci.xml") mass_con_c_graph_list = generate_c_graph_list(mass_con_crnt_obj, True) mass_con_low_def_list = generate_low_def_list(mass_con_crnt_obj) mass_con_list = generate_mass_con_list(mass_con_crnt_obj) # semi_diff_crnt_obj = crnt4sbml.CRNT("../sbml_files/Fig1Cii.xml") # semi_diff_c_graph_list = generate_c_graph_list(semi_diff_crnt_obj, False) # semi_diff_low_def_list = generate_low_def_list(semi_diff_crnt_obj) # semi_diff_list = generate_semi_diff_list(semi_diff_crnt_obj) #print(semi_diff_list) # low_def_crnt_obj = crnt4sbml.CRNT("../sbml_files/feinberg_ex3_13.xml") # low_def_c_graph_list = generate_c_graph_list(low_def_crnt_obj, False) # low_def_low_def_list = generate_low_def_list(low_def_crnt_obj) with open('mass_con_c_graph_list.pickle', 'wb') as outf:
import sys sys.path.insert(0, "..") import crnt4sbml import numpy import sympy import pandas import scipy.integrate as itg import dill from plotnine import ggplot, aes, geom_line, ylim, scale_color_distiller, facet_wrap, theme_bw, geom_path, geom_point, labs, annotate from matplotlib import rc rc('text', usetex=True) # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_4c.xml") # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_1.xml") network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts.xml") signal = "C2" # "C1" response = "s11" # network.basic_report() # network.print_c_graph() GA = network.get_general_approach(signal=signal, response=response, fix_reactions=False) # GA = network.get_general_approach() # print(GA.get_conservation_laws()) # GA.initialize_general_approach(signal=signal, response=response) print(GA.get_conservation_laws())
import crnt4sbml import numpy import pandas import sympy import scipy.integrate as itg from plotnine import ggplot, aes, geom_line, ylim, scale_color_distiller, facet_wrap, theme_bw, geom_path, geom_point network = crnt4sbml.CRNT("./basic_example_1.xml") network.print_biological_reaction_types() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() # optimization approach opt = network.get_mass_conservation_approach() opt.generate_report() # the decision vector opt.get_decision_vector() # this function suggests physiological bounds bounds, concentration_bounds = opt.get_optimization_bounds() # overwriting with a narrower or wider range. In this case we are setting narrow range for re1c. bounds[2] = (0.001, 0.01) # overwriting specie concentration bounds for s4. Concentrations are in pM. opt.get_concentration_bounds_species() concentration_bounds[2] = (0.5, 5e2)
import sys sys.path.insert(0, "..") import crnt4sbml network = crnt4sbml.CRNT( "../sbml_files/insulin_signaling_motifs/IIS_double_binding.xml") #network.get_network_graphml() # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/a_b.xml") #network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/p85-p110-PTEN_v3.xml") #network = crnt4sbml.CRNT("../sbml_files/closed_fig5A.xml") print(network.get_c_graph().get_network_dimensionality_classification()) #sys.exit() network.basic_report() network.print_biological_reaction_types() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() # optimization approach opt = network.get_mass_conservation_approach()
plt.switch_backend('agg') # import matplotlib # matplotlib.use('Agg') import sys sys.path.insert(0, "..") import crnt4sbml import numpy import pandas import sympy import scipy.integrate as itg from plotnine import ggplot, aes, geom_line, ylim, scale_color_distiller, facet_wrap, theme_bw, geom_path, geom_point import time import dill network = crnt4sbml.CRNT("../sbml_files/GuanyuWang.xml") # network.print_biological_reaction_types() # # ldt = network.get_low_deficiency_approach() # ldt.report_deficiency_zero_theorem() # ldt.report_deficiency_one_theorem() #optimization approach opt = network.get_mass_conservation_approach() #opt.generate_report() # the decision vector opt.get_decision_vector() # this function suggests physiological bounds bounds, concentration_bounds = opt.get_optimization_bounds()
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/irene2009.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") opt = network.get_mass_conservation_approach() print("Decision Vector:") print(opt.get_decision_vector()) print("") print("Species for concentration bounds:") print(opt.get_concentration_bounds_species()) bounds = [(1e-2, 1e2)] * 10 concentration_bounds = [(1e-2, 1e2)] * 4 params_for_global_min, obj_fun_val_for_params = opt.run_optimization( bounds=bounds, concentration_bounds=concentration_bounds, iterations=100) multistable_param_ind, plot_specifications = opt.run_continuity_analysis( species="s3",
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/Song.xml") network.basic_report() network.print_c_graph() network.get_network_graphml() approach = network.get_general_approach() approach.initialize_general_approach(signal="C1", response="s2", fix_reactions=True) print(approach.get_input_vector()) bnds = [(1e-3, 6.0)] * len(network.get_c_graph().get_reactions()) + [ (1e-3, 1000.0) ] * len(network.get_c_graph().get_species()) params, obj_fun_vals = approach.run_optimization(bounds=bnds, iterations=100) multistable_param_ind, plot_specifications = approach.run_greedy_continuity_analysis( species="s2", parameters=params, auto_parameters={'PrincipalContinuationParameter': "C1"}) approach.generate_report()
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/Fig4C_open.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() opt = network.get_semi_diffusive_approach() print("") opt.print_decision_vector() print("Key species:") print(opt.get_key_species()) print("") print("Non key species:") print(opt.get_non_key_species()) print("") print("Boundary species:") print(opt.get_boundary_species()) bounds = [(1e-2, 1e2)] * 10 params_for_global_min, obj_fun_val_for_params = opt.run_optimization(
import crnt4sbml c = crnt4sbml.CRNT("../sbml_files/Fig1Ci.xml") opt = c.get_mass_conservation_approach() print(opt.get_decision_vector()) bnds = [(1e-2, 1e2)] * 12 conc_bnds = [(1e-2, 1e2)] * 7 num_itr = 100 import numpy sys_min = numpy.finfo(float).eps sd = 0 prnt_flg = False num_dtype = numpy.float64 params_for_global_min, obj_fun_val_for_params = opt.run_optimization( bounds=bnds, concentration_bounds=conc_bnds, iterations=num_itr, seed=sd, print_flag=prnt_flg, numpy_dtype=num_dtype, sys_min_val=sys_min) numpy.save('params.npy', params_for_global_min)
######################################################################## ######################################################################## # Please review the documentation provided at crnt4sbml.readthedocs.io # # before running the code below. # ######################################################################## ######################################################################## import crnt4sbml import numpy network = crnt4sbml.CRNT("./sbml_files/PrionDoublePhos.xml") network.print_c_graph() approach = network.get_general_approach() signal = "C2" response = "s11" approach.initialize_general_approach(signal=signal, response=response, fix_reactions=False) bnds = [(2.4, 2.42), (27.5, 28.1), (2.0, 2.15), (48.25, 48.4), (0.5, 1.1), (1.8, 2.1), (17.0, 17.5), (92.4, 92.6), (0.01, 0.025), (0.2, 0.25), (0.78, 0.79), (3.6, 3.7), (0.15, 0.25), (0.06, 0.065)] + [(0.0, 100.0), (18.0, 18.5), (0.0, 100.0), (0.0, 100.0), (27.0, 27.1), (8.2, 8.3),
import sys sys.path.insert(0, "..") import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/simple_biterminal.xml") network.print_c_graph() approach = network.get_general_approach() signal = "C2" response = "s11" approach.initialize_general_approach(signal=signal, response=response, fix_reactions=False) bnds = [(2.4, 2.42), (27.5, 28.1), (2.0, 2.15), (48.25, 48.4), (0.5, 1.1), (1.8, 2.1), (17.0, 17.5), (92.4, 92.6), (0.01, 0.025), (0.2, 0.25), (0.78, 0.79), (3.6, 3.7), (0.15, 0.25), (0.06, 0.065)] + [(0.0, 100.0), (18.0, 18.5), (0.0, 100.0), (0.0, 100.0), (27.0, 27.1), (8.2, 8.3), (90.0, 90.1), (97.5, 97.9), (30.0, 30.1)] # print(network.get_c_graph().get_species()) # print(approach.get_independent_species()) print(network.get_c_graph().get_ode_system()) print("") print(approach.get_independent_odes()) # print(approach.get_independent_odes_subs()) # import sympy # print("hi") print(approach.get_conservation_laws()) # # # sys.exit()
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/double_insulin_binding.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() approach = network.get_mass_conservation_approach() print("Decision Vector:") print(approach.get_decision_vector()) print("") print("Species for concentration bounds:") print(approach.get_concentration_bounds_species()) bounds, concentration_bounds = approach.get_optimization_bounds() params_for_global_min, obj_fun_val_for_params = approach.run_optimization( bounds=bounds, concentration_bounds=concentration_bounds, iterations=100) multistable_param_ind, plot_specifications = approach.run_greedy_continuity_analysis( species="s5", parameters=params_for_global_min, auto_parameters={'PrincipalContinuationParameter': 'C2'})
import sys sys.path.insert(0, "..") import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/irreversible_switch_2.xml") network.basic_report() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() opt = network.get_mass_conservation_approach()
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/Fig1Cii.xml") opt = network.get_semi_diffusive_approach() bounds = [(1e-3, 1e2)]*12 params_for_global_min, obj_fun_val_for_params = opt.run_optimization(bounds=bounds) multistable_param_ind, plot_specifications = opt.run_greedy_continuity_analysis(species="s7", parameters=params_for_global_min, auto_parameters={'PrincipalContinuationParameter': 're17'}) opt.generate_report()
######################################################################## ######################################################################## # Please review the documentation provided at crnt4sbml.readthedocs.io # # before running the code below. # ######################################################################## ######################################################################## import crnt4sbml import numpy network = crnt4sbml.CRNT("./sbml_files/FutileCycle.xml") approach = network.get_general_approach() approach.initialize_general_approach(signal="C1", response="s2", fix_reactions=True) bnds = [(1e-3, 6.0)]*len(network.get_c_graph().get_reactions()) + \ [(1e-3, 1000.0)]*len(network.get_c_graph().get_species()) ####################################################################################################################### ####################################################################################################################### # The code below produces the values for bistability (in parallel): #### ######################################################################## # params, obj_fun_vals = approach.run_optimization(bounds=bnds, iterations=100, parallel_flag=True) # # if approach.get_my_rank() == 0: # # import numpy # numpy.save('./optimization_parameters/FutileCycle.npy', params) #######################################################################################################################
######################################################################## ######################################################################## # Please review the documentation provided at crnt4sbml.readthedocs.io # # before running the code below. # ######################################################################## ######################################################################## import crnt4sbml import numpy network = crnt4sbml.CRNT("./sbml_files/Edelstein.xml") signal = "C1" response = "s5" iters = 50 GA = network.get_general_approach() GA.initialize_general_approach(signal=signal, response=response, fix_reactions=True) bnds = [(1e-2, 1e2)]*len(GA.get_input_vector()) ####################################################################################################################### ####################################################################################################################### # The code below produces the values for bistability (in parallel): #### ######################################################################## # params_for_global_min, obj_fun_vals = GA.run_optimization(bounds=bnds, iterations=iters, seed=0, print_flag=False, # dual_annealing_iters=1000, confidence_level_flag=True, # parallel_flag=True) # if GA.get_my_rank() == 0: # numpy.save('./optimization_parameters/edelstein_params.npy', params_for_global_min) #######################################################################################################################
import crnt4sbml network = crnt4sbml.CRNT("../sbml_files/Fig4B_closed.xml") network.basic_report() network.print_c_graph() ldt = network.get_low_deficiency_approach() ldt.report_deficiency_zero_theorem() ldt.report_deficiency_one_theorem() print("") opt = network.get_mass_conservation_approach() print("Decision Vector:") print(opt.get_decision_vector()) print("") print("Species for concentration bounds:") print(opt.get_concentration_bounds_species()) bounds = [(1e-2, 1e2)]*11 concentration_bounds = [(1e-2, 1e2)]*3 params_for_global_min, obj_fun_val_for_params = opt.run_optimization(bounds=bounds, concentration_bounds=concentration_bounds, iterations=10000) opt.generate_report()
import pandas import scipy.integrate as itg import dill from plotnine import ggplot, aes, geom_line, ylim, scale_color_distiller, facet_wrap, theme_bw, geom_path, geom_point, labs, annotate from matplotlib import rc rc('text', usetex=True) # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/simple_biterminal.xml") # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/simple_biterminal_v2.xml") # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts.xml") # No, but zero value found # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_1.xml") # Yes # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_2.xml") # No, bifurcation and limit points found and zero value found # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_3.xml") # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_4c.xml") network = crnt4sbml.CRNT( "../sbml_files/insulin_signaling_motifs/Nuts_submodel_1.xml") # network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/Nuts_submodel_4d.xml") #network = crnt4sbml.CRNT("../sbml_files/insulin_signaling_motifs/subspace_strange.xml") signal = "C1" response = "s11" # network = crnt4sbml.CRNT("../sbml_files/two_dim_tk.xml") # signal = "C1" # response = "s1" network.basic_report() network.print_c_graph() GA = network.get_general_approach(signal=signal,
# import sys # sys.path.insert(0, "..") import crnt4sbml import numpy network = crnt4sbml.CRNT( "../sbml_files/insulin_signaling_motifs/a_b.xml") # yes 10 signal = "C1" response = "s5" iters = 50 # network = crnt4sbml.CRNT("../sbml_files/Fig1Ci.xml") # signal = "C3" # response = "s15" network.basic_report() network.print_c_graph() GA = network.get_general_approach() GA.initialize_general_approach(signal=signal, response=response, fix_reactions=True) import sympy from sympy import * # species = GA.get_independent_species() # print(GA.get_independent_species()) # re5, re5r, re6, re6r, re7, re7r = sympy.symbols('re5, re5r, re6, re6r, re7, re7r', positive=True) #