Debian Codegraph @

seagen/configuration.C

raw symbols SCIP
1 #cxx . . $ `<file>/seagen/configuration.C`/include "searchGENOME.H"cxx . . $ `<file>/seagen/searchGENOME.H`/
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <math.h>
6
7 configurationcxx . . $ configuration#::configurationcxx . . $ configuration#configuration(49f6e7a06ebc5aa8).(void) {
8
9 _beVerbosecxx . . $ configuration#_beVerbose. = false;
10
11 _merSizecxx . . $ configuration#_merSize. = 20;
12 _merSkipcxx . . $ configuration#_merSkip. = 0;
13 _numSearchThreadscxx . . $ configuration#_numSearchThreads. = 4;
14
15 _doReversecxx . . $ configuration#_doReverse. = true;
16 _doForwardcxx . . $ configuration#_doForward. = true;
17
18 _maxDiagonalcxx . . $ configuration#_maxDiagonal. = 25;
19 _maxGapcxx . . $ configuration#_maxGap. = 0;
20 _qsOverlapcxx . . $ configuration#_qsOverlap. = 15;
21 _dsOverlapcxx . . $ configuration#_dsOverlap. = 15;
22
23 // Alternate match extension scheme
24 _extendWeightcxx . . $ configuration#_extendWeight. = 0;
25 _extendMinimumcxx . . $ configuration#_extendMinimum. = 0;
26 _extendAlternatecxx . . $ configuration#_extendAlternate. = false;
27
28 _maxIntronLengthcxx . . $ configuration#_maxIntronLength. = 1000000000;
29
30 _smallSequenceCutoffcxx . . $ configuration#_smallSequenceCutoff. = 0;
31
32 _minLengthSinglecxx . . $ configuration#_minLengthSingle. = 0;
33 _minCoverageSinglecxx . . $ configuration#_minCoverageSingle. = 0.0;
34 _minLengthMultiplecxx . . $ configuration#_minLengthMultiple. = 0;
35 _minCoverageMultiplecxx . . $ configuration#_minCoverageMultiple. = 0.0;
36
37 _dbFileNamecxx . . $ configuration#_dbFileName. = 0L;
38 _qsFileNamecxx . . $ configuration#_qsFileName. = 0L;
39 _maskFileNamecxx . . $ configuration#_maskFileName. = 0L;
40 _onlyFileNamecxx . . $ configuration#_onlyFileName. = 0L;
41 _outputFileNamecxx . . $ configuration#_outputFileName. = 0L;
42 _queryMatchFileNamecxx . . $ configuration#_queryMatchFileName. = 0L;
43
44 _outputFilecxx . . $ configuration#_outputFile. = STDOUT_FILENOcxx . . $ `<external>/12628407106812493757/unistd.h:211:9`!;
45 _matchCountsFilecxx . . $ configuration#_matchCountsFile. = -1;
46
47 _tableTemporaryFileNamecxx . . $ configuration#_tableTemporaryFileName. = 0L;
48 _tableFileNamecxx . . $ configuration#_tableFileName. = 0L;
49 _tableBuildOnlycxx . . $ configuration#_tableBuildOnly. = false;
50
51 _binaryOutputcxx . . $ configuration#_binaryOutput. = false;
52
53 _qsFASTAcxx . . $ configuration#_qsFASTA. = 0L;
54 _maskDBcxx . . $ configuration#_maskDB. = 0L;
55 _onlyDBcxx . . $ configuration#_onlyDB. = 0L;
56 _positionscxx . . $ configuration#_positions. = 0L;
57
58 _numberOfQueriescxx . . $ configuration#_numberOfQueries. = 0;
59
60 _startTimecxx . . $ configuration#_startTime. = getTime();
61 _initTimecxx . . $ configuration#_initTime. = _startTimecxx . . $ configuration#_startTime.;
62 _buildTimecxx . . $ configuration#_buildTime. = _startTimecxx . . $ configuration#_startTime.;
63 _searchTimecxx . . $ configuration#_searchTime. = _startTimecxx . . $ configuration#_startTime.;
64
65 _loaderQueuecxx . . $ configuration#_loaderQueue. = 16 * 1024;
66 _loaderSleepcxx . . $ configuration#_loaderSleep..tv_sec = 1;
67 _loaderSleepcxx . . $ configuration#_loaderSleep..tv_nsec = 0;
68 _loaderWarningscxx . . $ configuration#_loaderWarnings. = false;
69
70 _searchSleepcxx . . $ configuration#_searchSleep..tv_sec = 0;
71 _searchSleepcxx . . $ configuration#_searchSleep..tv_nsec = 10000000;
72
73 _writerQueuecxx . . $ configuration#_writerQueue. = 32 * 1024;
74 _writerSleepcxx . . $ configuration#_writerSleep..tv_sec = 1;
75 _writerSleepcxx . . $ configuration#_writerSleep..tv_nsec = 0;
76 _writerWarningscxx . . $ configuration#_writerWarnings. = false;
77 }
78
79 configurationcxx . . $ configuration#::~cxx . . $ configuration#`~configuration`(ced63f7c635d850d).configurationcxx . . $ configuration#() {
80
81 if (_beVerbosecxx . . $ configuration#_beVerbose.) {
82 uint32cxx . . $ uint32# nq = _qsFASTAcxx . . $ configuration#_qsFASTA.->getNumberOfSequencescxx . . $ seqCache#getNumberOfSequences(db52760e79bf9054).();
83 double tm = _searchTimecxx . . $ configuration#_searchTime. - _buildTimecxx . . $ configuration#_buildTime.;
84 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "\n"uint32FMTWcxx . . $ `libutil/util.h:64:10`!(7)" sequences in %5.2f seconds, %8.3f per second.\n", nq, tm, nq/tm);
85 }
86
87 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
88 close(_outputFilecxx . . $ configuration#_outputFile.);
89 close(_matchCountsFilecxx . . $ configuration#_matchCountsFile.);
90 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)
91 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Couldn't close to the output file '%s': %s\n", configcxx . . $ config.._outputFileNamecxx . . $ configuration#_outputFileName., strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
92
93 delete _qsFASTAcxx . . $ configuration#_qsFASTA.;
94 delete _maskDBcxx . . $ configuration#_maskDB.;
95 delete _onlyDBcxx . . $ configuration#_onlyDB.;
96 delete _positionscxx . . $ configuration#_positions.;
97 }
98
99 static char const *usageStringcxx . . $ usageString. =
100 "usage: %s [options]\n"
101 "\n"
102 "Algorithm Options:\n"
103 " -mersize k Use k-mers\n"
104 " -merskip j Skip j mers between each mer inserted into table\n"
105 " -forward Search only the normal query sequences\n"
106 " -reverse Search only the reverse-complemented query sequences\n"
107 " -maxdiagonal d\n"
108 " -maxgap g\n"
109 " -qoverlap q\n"
110 " -doverlap d\n"
111 " -maxintron m\n"
112 " -smallsequence\n"
113 " -singlelength l\n"
114 " -singlecoverage c\n"
115 " -multiplelength l\n"
116 " -multiplecoverage c\n"
117 " -extendweight w\n"
118 " -extendminimum m\n"
119 "\n"
120 "Process Options\n"
121 " -numthreads n Use n search threads\n"
122 "\n"
123 " -loaderqueue h Size of the loader queue\n"
124 " -loadersleep t Time the loader will sleep when its output queue is full\n"
125 " -loaderwarnings Enable warning messages for the loader\n"
126 "\n"
127 " -searchsleep t Time the searcher will sleep when it has no input\n"
128 "\n"
129 " -writerqueue h Size of the output queue\n"
130 " -writersleep t Time the writer will sleep when it has nothing to write\n"
131 " -writerwarnings Enable warning messages for the writer\n"
132 "\n"
133 "\n"
134 " -buildtables datfile If 'datfile' doesn't exist, build the tables, write\n"
135 " them to 'datfile' and exit.\n"
136 " -usetables datfile Load the tables from 'datfile' file and do the compute.\n"
137 " If 'datfile' doesn't exist, an implicit -buildtables is\n"
138 " performed.\n"
139 "Input Options:\n"
140 " -mask f Ignore all mers listed in file f\n"
141 " -only f Use only the mers listed in file f\n"
142 " -cdna c.fasta Query sequences (the cDNA, the stream)\n"
143 " -stream An alias for -cdna\n"
144 " -genomic g.fasta Database sequences (the genome, the table)\n"
145 " -table An alias for -genomic)\n"
146 " -use #,#,#,# using only those sequences specified\n"
147 " -use file using only those sequences listed in the file\n"
148 "\n"
149 "Output Options\n"
150 " -verbose Entertain the user\n"
151 " -binary Write the hits in a binary format\n"
152 " -output f Write output to file f\n"
153 " -count f Write counts of hits to file f\n";
154
155 void
156 configurationcxx . . $ configuration#::usagecxx . . $ configuration#usage(fda57c8427c60377).(char *name) {
157 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, usageStringcxx . . $ usageString., name);
158 }
159
160
161
162 void
163 configurationcxx . . $ configuration#::readcxx . . $ configuration#read(c759356ac01a31e7).(int argc, char **argv) {
164 int arg = 1;
165
166 if (argc < 2) {
167 usagecxx . . $ configuration#usage(fda57c8427c60377).(argv[0]);
168 exitcxx . . $ exit(44ed87f96534fad7).(1);
169 }
170
171 while (arg < argc) {
172 if (strcmp(argv[arg], "-mersize") == 0) {
173 arg++;
174 _merSizecxx . . $ configuration#_merSize. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
175 } else if (strcmp(argv[arg], "-merskip") == 0) {
176 arg++;
177 _merSkipcxx . . $ configuration#_merSkip. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
178 } else if (strcmp(argv[arg], "-numthreads") == 0) {
179 arg++;
180 _numSearchThreadscxx . . $ configuration#_numSearchThreads. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
181 } else if (strcmp(argv[arg], "-mask") == 0) {
182 arg++;
183 _maskFileNamecxx . . $ configuration#_maskFileName. = argv[arg];
184 } else if (strcmp(argv[arg], "-only") == 0) {
185 arg++;
186 _onlyFileNamecxx . . $ configuration#_onlyFileName. = argv[arg];
187 } else if (strcmp(argv[arg], "-cdna") == 0) {
188 arg++;
189 _qsFileNamecxx . . $ configuration#_qsFileName. = argv[arg];
190 } else if (strcmp(argv[arg], "-stream") == 0) {
191 arg++;
192 _qsFileNamecxx . . $ configuration#_qsFileName. = argv[arg];
193 } else if (strcmp(argv[arg], "-genomic") == 0) {
194 arg++;
195 _dbFileNamecxx . . $ configuration#_dbFileName. = argv[arg];
196 } else if (strcmp(argv[arg], "-table") == 0) {
197 arg++;
198 _dbFileNamecxx . . $ configuration#_dbFileName. = argv[arg];
199 } else if (strcmp(argv[arg], "-buildtemporary") == 0) {
200 arg++;
201 _tableTemporaryFileNamecxx . . $ configuration#_tableTemporaryFileName. = argv[arg];
202 } else if (strcmp(argv[arg], "-buildtables") == 0) {
203 arg++;
204 _tableFileNamecxx . . $ configuration#_tableFileName. = argv[arg];
205 _tableBuildOnlycxx . . $ configuration#_tableBuildOnly. = true;
206 } else if (strcmp(argv[arg], "-usetables") == 0) {
207 arg++;
208 _tableFileNamecxx . . $ configuration#_tableFileName. = argv[arg];
209 _tableBuildOnlycxx . . $ configuration#_tableBuildOnly. = false;
210 } else if (strcmp(argv[arg], "-positions") == 0) {
211 arg++;
212 _tableFileNamecxx . . $ configuration#_tableFileName. = argv[arg];
213 _tableBuildOnlycxx . . $ configuration#_tableBuildOnly. = false;
214 } else if (strcmp(argv[arg], "-forward") == 0) {
215 _doForwardcxx . . $ configuration#_doForward. = true;
216 _doReversecxx . . $ configuration#_doReverse. = false;
217 } else if (strcmp(argv[arg], "-reverse") == 0) {
218 _doReversecxx . . $ configuration#_doReverse. = true;
219 _doForwardcxx . . $ configuration#_doForward. = false;
220 } else if (strcmp(argv[arg], "-verbose") == 0) {
221 _beVerbosecxx . . $ configuration#_beVerbose. = true;
222 } else if (strcmp(argv[arg], "-binary") == 0) {
223 _binaryOutputcxx . . $ configuration#_binaryOutput. = true;
224 } else if (strcmp(argv[arg], "-output") == 0) {
225 arg++;
226 _outputFileNamecxx . . $ configuration#_outputFileName. = argv[arg];
227 } else if (strcmp(argv[arg], "-count") == 0) {
228 arg++;
229 _queryMatchFileNamecxx . . $ configuration#_queryMatchFileName. = argv[arg];
230 } else if (strcmp(argv[arg], "-maxdiagonal") == 0) {
231 arg++;
232 _maxDiagonalcxx . . $ configuration#_maxDiagonal. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
233 } else if (strcmp(argv[arg], "-maxgap") == 0) {
234 arg++;
235 _maxGapcxx . . $ configuration#_maxGap. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
236 } else if (strcmp(argv[arg], "-qoverlap") == 0) {
237 arg++;
238 _qsOverlapcxx . . $ configuration#_qsOverlap. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
239 } else if (strcmp(argv[arg], "-doverlap") == 0) {
240 arg++;
241 _dsOverlapcxx . . $ configuration#_dsOverlap. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
242 } else if (strcmp(argv[arg], "-maxintron") == 0) {
243 arg++;
244 _maxIntronLengthcxx . . $ configuration#_maxIntronLength. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
245 } else if (strcmp(argv[arg], "-smallsequence") == 0) {
246 arg++;
247 _smallSequenceCutoffcxx . . $ configuration#_smallSequenceCutoff. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
248 } else if (strcmp(argv[arg], "-singlelength") == 0) {
249 arg++;
250 _minLengthSinglecxx . . $ configuration#_minLengthSingle. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
251 } else if (strcmp(argv[arg], "-multiplelength") == 0) {
252 arg++;
253 _minLengthMultiplecxx . . $ configuration#_minLengthMultiple. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
254 } else if (strcmp(argv[arg], "-singlecoverage") == 0) {
255 arg++;
256 _minCoverageSinglecxx . . $ configuration#_minCoverageSingle. = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[arg]);
257 } else if (strcmp(argv[arg], "-multiplecoverage") == 0) {
258 arg++;
259 _minCoverageMultiplecxx . . $ configuration#_minCoverageMultiple. = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[arg]);
260 } else if (strncmp(argv[arg], "-extendweight", 7) == 0) {
261 arg++;
262 _extendWeightcxx . . $ configuration#_extendWeight. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
263 _extendAlternatecxx . . $ configuration#_extendAlternate. = true;
264 } else if (strncmp(argv[arg], "-extendminimum", 7) == 0) {
265 arg++;
266 _extendMinimumcxx . . $ configuration#_extendMinimum. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[arg]);
267 _extendAlternatecxx . . $ configuration#_extendAlternate. = true;
268
269 } else if (strncmp(argv[arg], "-loaderqueue", 8) == 0) {
270 _loaderQueuecxx . . $ configuration#_loaderQueue. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[++arg]);
271 } else if (strncmp(argv[arg], "-loadersleep", 8) == 0) {
272 setTimecxx . . $ configuration#setTime(ac28bcc6049edbea).(&_loaderSleepcxx . . $ configuration#_loaderSleep., atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]));
273 } else if (strncmp(argv[arg], "-loaderwarnings", 8) == 0) {
274 _loaderWarningscxx . . $ configuration#_loaderWarnings. = true;
275
276 } else if (strncmp(argv[arg], "-searchsleep", 8) == 0) {
277 setTimecxx . . $ configuration#setTime(ac28bcc6049edbea).(&_searchSleepcxx . . $ configuration#_searchSleep., atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]));
278
279 } else if (strncmp(argv[arg], "-writerqueue", 8) == 0) {
280 _writerQueuecxx . . $ configuration#_writerQueue. = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[++arg]);
281 } else if (strncmp(argv[arg], "-writersleep", 8) == 0) {
282 setTimecxx . . $ configuration#setTime(ac28bcc6049edbea).(&_writerSleepcxx . . $ configuration#_writerSleep., atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]));
283 } else if (strncmp(argv[arg], "-writerwarnings", 8) == 0) {
284 _writerWarningscxx . . $ configuration#_writerWarnings. = true;
285
286 } else {
287 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unknown option '%s'\n", argv[arg]);
288 }
289 arg++;
290 }
291
292 //
293 // Make sure some constraints are met
294 //
295
296 if (_maskFileNamecxx . . $ configuration#_maskFileName. && _onlyFileNamecxx . . $ configuration#_onlyFileName.) {
297 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: At most one of -mask and -only may be used.\n");
298 exitcxx . . $ exit(44ed87f96534fad7).(1);
299 }
300
301 //
302 // Check that the mers are at least adjacent
303 //
304 if (_merSkipcxx . . $ configuration#_merSkip. >= _merSizecxx . . $ configuration#_merSize.) {
305 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ERROR: Mers are not adjacent; make sure merskip <= mersize.\n");
306 exitcxx . . $ exit(44ed87f96534fad7).(1);
307 }
308
309 // Fail if we don't get reasonable signal criteria
310 //
311 if (((_minLengthSinglecxx . . $ configuration#_minLengthSingle. == 0) && (_minCoverageSinglecxx . . $ configuration#_minCoverageSingle. == 0.0)) ||
312 ((_minLengthMultiplecxx . . $ configuration#_minLengthMultiple. == 0) && (_minCoverageMultiplecxx . . $ configuration#_minCoverageMultiple. == 0.0)))
313 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "WARNING: Minimum match lengths not specified. All matches will be reported.\n");
314
315
316 // Open output file
317 //
318 if (_outputFileNamecxx . . $ configuration#_outputFileName.) {
319 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
320 _outputFilecxx . . $ configuration#_outputFile. = open(_outputFileNamecxx . . $ configuration#_outputFileName.,
321 O_WRONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:44:9`! | O_LARGEFILEcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:136:10`! | O_CREATcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:47:10`! | O_TRUNCcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:56:10`!,
322 S_IRUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:105:10`! | S_IWUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:106:10`! | S_IRGRPcxx . . $ `<external>/14710646456994434043/fcntl.h:111:10`! | S_IWGRPcxx . . $ `<external>/14710646456994434043/fcntl.h:112:10`! | S_IROTHcxx . . $ `<external>/14710646456994434043/fcntl.h:117:10`! | S_IWOTHcxx . . $ `<external>/14710646456994434043/fcntl.h:118:10`!);
323 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!) {
324 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Couldn't open the output file '%s'?\n%s\n", _outputFileNamecxx . . $ configuration#_outputFileName., strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
325 exitcxx . . $ exit(44ed87f96534fad7).(1);
326 }
327 }
328
329
330 if (_queryMatchFileNamecxx . . $ configuration#_queryMatchFileName.) {
331 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
332 _matchCountsFilecxx . . $ configuration#_matchCountsFile. = open(_queryMatchFileNamecxx . . $ configuration#_queryMatchFileName.,
333 O_WRONLYcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:44:9`! | O_LARGEFILEcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:136:10`! | O_CREATcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:47:10`! | O_TRUNCcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:56:10`!,
334 S_IRUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:105:10`! | S_IWUSRcxx . . $ `<external>/14710646456994434043/fcntl.h:106:10`! | S_IRGRPcxx . . $ `<external>/14710646456994434043/fcntl.h:111:10`! | S_IWGRPcxx . . $ `<external>/14710646456994434043/fcntl.h:112:10`! | S_IROTHcxx . . $ `<external>/14710646456994434043/fcntl.h:117:10`! | S_IWOTHcxx . . $ `<external>/14710646456994434043/fcntl.h:118:10`!);
335 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!) {
336 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Couldn't open the match counts file '%s'?\n%s\n", _queryMatchFileNamecxx . . $ configuration#_queryMatchFileName., strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
337 exitcxx . . $ exit(44ed87f96534fad7).(1);
338 }
339 }
340
341
342 // Gotta go somewhere!
343 //
344 _startTimecxx . . $ configuration#_startTime. = getTime();
345 }