Debian Codegraph @

seatac/heavychains.H

raw symbols SCIP
1 #cxx . . $ `<file>/seatac/heavychains.H`/ifndef STRANDPAIR_H
2 #define STRANDPAIR_Hcxx . . $ `seatac/heavychains.H:2:9`!
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7
8 #include <vector>
9 using namespace std;
10
11 #include "util.h"cxx . . $ `<file>/libutil/util.h`/
12
13 //
14 // The StrandPair does the heavy chains filtering, while the TheStats
15 // collects statistics on all StrandPairs. TheStats is also
16 // responsible for reporting the options used by StrandPair.
17 //
18
19
20 struct Matchcxx . . $ Match# {
21 int xlocxx . . $ Match#xlo.;
22 int ylocxx . . $ Match#ylo.;
23 int xhicxx . . $ Match#xhi.;
24 int yhicxx . . $ Match#yhi.;
25
26 double selfScxx . . $ Match#selfS.; // The intrinsic score of the Match.
27 double Scxx . . $ Match#S.; // The computed score of the Match?
28
29 // We need two times the number of dimensions of scores. That is
30 // one score starting from each corner of the bounding box of the
31 // space.
32 //
33 double neScxx . . $ Match#neS.;
34 double swScxx . . $ Match#swS.;
35 double nwScxx . . $ Match#nwS.;
36 double seScxx . . $ Match#seS.;
37
38 int filledcxx . . $ Match#filled.; // Is this the same as selfS ?
39
40 char oricxx . . $ Match#ori.;
41 };
42
43
44
45 class StrandPaircxx . . $ StrandPair# {
46 public:
47 StrandPaircxx . . $ StrandPair#StrandPair(4a15d145234c1b0a).(bool verbose,
48 char *assemblyid1,
49 char *assemblyid2,
50 int maxjump,
51 double minscore) {
52 beVerbosecxx . . $ StrandPair#beVerbose. = verbose;
53 strncpy(assemblyId1cxx . . $ StrandPair#assemblyId1., assemblyid1, 31);
54 strncpy(assemblyId2cxx . . $ StrandPair#assemblyId2., assemblyid2, 31);
55 maxJumpcxx . . $ StrandPair#maxJump. = maxjump;
56 minScorecxx . . $ StrandPair#minScore. = minscore;
57
58 Plencxx . . $ StrandPair#Plen. = 0;
59 Pmaxcxx . . $ StrandPair#Pmax. = 1024;
60 Pcxx . . $ StrandPair#P. = new Matchcxx . . $ Match# [Pmaxcxx . . $ StrandPair#Pmax.];
61
62 clearcxx . . $ StrandPair#clear(49f6e7a06ebc5aa8).();
63 };
64
65 ~cxx . . $ StrandPair#`~StrandPair`(ced63f7c635d850d).StrandPaircxx . . $ StrandPair#(void) {
66 if (beVerbosecxx . . $ StrandPair#beVerbose. > 1)
67 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "StrandPair::StrandPair()-- delete %s vs %s with %d hits\n", assemblyId1cxx . . $ StrandPair#assemblyId1., assemblyId2cxx . . $ StrandPair#assemblyId2., Plencxx . . $ StrandPair#Plen.);
68 delete [] Pcxx . . $ StrandPair#P.;
69 };
70
71 void addHitcxx . . $ StrandPair#addHit(a209694d0a1a92e0).(char direction,
72 uint32cxx . . $ uint32# id1,
73 uint32cxx . . $ uint32# xlo,
74 uint32cxx . . $ uint32# xln,
75 uint32cxx . . $ uint32# id2,
76 uint32cxx . . $ uint32# ylo,
77 uint32cxx . . $ uint32# yln,
78 uint32cxx . . $ uint32# filled);
79
80 void processcxx . . $ StrandPair#process(49f6e7a06ebc5aa8).(void);
81
82 uint64cxx . . $ uint64# printcxx . . $ StrandPair#print(9bd1d5b934681de1).(FILE *outF, uint64cxx . . $ uint64# matchid);
83
84 void clearcxx . . $ StrandPair#clear(49f6e7a06ebc5aa8).(void) {
85 iid1cxx . . $ StrandPair#iid1. = ~uint32ZEROcxx . . $ `libutil/util.h:60:10`!;
86 iid2cxx . . $ StrandPair#iid2. = ~uint32ZEROcxx . . $ `libutil/util.h:60:10`!;
87
88 _nextcxx . . $ StrandPair#_next. = 0L;
89
90 sumlen1cxx . . $ StrandPair#sumlen1. = 0.0;
91 sumlen2cxx . . $ StrandPair#sumlen2. = 0.0;
92 maxlen1cxx . . $ StrandPair#maxlen1. = 0.0;
93 maxlen2cxx . . $ StrandPair#maxlen2. = 0.0;
94 maxScoreFwdcxx . . $ StrandPair#maxScoreFwd. = 0.0; // Maximum forward chain score for the strand pair.
95 maxScoreRevcxx . . $ StrandPair#maxScoreRev. = 0.0; // Maximum reverse chain score for the strand pair.
96
97 Plencxx . . $ StrandPair#Plen. = 0;
98 };
99
100 // The StrandPairManager (in filter-strandpair.H) is lazy and makes
101 // StrandPairs keep track of the next one.
102 //
103 StrandPaircxx . . $ StrandPair# *_nextcxx . . $ StrandPair#_next.;
104 StrandPaircxx . . $ StrandPair# *nextcxx . . $ StrandPair#next(a28089bb81c67400).(void) { return(_nextcxx . . $ StrandPair#_next.); };
105 void addNextcxx . . $ StrandPair#addNext(b43a089d41c6f7f7).(StrandPaircxx . . $ StrandPair# *n) { _nextcxx . . $ StrandPair#_next. = n; };
106
107 uint32cxx . . $ uint32# sequenceIID1cxx . . $ StrandPair#sequenceIID1(db52760e79bf9054).(void) { return(iid1cxx . . $ StrandPair#iid1.); };
108 //uint32 sequenceIID2(void) { return(iid2); };
109
110 double getsumlen1cxx . . $ StrandPair#getsumlen1(21b6c25e127938e2).(void) const { return(sumlen1cxx . . $ StrandPair#sumlen1.); };
111 double getsumlen2cxx . . $ StrandPair#getsumlen2(21b6c25e127938e2).(void) const { return(sumlen2cxx . . $ StrandPair#sumlen2.); };
112 double getmaxlen1cxx . . $ StrandPair#getmaxlen1(21b6c25e127938e2).(void) const { return(maxlen1cxx . . $ StrandPair#maxlen1.); };
113 double getmaxlen2cxx . . $ StrandPair#getmaxlen2(21b6c25e127938e2).(void) const { return(maxlen2cxx . . $ StrandPair#maxlen2.); };
114 double getmaxScoreFwdcxx . . $ StrandPair#getmaxScoreFwd(21b6c25e127938e2).(void) const { return(maxScoreFwdcxx . . $ StrandPair#maxScoreFwd.); };
115 double getmaxScoreRevcxx . . $ StrandPair#getmaxScoreRev(21b6c25e127938e2).(void) const { return(maxScoreRevcxx . . $ StrandPair#maxScoreRev.); };
116
117 private:
118 // This used to use a vector<Match>, but DPTree wants a pointer to the
119 // array of matches
120 //
121 int Plencxx . . $ StrandPair#Plen.;
122 int Pmaxcxx . . $ StrandPair#Pmax.;
123 Matchcxx . . $ Match# *Pcxx . . $ StrandPair#P.;
124
125 void Paddcxx . . $ StrandPair#Padd(d067a0977a49f5a6).(Matchcxx . . $ Match# *m) {
126 if (Plencxx . . $ StrandPair#Plen. >= Pmaxcxx . . $ StrandPair#Pmax.) {
127 Pmaxcxx . . $ StrandPair#Pmax. *= 2;
128 Matchcxx . . $ Match# *n = new Matchcxx . . $ Match# [Pmaxcxx . . $ StrandPair#Pmax.];
129 memcpy(n, Pcxx . . $ StrandPair#P., sizeof(Matchcxx . . $ Match#) * Plencxx . . $ StrandPair#Plen.);
130 delete [] Pcxx . . $ StrandPair#P.;
131 Pcxx . . $ StrandPair#P. = n;
132 }
133 memcpy(Pcxx . . $ StrandPair#P.+Plencxx . . $ StrandPair#Plen., m, sizeof(Matchcxx . . $ Match#));
134 Plencxx . . $ StrandPair#Plen.++;
135 };
136
137 private:
138 uint32cxx . . $ uint32# iid1cxx . . $ StrandPair#iid1.;
139 uint32cxx . . $ uint32# iid2cxx . . $ StrandPair#iid2.;
140 uint32cxx . . $ uint32# beVerbosecxx . . $ StrandPair#beVerbose.;
141 char assemblyId1cxx . . $ StrandPair#assemblyId1.[32];
142 char assemblyId2cxx . . $ StrandPair#assemblyId2.[32];
143 int maxJumpcxx . . $ StrandPair#maxJump.; // Default maximum intra-run jump allowed in a good run.
144 double minScorecxx . . $ StrandPair#minScore.; // Default minimum of bp filled in a good run.
145
146 // The following are only known after StrandPair::print().
147
148 double sumlen1cxx . . $ StrandPair#sumlen1.;
149 double sumlen2cxx . . $ StrandPair#sumlen2.;
150 double maxlen1cxx . . $ StrandPair#maxlen1.;
151 double maxlen2cxx . . $ StrandPair#maxlen2.;
152 double maxScoreFwdcxx . . $ StrandPair#maxScoreFwd.; // Maximum forward chain score for the strand pair.
153 double maxScoreRevcxx . . $ StrandPair#maxScoreRev.; // Maximum reverse chain score for the strand pair.
154 };
155
156
157
158
159
160
161 class TheStatscxx . . $ TheStats# {
162 public:
163 TheStatscxx . . $ TheStats#TheStats(4a15d145234c1b0a).(bool verbose,
164 char *assemblyid1,
165 char *assemblyid2,
166 int maxjump,
167 double minscore) {
168 beVerbosecxx . . $ TheStats#beVerbose. = verbose;
169 strncpy(assemblyId1cxx . . $ TheStats#assemblyId1., assemblyid1, 31); // Note the cap 'i'
170 strncpy(assemblyId2cxx . . $ TheStats#assemblyId2., assemblyid2, 31);
171 maxJumpcxx . . $ TheStats#maxJump. = maxjump;
172 minScorecxx . . $ TheStats#minScore. = minscore;
173
174 sumlen1cxx . . $ TheStats#sumlen1. = 0.0;
175 sumlen2cxx . . $ TheStats#sumlen2. = 0.0;
176 sumMaxLen1cxx . . $ TheStats#sumMaxLen1. = 0.0;
177 sumMaxLen2cxx . . $ TheStats#sumMaxLen2. = 0.0;
178 sumMaxScoreFwdcxx . . $ TheStats#sumMaxScoreFwd. = 0.0;
179 sumMaxScoreRevcxx . . $ TheStats#sumMaxScoreRev. = 0.0;
180 };
181
182 void addcxx . . $ TheStats#add(b43a089d41c6f7f7).(StrandPaircxx . . $ StrandPair# *sp) {
183 sumlen1cxx . . $ TheStats#sumlen1. += sp->getsumlen1cxx . . $ StrandPair#getsumlen1(21b6c25e127938e2).();
184 sumlen2cxx . . $ TheStats#sumlen2. += sp->getsumlen2cxx . . $ StrandPair#getsumlen2(21b6c25e127938e2).();
185 sumMaxLen1cxx . . $ TheStats#sumMaxLen1. += sp->getmaxlen1cxx . . $ StrandPair#getmaxlen1(21b6c25e127938e2).();
186 sumMaxLen2cxx . . $ TheStats#sumMaxLen2. += sp->getmaxlen2cxx . . $ StrandPair#getmaxlen2(21b6c25e127938e2).();
187 sumMaxScoreFwdcxx . . $ TheStats#sumMaxScoreFwd. += sp->getmaxScoreFwdcxx . . $ StrandPair#getmaxScoreFwd(21b6c25e127938e2).();
188 sumMaxScoreRevcxx . . $ TheStats#sumMaxScoreRev. += sp->getmaxScoreRevcxx . . $ StrandPair#getmaxScoreRev(21b6c25e127938e2).();
189 };
190
191 void showcxx . . $ TheStats#show(8d4262d45fc644ab).(FILE *outfile) {
192 fprintf(outfile, "/assemblyId1=%s\n", assemblyId1cxx . . $ TheStats#assemblyId1.);
193 fprintf(outfile, "/assemblyId2=%s\n", assemblyId2cxx . . $ TheStats#assemblyId2.);
194 fprintf(outfile, "/heavyMaxJump=%d\n", maxJumpcxx . . $ TheStats#maxJump.);
195 fprintf(outfile, "/heavyMinFill=%f\n", minScorecxx . . $ TheStats#minScore.);
196 fprintf(outfile, "/heavySumLen1=%f\n", sumlen1cxx . . $ TheStats#sumlen1.);
197 fprintf(outfile, "/heavySumLen2=%f\n", sumlen2cxx . . $ TheStats#sumlen2.);
198 fprintf(outfile, "/heavySumMaxLen1=%f\n", sumMaxLen1cxx . . $ TheStats#sumMaxLen1.);
199 fprintf(outfile, "/heavySumMaxLen2=%f\n", sumMaxLen2cxx . . $ TheStats#sumMaxLen2.);
200 fprintf(outfile, "/heavySumMaxScoreFwd=%f\n", sumMaxScoreFwdcxx . . $ TheStats#sumMaxScoreFwd.);
201 fprintf(outfile, "/heavySumMaxScoreRev=%f\n", sumMaxScoreRevcxx . . $ TheStats#sumMaxScoreRev.);
202 };
203
204 private:
205 // Parameters to the filter
206 int beVerbosecxx . . $ TheStats#beVerbose.;
207 char assemblyId1cxx . . $ TheStats#assemblyId1.[32];
208 char assemblyId2cxx . . $ TheStats#assemblyId2.[32];
209 int maxJumpcxx . . $ TheStats#maxJump.;
210 double minScorecxx . . $ TheStats#minScore.;
211
212 double sumlen1cxx . . $ TheStats#sumlen1.;
213 double sumlen2cxx . . $ TheStats#sumlen2.;
214 double sumMaxLen1cxx . . $ TheStats#sumMaxLen1.;
215 double sumMaxLen2cxx . . $ TheStats#sumMaxLen2.;
216 double sumMaxScoreFwdcxx . . $ TheStats#sumMaxScoreFwd.;
217 double sumMaxScoreRevcxx . . $ TheStats#sumMaxScoreRev.;
218 };
219
220
221
222
223
224 struct Intervalcxx . . $ Interval# {
225 int locxx . . $ Interval#lo.;
226 int hicxx . . $ Interval#hi.;
227 double Scxx . . $ Interval#S.;
228
229 Intervalcxx . . $ Interval#Interval(49f6e7a06ebc5aa8).() {};
230 // This is an explicit redefinition of the default constructor.
231 };
232
233 int x_comparcxx . . $ x_compar(9148c8c3ff42c9d8).(const void *x,const void *y);
234 int y_comparcxx . . $ y_compar(9148c8c3ff42c9d8).(const void *x,const void *y);
235
236 class DPTreecxx . . $ DPTree# {
237 Intervalcxx . . $ Interval# *nodecxx . . $ DPTree#node.;
238 Matchcxx . . $ Match# *matchcxx . . $ DPTree#match.;
239 int node_sizecxx . . $ DPTree#node_size.;
240 int match_sizecxx . . $ DPTree#match_size.; // The number of matches stored in the tree.
241
242 // DP parameters
243 int MaxJumpcxx . . $ DPTree#MaxJump.;
244
245 struct kd_nodecxx . . $ DPTree#kd_node# {
246 bool Xycxx . . $ DPTree#kd_node#Xy.;
247 int startcxx . . $ DPTree#kd_node#start.,stopcxx . . $ DPTree#kd_node#stop.; // The indices to define a segment of the vector.
248 int intvcxx . . $ DPTree#kd_node#intv.; // some index
249 kd_nodecxx . . $ DPTree#kd_node#kd_node(49f6e7a06ebc5aa8).() {};
250 // This is an explicit redefinition of the default constructor.
251
252 inline int nmatchescxx . . $ DPTree#kd_node#nmatches(455f465bc33b4cdf).() const {return stopcxx . . $ DPTree#kd_node#stop.-startcxx . . $ DPTree#kd_node#start.;}
253 inline int midpointcxx . . $ DPTree#kd_node#midpoint(455f465bc33b4cdf).() const {return (startcxx . . $ DPTree#kd_node#start.+stopcxx . . $ DPTree#kd_node#stop.+1)/2;}
254 // This is the midpoint of the match list, not the midpoint of the region.
255
256 inline bool lesser_is_nodecxx . . $ DPTree#kd_node#lesser_is_node(50ce9a9e25b4a850).() const {return nmatchescxx . . $ DPTree#kd_node#nmatches(455f465bc33b4cdf).() > 2;}
257 inline bool greater_is_nodecxx . . $ DPTree#kd_node#greater_is_node(50ce9a9e25b4a850).() const {return nmatchescxx . . $ DPTree#kd_node#nmatches(455f465bc33b4cdf).() > 3;}
258
259 inline bool Xcxx . . $ DPTree#kd_node#X(50ce9a9e25b4a850).() const {return Xycxx . . $ DPTree#kd_node#Xy.;}
260 inline bool Ycxx . . $ DPTree#kd_node#Y(50ce9a9e25b4a850).() const {return !Xycxx . . $ DPTree#kd_node#Xy.;}
261
262 kd_nodecxx . . $ DPTree#kd_node# lesser_nodecxx . . $ DPTree#kd_node#lesser_node(f538118824134260).() const {
263 kd_nodecxx . . $ DPTree#kd_node# ret(*this); // This is an explicit invocation of the copy constructor filled with "this".
264 // Equivalent to: kd_node ret = (*this);
265 ret.intvcxx . . $ DPTree#kd_node#intv. = ret.intvcxx . . $ DPTree#kd_node#intv.*2+1;
266 ret.stopcxx . . $ DPTree#kd_node#stop. = midpointcxx . . $ DPTree#kd_node#midpoint(455f465bc33b4cdf).();
267 ret.Xycxx . . $ DPTree#kd_node#Xy. = !ret.Xycxx . . $ DPTree#kd_node#Xy.;
268 return ret;
269 }
270 kd_nodecxx . . $ DPTree#kd_node# greater_nodecxx . . $ DPTree#kd_node#greater_node(f538118824134260).() const {
271 kd_nodecxx . . $ DPTree#kd_node# ret(*this); // This is an explicit invocation of the copy constructor filled with "this".
272 // Equivalent to: kd_node ret = (*this);
273 ret.intvcxx . . $ DPTree#kd_node#intv. = ret.intvcxx . . $ DPTree#kd_node#intv.*2+2;
274 ret.startcxx . . $ DPTree#kd_node#start. = midpointcxx . . $ DPTree#kd_node#midpoint(455f465bc33b4cdf).();
275 ret.Xycxx . . $ DPTree#kd_node#Xy. = !ret.Xycxx . . $ DPTree#kd_node#Xy.;
276 return ret;
277 }
278 inline kd_nodecxx . . $ DPTree#kd_node# child_nodecxx . . $ DPTree#kd_node#child_node(b2cb1406c908c22a).(int x) const {
279 if (x < midpointcxx . . $ DPTree#kd_node#midpoint(455f465bc33b4cdf).())
280 return lesser_nodecxx . . $ DPTree#kd_node#lesser_node(f538118824134260).();
281 else
282 return greater_nodecxx . . $ DPTree#kd_node#greater_node(f538118824134260).();
283 }
284
285 // root is always real, and everyone else must have at least 2 points
286 inline bool is_realcxx . . $ DPTree#kd_node#is_real(50ce9a9e25b4a850).() const {return intvcxx . . $ DPTree#kd_node#intv.==0 || nmatchescxx . . $ DPTree#kd_node#nmatches(455f465bc33b4cdf).() > 1;}
287 };
288
289 kd_nodecxx . . $ DPTree#kd_node# rootcxx . . $ DPTree#root(f538118824134260).() const {
290 kd_nodecxx . . $ DPTree#kd_node# retcxx . . $ DPTree#kd_node#kd_node(49f6e7a06ebc5aa8).;
291 ret.startcxx . . $ DPTree#kd_node#start. = 0;
292 ret.stopcxx . . $ DPTree#kd_node#stop. = match_sizecxx . . $ DPTree#match_size.;
293 ret.intvcxx . . $ DPTree#kd_node#intv. = 0;
294 ret.Xycxx . . $ DPTree#kd_node#Xy. = true;
295 return ret; // Return the structure by value.
296 }
297
298 public:
299
300 ~cxx . . $ DPTree#`~DPTree`(ced63f7c635d850d).DPTreecxx . . $ DPTree#() {
301 delete[] nodecxx . . $ DPTree#node.;
302 }
303
304 DPTreecxx . . $ DPTree#DPTree(9938aca1ac827af1).(unsigned siz, Matchcxx . . $ Match# *p): nodecxx . . $ DPTree#node.(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!),matchcxx . . $ DPTree#match.(p),
305 node_sizecxx . . $ DPTree#node_size.(0),match_sizecxx . . $ DPTree#match_size.(siz) {
306 node_sizecxx . . $ DPTree#node_size. = 2;
307 for(unsigned sz = match_sizecxx . . $ DPTree#match_size.; sz>1 ; sz/=2, node_sizecxx . . $ DPTree#node_size. *= 2);
308 nodecxx . . $ DPTree#node. = new Intervalcxx . . $ Interval#[node_sizecxx . . $ DPTree#node_size.];
309 }
310
311 inline void setParamscxx . . $ DPTree#setParams(d4f767463ce0a6b3).(int mj) {
312 MaxJumpcxx . . $ DPTree#MaxJump. = mj;
313 }
314
315 double treeScorecxx . . $ DPTree#treeScore(31fa7155c10fdd13).() {
316 initcxx . . $ DPTree#init(49f6e7a06ebc5aa8).();
317 if (match_sizecxx . . $ DPTree#match_size. > 0)
318 privScorecxx . . $ DPTree#privScore(7fc71cd1e34e68ea).(rootcxx . . $ DPTree#root(f538118824134260).(),rootcxx . . $ DPTree#root(f538118824134260).());
319
320 return nodecxx . . $ DPTree#node.[rootcxx . . $ DPTree#root(f538118824134260).().intvcxx . . $ DPTree#kd_node#intv.].Scxx . . $ Interval#S.;
321 }
322
323 private:
324
325 inline double pairScorecxx . . $ DPTree#pairScore(71185c1ee27ded6b).(const Matchcxx . . $ Match# &pl,const Matchcxx . . $ Match# &ph) const {
326 const int dx = ph.xlocxx . . $ Match#xlo. - pl.xlocxx . . $ Match#xlo.;
327 const int dy = ph.ylocxx . . $ Match#ylo. - pl.ylocxx . . $ Match#ylo.; // causality difference
328
329 const int ix = ph.xlocxx . . $ Match#xlo. - pl.xhicxx . . $ Match#xhi.;
330 const int iy = ph.ylocxx . . $ Match#ylo. - pl.yhicxx . . $ Match#yhi.;
331
332 const int smaller_jump = (ix < iy)?ix:iy; // will be < 0 if they intersect
333 const int larger_jump = (ix < iy)?iy:ix; // must be < MaxJump for an interaction
334
335 int intersection = smaller_jump * (smaller_jump < 0);
336
337 return (dx >= 0 && dy >= 0 && larger_jump < MaxJumpcxx . . $ DPTree#MaxJump.)
338 * (pl.Scxx . . $ Match#S. + intersection );
339 }
340
341 inline bool pruneScorecxx . . $ DPTree#pruneScore(14f5ed5d88db3510).(kd_nodecxx . . $ DPTree#kd_node# f,
342 const Matchcxx . . $ Match# &p) const {
343 int d,jd;
344
345 if (f.Xcxx . . $ DPTree#kd_node#X(50ce9a9e25b4a850).()) {
346 jd = p.xlocxx . . $ Match#xlo. - nodecxx . . $ DPTree#node.[f.intvcxx . . $ DPTree#kd_node#intv.].hicxx . . $ Interval#hi.;
347 d = p.xlocxx . . $ Match#xlo. - nodecxx . . $ DPTree#node.[f.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo.;
348 }
349 else {
350 jd = p.ylocxx . . $ Match#ylo. - nodecxx . . $ DPTree#node.[f.intvcxx . . $ DPTree#kd_node#intv.].hicxx . . $ Interval#hi.;
351 d = p.ylocxx . . $ Match#ylo. - nodecxx . . $ DPTree#node.[f.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo.;
352 }
353 // returns true if we really need to check this score
354 return (d >= 0 && jd < MaxJumpcxx . . $ DPTree#MaxJump.) && (nodecxx . . $ DPTree#node.[f.intvcxx . . $ DPTree#kd_node#intv.].Scxx . . $ Interval#S. >= p.Scxx . . $ Match#S.);
355 }
356
357 double privScorecxx . . $ DPTree#privScore(7fc71cd1e34e68ea).(kd_nodecxx . . $ DPTree#kd_node# flo,kd_nodecxx . . $ DPTree#kd_node# fhi) {
358 // no longer double recursive -- just iterate through fhi
359 for(int x = fhi.startcxx . . $ DPTree#kd_node#start.; x < fhi.stopcxx . . $ DPTree#kd_node#stop.; ++x) {
360 matchcxx . . $ DPTree#match.[x].Scxx . . $ Match#S. = 0;
361 matchScorecxx . . $ DPTree#matchScore(6cbc755393f40797).(flo,matchcxx . . $ DPTree#match.[x]);
362 matchcxx . . $ DPTree#match.[x].Scxx . . $ Match#S. += matchcxx . . $ DPTree#match.[x].selfScxx . . $ Match#selfS.;
363
364 for(kd_nodecxx . . $ DPTree#kd_node# tmp(fhi); tmp.is_realcxx . . $ DPTree#kd_node#is_real(50ce9a9e25b4a850).() ; tmp =cxx . . $ DPTree#kd_node#`operator=`(f458b75f71600d5). tmp.child_nodecxx . . $ DPTree#kd_node#child_node(b2cb1406c908c22a).(x)) {
365 if (nodecxx . . $ DPTree#node.[tmp.intvcxx . . $ DPTree#kd_node#intv.].Scxx . . $ Interval#S. < matchcxx . . $ DPTree#match.[x].Scxx . . $ Match#S.) nodecxx . . $ DPTree#node.[tmp.intvcxx . . $ DPTree#kd_node#intv.].Scxx . . $ Interval#S. = matchcxx . . $ DPTree#match.[x].Scxx . . $ Match#S.;
366 }
367 }
368 return nodecxx . . $ DPTree#node.[fhi.intvcxx . . $ DPTree#kd_node#intv.].Scxx . . $ Interval#S.;
369 }
370
371 double matchScorecxx . . $ DPTree#matchScore(6cbc755393f40797).(kd_nodecxx . . $ DPTree#kd_node# flo,Matchcxx . . $ Match# &p) {
372 double score = 0;
373
374 if ( (flo.Xcxx . . $ DPTree#kd_node#X(50ce9a9e25b4a850).() && nodecxx . . $ DPTree#node.[flo.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo. <= p.xlocxx . . $ Match#xlo. ||
375 flo.Ycxx . . $ DPTree#kd_node#Y(50ce9a9e25b4a850).() && nodecxx . . $ DPTree#node.[flo.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo. <= p.ylocxx . . $ Match#ylo.)
376 && pruneScorecxx . . $ DPTree#pruneScore(14f5ed5d88db3510).(flo,p) ) {
377
378 if (flo.greater_is_nodecxx . . $ DPTree#kd_node#greater_is_node(50ce9a9e25b4a850).())
379 score = matchScorecxx . . $ DPTree#matchScore(6cbc755393f40797).(flo.greater_nodecxx . . $ DPTree#kd_node#greater_node(f538118824134260).(),p);
380 else
381 score = pairScorecxx . . $ DPTree#pairScore(71185c1ee27ded6b).(matchcxx . . $ DPTree#match.[flo.stopcxx . . $ DPTree#kd_node#stop.-1],p);
382 if (p.Scxx . . $ Match#S. < score) p.Scxx . . $ Match#S. = score;
383
384 if (flo.lesser_is_nodecxx . . $ DPTree#kd_node#lesser_is_node(50ce9a9e25b4a850).())
385 score = matchScorecxx . . $ DPTree#matchScore(6cbc755393f40797).(flo.lesser_nodecxx . . $ DPTree#kd_node#lesser_node(f538118824134260).(),p);
386 else
387 score = pairScorecxx . . $ DPTree#pairScore(71185c1ee27ded6b).(matchcxx . . $ DPTree#match.[flo.startcxx . . $ DPTree#kd_node#start.],p);
388
389 if (p.Scxx . . $ Match#S. < score) p.Scxx . . $ Match#S. = score;
390
391 }
392 return p.Scxx . . $ Match#S.;
393 }
394
395 void initcxx . . $ DPTree#init(49f6e7a06ebc5aa8).() {
396 if (match_sizecxx . . $ DPTree#match_size. > 0){ sort_nodescxx . . $ DPTree#sort_nodes(2b16be6114797500).(rootcxx . . $ DPTree#root(f538118824134260).());}
397
398 int minx=0,miny=0,maxx=0,maxy=0; // initial values will be overwritten
399 get_bboxcxx . . $ DPTree#get_bbox(b2f4791cfb6c4ae).(rootcxx . . $ DPTree#root(f538118824134260).(),minx,miny,maxx,maxy);
400
401 for (int i=0; i < node_sizecxx . . $ DPTree#node_size.; ++i) nodecxx . . $ DPTree#node.[i].Scxx . . $ Interval#S. = -1;
402 for (int i=0; i < match_sizecxx . . $ DPTree#match_size.; ++i) matchcxx . . $ DPTree#match.[i].Scxx . . $ Match#S. = -1;
403 }
404
405 void sort_nodescxx . . $ DPTree#sort_nodes(2b16be6114797500).(kd_nodecxx . . $ DPTree#kd_node# fs) {
406 if (fs.intvcxx . . $ DPTree#kd_node#intv. >= node_sizecxx . . $ DPTree#node_size.) {
407 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"overflow %d %d\n",fs.intvcxx . . $ DPTree#kd_node#intv.,node_sizecxx . . $ DPTree#node_size.);
408 }
409
410 qsortcxx . . $ qsort(ebb60b13a65e77d7).( matchcxx . . $ DPTree#match.+fs.startcxx . . $ DPTree#kd_node#start., fs.nmatchescxx . . $ DPTree#kd_node#nmatches(455f465bc33b4cdf).(), sizeof(Matchcxx . . $ Match#),
411 (fs.Xcxx . . $ DPTree#kd_node#X(50ce9a9e25b4a850).()?x_comparcxx . . $ x_compar(9148c8c3ff42c9d8).:y_comparcxx . . $ y_compar(9148c8c3ff42c9d8).) );
412
413 if (fs.greater_is_nodecxx . . $ DPTree#kd_node#greater_is_node(50ce9a9e25b4a850).()) sort_nodescxx . . $ DPTree#sort_nodes(2b16be6114797500).(fs.greater_nodecxx . . $ DPTree#kd_node#greater_node(f538118824134260).());
414 if (fs.lesser_is_nodecxx . . $ DPTree#kd_node#lesser_is_node(50ce9a9e25b4a850).()) sort_nodescxx . . $ DPTree#sort_nodes(2b16be6114797500).(fs.lesser_nodecxx . . $ DPTree#kd_node#lesser_node(f538118824134260).());
415 }
416
417 void get_bboxcxx . . $ DPTree#get_bbox(b2f4791cfb6c4ae).(kd_nodecxx . . $ DPTree#kd_node# fs,int &minx,int &miny,int &maxx,int &maxy) {
418 int lminx,lminy,lmaxx,lmaxy;
419 int gminx,gminy,gmaxx,gmaxy;
420
421 if (fs.lesser_is_nodecxx . . $ DPTree#kd_node#lesser_is_node(50ce9a9e25b4a850).()) {
422 get_bboxcxx . . $ DPTree#get_bbox(b2f4791cfb6c4ae).(fs.lesser_nodecxx . . $ DPTree#kd_node#lesser_node(f538118824134260).(),lminx,lminy,lmaxx,lmaxy);
423 }
424 else {
425 lminx = matchcxx . . $ DPTree#match.[fs.startcxx . . $ DPTree#kd_node#start.].xlocxx . . $ Match#xlo.;
426 lmaxx = matchcxx . . $ DPTree#match.[fs.startcxx . . $ DPTree#kd_node#start.].xhicxx . . $ Match#xhi.;
427 lminy = matchcxx . . $ DPTree#match.[fs.startcxx . . $ DPTree#kd_node#start.].ylocxx . . $ Match#ylo.;
428 lmaxy = matchcxx . . $ DPTree#match.[fs.startcxx . . $ DPTree#kd_node#start.].yhicxx . . $ Match#yhi.;
429 }
430
431 if (fs.greater_is_nodecxx . . $ DPTree#kd_node#greater_is_node(50ce9a9e25b4a850).()) {
432 get_bboxcxx . . $ DPTree#get_bbox(b2f4791cfb6c4ae).(fs.greater_nodecxx . . $ DPTree#kd_node#greater_node(f538118824134260).(),gminx,gminy,gmaxx,gmaxy);
433 }
434 else {
435 gminx = matchcxx . . $ DPTree#match.[fs.stopcxx . . $ DPTree#kd_node#stop.-1].xlocxx . . $ Match#xlo.;
436 gmaxx = matchcxx . . $ DPTree#match.[fs.stopcxx . . $ DPTree#kd_node#stop.-1].xhicxx . . $ Match#xhi.;
437 gminy = matchcxx . . $ DPTree#match.[fs.stopcxx . . $ DPTree#kd_node#stop.-1].ylocxx . . $ Match#ylo.;
438 gmaxy = matchcxx . . $ DPTree#match.[fs.stopcxx . . $ DPTree#kd_node#stop.-1].yhicxx . . $ Match#yhi.;
439 }
440
441 miny = (lminy < gminy)?lminy:gminy;
442 minx = (lminx < gminx)?lminx:gminx;
443 maxy = (lmaxy > gmaxy)?lmaxy:gmaxy;
444 maxx = (lmaxx > gmaxx)?lmaxx:gmaxx;
445
446 if (fs.Xcxx . . $ DPTree#kd_node#X(50ce9a9e25b4a850).()) {
447 nodecxx . . $ DPTree#node.[fs.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo. = minx;
448 nodecxx . . $ DPTree#node.[fs.intvcxx . . $ DPTree#kd_node#intv.].hicxx . . $ Interval#hi. = maxx;
449 }
450 else {
451 nodecxx . . $ DPTree#node.[fs.intvcxx . . $ DPTree#kd_node#intv.].locxx . . $ Interval#lo. = miny;
452 nodecxx . . $ DPTree#node.[fs.intvcxx . . $ DPTree#kd_node#intv.].hicxx . . $ Interval#hi. = maxy;
453 }
454
455 }
456 };
457
458
459
460
461
462 #endif // STRANDPAIR_H