-
Notifications
You must be signed in to change notification settings - Fork 0
/
cellular_activity.h
120 lines (103 loc) · 5.3 KB
/
cellular_activity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* Authors: Joanna Masel, Alex Lancaster, Kun Xiong
* Copyright (c) 2018 Arizona Board of Regents on behalf of the University of Arizona
* This file is part of network-evolution-simulator.
* network-evolution-simulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* network-evolution-simulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with network-evolution-simulator. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CELLULAR_ACTIVITY_H
#define CELLULAR_ACTIVITY_H
#include "netsim.h"
#include "RngStream.h"
#define EPSILON 1.0e-6 /* This is the "0" in changes of TF binding probabilities and of time */
#define TIME_INFINITY 9.99e10 //min
#define TIME_OFFSET 0.01 /* Added to the timing of a fixed event to avoid concurrnce. Unit is minute */
enum TRANSCRIPTIONAL_STATE {REPRESSED, INTERMEDIATE, ACTIVE};
/*
* Rates for Gillespie algorithm
*/
typedef struct GillespieRates GillespieRates;
struct GillespieRates {
float total_mRNA_decay_rate;
float mRNA_decay_rate[MAX_GENES];
float total_active_to_intermediate_rate;
float active_to_intermediate_rate[MAX_GENES];
float total_repressed_to_intermediate_rate;
float repressed_to_intermediate_rate[MAX_GENES];
float total_intermediate_to_repressed_rate;
float intermediate_to_repressed_rate[MAX_GENES];
float total_intermediate_to_active_rate;
float intermediate_to_active_rate[MAX_GENES];
int total_N_gene_transcript_initiated;
int transcript_initiation_state[MAX_GENES];
float total_Gillespie_rate;
};
/*
* transcription/translation delays are sorted linked lists. Deleting
* the head each time, and tack new stuff on the end. Linked lists
* are easy to create pre-sorted.
*/
typedef struct FixedEvent FixedEvent;
struct FixedEvent {
int event_id;
float time;
FixedEvent *next;
};
/*
* CellState store the current cellular state, e.g. protein concentration
*/
typedef struct CellState CellState;
struct CellState {
float t;
float cumulative_fitness;
float cumulative_fitness_after_burn_in;
float instantaneous_fitness;
int mRNA_aft_transl_delay_num[MAX_GENES]; /* mRNAs that have finished the translational delay */
int mRNA_under_transl_delay_num[MAX_GENES]; /* mRNAs that are still under the translational delay (they do not contribute to protein
* turnover, but contribute to the cost of translation) */
int mRNA_under_transc_num[MAX_GENES]; /* mRNAs which haven't finished transcription */
FixedEvent *mRNA_transl_init_time_end_head; /* times when mRNAs become fully loaded with ribosomes and start producing protein */
FixedEvent *mRNA_transl_init_time_end_tail;
FixedEvent *mRNA_transcr_time_end_head; /* times when transcription is complete and an mRNA is available to move to cytoplasm */
FixedEvent *mRNA_transcr_time_end_tail;
FixedEvent *signal_off_head; /* times when env=A ends. Note, this event is not gene- or copy-specific. I just use the structure of FixedEvent for convenience.*/
FixedEvent *signal_off_tail;
FixedEvent *signal_on_head; /* times when env=A ends. Note, this event is not gene- or copy-specific. I just use the structure of FixedEvent for convenience.*/
FixedEvent *signal_on_tail;
FixedEvent *burn_in_growth_rate_head;
FixedEvent *burn_in_growth_rate_tail;
FixedEvent *sampling_point_end_head;
FixedEvent *sampling_point_end_tail;
FixedEvent *change_signal_strength_head;
FixedEvent *change_signal_strength_tail;
char effect_of_effector;
int cell_activated;
float t_to_update_probability_of_binding;
float P_A[MAX_GENES];
float P_R[MAX_GENES];
float P_A_no_R[MAX_GENES];
float P_NotA_no_R[MAX_GENES];
float last_P_R[MAX_GENES];
float last_P_A[MAX_GENES];
float last_P_A_no_R[MAX_GENES];
float last_P_NotA_no_R[MAX_GENES];
float last_event_t;
float protein_number[MAX_PROTEINS]; /* pooled protein number from gene_specific_protein_conc */
float gene_specific_protein_number[MAX_GENES]; /* stores the "protein" number for each gene.
* can be considered temporary data. Make muation easier to
* deal with. */
float protein_synthesis_index[MAX_GENES]; /*this is N_mRNA*translation_rate/degradation rate.*/
int transcriptional_state[MAX_GENES]; /*can be REPRESSED, INTERMEDIATE, or ACTIVE */
};
void initialize_cell(Genotype *, CellState *, Environment *, float, int [MAX_GENES], float [MAX_PROTEINS]);
void do_single_timestep(Genotype *, CellState *, GillespieRates *, Environment *, float, Phenotype *, RngStream);
void calc_all_rates(Genotype *, CellState *, GillespieRates *, Environment *, Phenotype *, float, int);
#endif /* EXPRESSION_DYNAMICS_H */