def simulate_data(self): """ simulate some data from model1 :return: """ TC = tasks.TimeCourse(self.mod, end=100, steps=10, intervals=10) utils.format_timecourse_data(TC.report_name) return TC
def setUp(self): self.working_directory = os.path.join(os.path.dirname(__file__), 'viz_tests') if not os.path.isdir(self.working_directory): os.makedirs(self.working_directory) copasi_file = os.path.join(self.working_directory, 'test_model.cps') with model.BuildAntimony(copasi_file) as loader: self.mod = loader.load(""" model negative_feedback compartment cell = 1.0 var A in cell var B in cell var Signal in cell var C in cell vAProd = 0.1 kADeg = 0.2 kBProd = 0.3 kBDeg = 0.4 kCProd = 0.5 kCDeg = 0.6 A = 0 B = 0 C = 0 Signal = 10 AProd: $Signal => A; cell*vAProd*Signal ADeg: A =>; cell*kADeg*A*B; BProd: => B; cell*kBProd*A; BDeg: B => ; cell*kBDeg*B; CProd: => C ; cell*kCProd*B; CDeg: C => ; cell*kCDeg*C end """) ## initialize empty dict to store TimeCourse objects self.TC = tasks.TimeCourse(self.mod, end=10, intervals=10, step_size=1, global_quantities=[], y=['A', 'B', 'C']) tasks ## format the time course data df = utils.format_timecourse_data(self.TC.report_name) ## write data to file df.to_csv(self.TC.report_name, sep='\t', index=False) self.MPE = tasks.MultiParameterEstimation(self.mod, self.TC.report_name, method='genetic_algorithm', population_size=25, number_of_generations=50, run_mode=True) self.MPE.write_config_file() self.MPE.setup() self.MPE.run()
def setUp(self): ## create model selection directory self.dire = os.path.join(os.path.dirname(__file__), 'ChaserEstimationTests') if not os.path.isdir(self.dire): os.makedirs(self.dire) self.copasi_file = os.path.join(self.dire, 'negative_feedback.cps') with model.BuildAntimony(self.copasi_file) as loader: self.mod = loader.load(""" model model1 compartment cell = 1.0 var A in cell var B in cell vAProd = 0.1 kADeg = 0.2 kBProd = 0.3 kBDeg = 0.4 vBasalAProd = 0.001 A = 0 B = 0 AProd: => A; cell*vAProd*B+vBasalAProd ADeg: A =>; cell*kADeg*A BProd: => B; cell*kBProd*A BDeg: B => ; cell*kBDeg*B end """) self.TC1 = tasks.TimeCourse(self.mod, end=1000, step_size=100, intervals=10, report_name='report1.txt') utils.format_timecourse_data(self.TC1.report_name) ## add some noise data1 = misc.add_noise(self.TC1.report_name) ## remove the data os.remove(self.TC1.report_name) ## rewrite the data with noise data1.to_csv(self.TC1.report_name, sep='\t') self.copy_number = 2 self.pe_number = 3 self.MPE = tasks.MultiParameterEstimation(self.mod, self.TC1.report_name, copy_number=self.copy_number, pe_number=self.pe_number, method='genetic_algorithm', population_size=10, number_of_generations=10, overwrite_config_file=True, results_directory='test_mpe', run_mode=True) self.list_of_tasks = '{http://www.copasi.org/static/schema}ListOfTasks' self.MPE.write_config_file() self.MPE.setup() self.MPE.run()