Debian Codegraph @

seatac/seatac.H

raw symbols SCIP
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <sys/time.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <sys/resource.h>
9 #include <sys/utsname.h>
10 #include <fcntl.h>
11 #include <assert.h>
12 #include <math.h>
13
14 // At one time, this was needed for pthread.h or semaphore.h
15 typedef unsigned short ushort;
16
17 #include <pthread.h>
18 #include <semaphore.h>
19
20 #include "bio++.H"
21
22 #include "seqCache.H"
23
24 #include "existDB.H"
25 #include "positionDB.H"
26
27 #include "hitMatrix.H"
28
29 #include "filterObj.H"
30 #include "statObj.H"
31
32 class encodedQuery {
33 private:
34 char const *_seq;
35 uint32 _seqLen;
36 uint32 _merSize;
37 bool _rc;
38
39 uint32 _seqPos;
40
41 int32 _timeUntilValid;
42
43 uint64 _substring;
44 uint64 _mermask;
45 public:
46 encodedQuery(char const *seq,
47 uint32 seqLen,
48 uint32 k,
49 bool rc);
50 ~encodedQuery();
51
52 bool getMer(uint64 &mer, uint32 &pos);
53 };
54
55
56
57
58 //
59 // A singleton for working with the command line parameters.
60 //
61 #define MAX_THREADS 64
62
63
64 class configuration {
65 public:
66 bool _beVerbose;
67
68 uint32 _merSize;
69 uint32 _merSkip;
70 uint32 _numSearchThreads;
71
72 bool _doReverse;
73 bool _doForward;
74
75 uint32 _maxDiagonal;
76 uint32 _maxGap;
77 uint32 _qsOverlap;
78 uint32 _dsOverlap;
79
80 uint32 _minLength;
81
82 char *_dbFileName;
83 char *_qsFileName;
84 char *_maskFileName;
85 char *_onlyFileName;
86 char *_outputFileName;
87 char *_statsFileName;
88
89 char *_tableFileName;
90 bool _tableBuildOnly;
91
92 seqStream *_genome;
93
94 // Filter parameters
95 //
96 char *_filtername;
97 char *_filteropts;
98 sharedObj *_filterObj;
99
100 // Wall clock times
101 //
102 double _startTime;
103 double _initTime;
104 double _buildTime;
105 double _searchTime;
106 double _totalTime;
107
108 // Loader parameters
109 //
110 uint32 _loaderHighWaterMark;
111 struct timespec _loaderSleep;
112 bool _loaderWarnings;
113
114 // Search parameters
115 //
116 struct timespec _searchSleep;
117
118 // Output parameters
119 //
120 uint32 _writerHighWaterMark;
121 struct timespec _writerSleep;
122 bool _writerWarnings;
123
124 configuration();
125 ~configuration();
126
127 void usage(char *name);
128 void read(int argc, char **argv);
129 void writeATACheader(FILE *out);
130
131 void setTime(struct timespec *ts, double t) {
132 ts->tv_sec = (time_t)floor(t);
133 ts->tv_nsec = (long)((t - ts->tv_sec) * 1e9);
134 };
135 };
136
137
138
139
140
141
142
143 // Shared data
144 //
145 extern configuration config;
146
147 extern seqCache *qsFASTA; // Used exclusively by thr-loader.C
148
149 extern positionDB *positions;
150
151 extern volatile uint32 numberOfQueries;
152
153 extern filterObj **output;
154
155 extern pthread_mutex_t inputTailMutex;
156 extern seqInCore **input;
157 extern volatile uint32 inputHead;
158 extern volatile uint32 inputTail;
159
160 extern volatile uint32 outputPos;
161
162 extern char *threadStats[MAX_THREADS];
163
164 void *deadlockDetector(void *U);
165 void *deadlockChecker(void *U);
166
167 void *loaderThread(void *U);
168 void *searchThread(void *U);