-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancer.cuh
211 lines (158 loc) · 6.36 KB
/
cancer.cuh
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#pragma once
#include <iostream>
#include "functions_library.cuh"
#include "parameter_load.h"
#include "cancer_Host.cuh"
#include "simulator_Master.cuh"
#include <cstdlib>
#include <curand.h>
#include <curand_kernel.h>
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <thrust/system_error.h>
#include <thrust/system/cuda/error.h>
#include <sstream>
#include <algorithm>
#include <random>
#include <chrono>
#include <iomanip>
#include <string>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <thread>
#include <mutex>
#include <shared_mutex>
using namespace std;
class cancer
{
private:
shared_mutex g_mutex;
mutex gi_mutex;
string output_Folder_location;
string intermediate_Folder_location;
string output_Node_location;
string enable_Folder_management = "NO";
string enable_Compression = "NO";
int max_sequences_per_File = 0;
int max_Cells_at_a_time = 0;
string start_Date;
// string stop_after_generations = "NO";
string first_Infection = "Random";
string node_Master_location;
string sequence_Master_location;
int stop_gen_Mode = 0;
int stop_generations_Count = 0;
float stop_Date = 0;
float generation_Time = 0;
int CPU_cores;
string multi_Read;
int *CUDA_device_IDs;
int num_Cuda_devices;
int gpu_Limit;
int *tot_Blocks;
int *tot_ThreadsperBlock;
string parent_Sequence_Folder;
float *Reference_fitness_survivability_proof_reading;
int *mutation_proof_Reading_availability;
int mutation_Hotspots = 0;
float **A_0_mutation;
float **T_1_mutation;
float **G_2_mutation;
float **C_3_mutation;
float **mutation_hotspot_parameters;
int num_tissues_per_Node = 0;
vector<string> tissue_Names;
int terminal_tissues = 0;
int *terminal_array;
string viral_Migration = "No";
float **viral_Migration_Values;
int *migration_start_Generation;
string profile_Name = "";
int terminal_Load = -1;
// per tissue number of cells;
// Inactive = -1;
int *profile_tissue_Limits;
vector<int> replication_phases_tissues;
vector<vector<float>> time_Ratios_per_Tissue;
vector<vector<string>> phase_Type_per_tissue;
vector<vector<pair<float, float>>> phase_paramaters_per_Tissue;
// columns
// 0 = position-1;
// 1 = A
// 2 = T
// 3 = G
// 4 = C
float **sequence_Fitness_changes;
float **sequence_Survivability_changes;
float **sequence_Proof_reading_changes;
float **sequence_replication_factor_changes;
float **sequence_mutation_rate_changes;
float **sequence_generation_death_changes;
float **sequence_replication_prob_changes;
float **sequence_metastatic_prob_changes;
// 0 = Reference replication factor
// 1 = Reference mutation rate factor
// 2 = Reference generational death
// 3 = Reference replication probability
// 4 = Reference metastatic probability
float *Reference_cancer_parameters;
// 0 = fitness
// 1 = survivability
// 2 = proof reading
int *num_effect_Segregating_sites;
// 0 = Reference replication factor
// 1 = Reference mutation rate factor
// 2 = Reference generational death
// 3 = Reference replication probability
// 4 = Reference metastatic probability
int *num_effect_Segregating_sites_Cancer;
int genome_Length = 0;
string intermediary_Sequence_location;
string intermediary_Index_location;
string reference_Sequences;
vector<pair<string, string>> all_sequences_String;
int count_tajima_Regions = 0;
int **tajima_regions_Start_Stop;
string reference_Genome_location = "";
// 0 = inactive
// 1 = active
int tissue_specific_selection = 0;
int *tissue_selection_Position_Count;
int *Survivability_Positions;
int *Proof_Positions;
int *Replication_factor_Positions;
int *Mutation_rate_factor_Positions;
int *Generation_death_Positions;
int *Replication_prob_Positions;
int *Metastatic_Positions;
float **tissues_ATGC_positions_Survivability;
float **tissues_ATGC_positions_Proof;
float **tissues_ATGC_positions_Replication_factor;
float **tissues_ATGC_positions_Mutation_rate_factor;
float **tissues_ATGC_positions_Generation_death;
float **tissues_ATGC_positions_Replication_prob;
float **tissues_ATGC_positions_Metastatic;
public:
cancer(string parameter_Master_Location);
void ingress();
void node_Master_Manager(functions_library &functions);
void sequence_Master_Manager(functions_library &functions);
int **process_Reference_Sequences(functions_library &functions, vector<string> collect_Sequences, int &genome_Length, int &num_of_Sequences_current, float *replication_probs, float *gen_Death_probs,
float *replication_Factor, float *metastatic_Prob, float *Survivability);
vector<string> read_Reference_Sequences(vector<int> &tissue_Sequence_Count);
void write_Reference_Sequences(vector<string> collect_Sequences, vector<int> &tissue_Sequence_Count, functions_library &functions);
vector<pair<string, string>> convert_Sequences_Master(int **sequences, int &genome_Length, int &num_of_Sequences_current, float *replication_probs, float *gen_Death_probs,
float *replication_Factor, float *metastatic_Prob, float *Survivability);
void sequence_to_string_Threads(int start, int stop, int **sequences, int genome_Length, float *replication_probs, float *gen_Death_probs,
float *replication_Factor, float *metastatic_Prob, float *Survivability);
void sequence_Write_Configurator(vector<pair<string, string>> &sequence_Write_Store_All, vector<pair<string, string>> sequence_Write_Store,
int &max_sequences_per_File, const string &folder_Location, int &last_seq_Num);
void partial_Write_Check(vector<pair<string, string>> &sequence_Write_Store_All,
const string &folder_Location, int &last_seq_Num);
void tissue_specific_Selection(fstream &read_Selection, char &delim,
int *X_Positions, float **tissues_ATGC_positions_X,
int &type, string &line, vector<string> &line_Data,
functions_library &functions, string &file_Location);
};