def Initialize_Classes(gillespie_parameters): [alpha, beta, yr, r0, c0, mu, cv] = gillespie_parameters dilution0 = Classy.Reaction(np.array([-1, 0, 0], dtype=int), 0, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution1 = Classy.Reaction(np.array([0, -1, 0], dtype=int), 1, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) degradation0 = Classy.Reaction(np.array([-1, 0, 0], dtype=int), 0, 'mobius_sum_propensity', [0, yr, r0, 1], 1, [0]) degradation1 = Classy.Reaction(np.array([0, -1, 0], dtype=int), 1, 'mobius_sum_propensity', [0, yr, r0, 1], 1, [0]) degradation2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_sum_propensity', [0, yr, r0, 1], 1, [0]) production1 = Classy.Reaction(np.array([0, 1, 0], dtype=int), 0, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production0 = Classy.Reaction(np.array([1, 0, 0], dtype=int), 2, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production2 = Classy.Reaction(np.array([0, 0, 1], dtype=int), 1, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) reaction_list = np.array([ production1, production0, production2, degradation0, degradation1, degradation2, dilution0, dilution1, dilution2 ]) return reaction_list
def Initialize_Classes(gillespie_parameters): [alpha, beta, yr, r0, c0, mu, cv] = gillespie_parameters dilution = Classy.Reaction(np.array([-1], dtype=int), 0, 0, [0, beta, 1, 0], 1, [0]) enzymatic_degradation = Classy.Reaction(np.array([-1], dtype=int), 0, 0, [0, yr, r0, 1], 1, [0]) production = Classy.Reaction(np.array([1], dtype=int), 0, 1, [alpha, c0, 2], 0, [mu, mu * cv]) reaction_list = np.array([production, enzymatic_degradation, dilution]) return reaction_list
def add_reaction(queue, schedule_time, next_reaction): reaction = Classy.ScheduleChange(schedule_time, next_reaction.change_vec) if len(queue) == 0: return queue.append(reaction) else: for k in range(len(queue)): if reaction.comp_time < queue[k].comp_time: return queue.insert(k, reaction) return queue.append(reaction)
def Initialize_Reactions(delay_parameters): [mu, cv] = delay_parameters factor = 2 alpha_r = 5000 alpha_a = 2 * alpha_r beta = .1 gamma_r = 200 gamma_a = 440 r0 = 1 c0 = c1 = 50 initial_vector = np.array([0, 0], dtype=int) dilution0 = Classy.Reaction(np.array([-1, 0], dtype=int), 0, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution1 = Classy.Reaction(np.array([0, -1], dtype=int), 1, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) degradation0 = Classy.Reaction(np.array([-1, 0], dtype=int), 0, 'mobius_propensity', [0, gamma_r, r0, 1], 1, [0]) degradation1 = Classy.Reaction(np.array([0, -1], dtype=int), 1, 'mobius_propensity', [0, gamma_a, r0, 1], 1, [0]) production0 = Classy.Reaction(np.array([1, 0], dtype=int), 0, 'dual_feedback_decreasing_hill_propensity', [alpha_r, c0, c1, factor, 2], 'gamma_distribution', [mu, mu * cv]) production1 = Classy.Reaction(np.array([0, 1], dtype=int), 1, 'dual_feedback_increasing_hill_propensity', [alpha_a, c0, c1, factor, 2], 'trivial_distribution', [0]) reaction_list = [production0, production1, degradation0, degradation1, dilution0, dilution1] return [reaction_list, initial_vector]
def gillespie_sim(mu, cv, alpha, beta, R0, C0, yr,param,par,dilution,enzymatic_degradation): #model parameters init_Protein = (alpha - yr) * ( mu - C0 * (math.sqrt(alpha / yr) - 1) / yr) # calculate the avg peak to initialize at a peak production = Classy.Reaction(np.array([1], dtype=int), 0, 1, [alpha, C0, 2], 0, [mu, mu * cv]) timeRun = 4000 #Naming files and paths path1 = 'PostProcessing/Simulations/{}{}'.format(param,par) file_name = '{}/mean={}_CV={}.csv'.format(path1,mu,cv) #Gillespie time_series = gillespie(np.array([production, enzymatic_degradation, dilution]), timeRun, np.array([init_Protein], dtype=int)) pd.DataFrame(time_series).to_csv(file_name, header=False, index=False) return file_name
def Initialize_Reactions(delay_parameters): [mu, cv] = delay_parameters alpha = 250 beta = .1 gamma_r = 150 r0 = 1 c0 = 10 initial_vector = np.array([0, 500, 1000], dtype=int) dilution0 = Classy.Reaction(np.array([-1, 0, 0], dtype=int), 0, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution1 = Classy.Reaction(np.array([0, -1, 0], dtype=int), 1, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) degradation0 = Classy.Reaction(np.array([-1, 0, 0], dtype=int), 0, 'mobius_propensity', [0, gamma_r, r0, 1], 1, [0]) degradation1 = Classy.Reaction(np.array([0, -1, 0], dtype=int), 1, 'mobius_propensity', [0, gamma_r, r0, 1], 1, [0]) degradation2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_propensity', [0, gamma_r, r0, 1], 1, [0]) production1 = Classy.Reaction(np.array([0, 1, 0], dtype=int), 0, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production0 = Classy.Reaction(np.array([1, 0, 0], dtype=int), 2, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production2 = Classy.Reaction(np.array([0, 0, 1], dtype=int), 1, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) reaction_list = [ production1, production0, production2, degradation0, degradation1, degradation2, dilution0, dilution1, dilution2 ] return [reaction_list, initial_vector]
def Initialize_Classes(gillespie_parameters): [alpha, beta, yr, r0, c0, mu, cv] = gillespie_parameters dilution0 = Classy.Reaction(np.array([-1, 0, 0], dtype=int), 0, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution1 = Classy.Reaction(np.array([0, -1, 0], dtype=int), 1, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) dilution2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_propensity', [0, beta, 1, 0], 1, [0]) degradation0 = Classy.Reaction( np.array([-1, 0, 0], dtype=int), 0, 'mobius_propensity', [0, yr, r0, 1], 1, [0]) # need to rewrite this so that all molecules are in the base degradation1 = Classy.Reaction( np.array([0, -1, 0], dtype=int), 1, 'mobius_propensity', [0, yr, r0, 1], 1, [0] ) # need to make it such that denominator is R 0 +r 1 (t)+r 2 (t)+r 3 (t) degradation2 = Classy.Reaction(np.array([0, 0, -1], dtype=int), 2, 'mobius_propensity', [0, yr, r0, 1], 1, [0]) production1 = Classy.Reaction(np.array([0, 1, 0], dtype=int), 0, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production0 = Classy.Reaction(np.array([1, 0, 0], dtype=int), 2, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) production2 = Classy.Reaction(np.array([0, 0, 1], dtype=int), 1, 'decreasing_hill_propensity', [alpha, c0, 2], 0, [mu, mu * cv]) reaction_list = np.array([ production1, production0, production2, degradation0, degradation1, degradation2, dilution0, dilution1, dilution2 ]) return reaction_list