Debian Codegraph @

atac-driver/alignOverlap/overlap-find.C

raw symbols SCIP
1 // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/alignOverlap/overlap-find.C`/
2 // Copyright (c) 2005 J. Craig Venter Institute
3 // Author: Brian Walenz
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received (LICENSE.txt) a copy of the GNU General Public
16 // License along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #include "overlap.H"cxx . . $ `<file>/atac-driver/alignOverlap/overlap.H`/
20
21 // Looks for 1's surrounded by U's
22 void
23 findIsolatedUniquecxx . . $ findIsolatedUnique(a7abe536f834c7ea).(annoListcxx . . $ annoList# *AL, uint32cxx . . $ uint32# ALlen) {
24 bool only1 = true;
25 uint32cxx . . $ uint32# sumA = 0, tA=0;
26 uint32cxx . . $ uint32# sumB = 0, tB=0;
27
28 for (uint32cxx . . $ uint32# i=1; i<ALlen; i++) {
29 if (AL[i].typecxx . . $ annoList#type. == 'U') {
30 if (only1 && (!tA || !tB)) {
31 sumA += tA;
32 sumB += tB;
33 }
34 tA = 0;
35 tB = 0;
36 only1 = true;
37 } else if (AL[i].typecxx . . $ annoList#type. != '1') {
38 only1 = false;
39 } else {
40 tA += AL[i].len2acxx . . $ annoList#len2a.;
41 tB += AL[i].len2bcxx . . $ annoList#len2b.;
42 }
43 }
44
45 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "isolated Unique: map1: "uint32FMTcxx . . $ `libutil/util.h:65:10`!" map2: "uint32FMTcxx . . $ `libutil/util.h:65:10`!"\n", sumA, sumB);
46 }
47
48
49
50 uint32cxx . . $ uint32# encodeTypecxx . . $ encodeType(2141b656ce2cc063).(uint32cxx . . $ uint32# type) {
51 uint32cxx . . $ uint32# t = 9;
52 if (type == 'U') t = 0;
53 else if (type == '1') t = 1;
54 else if (type == 'Y') t = 2;
55 else if (type == 'N') t = 3;
56 else if (type == '?') t = 4;
57 else if (type == '!') t = 5;
58 if (t == 9)
59 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "got invalid type; "uint32FMTcxx . . $ `libutil/util.h:65:10`!" -- %c\n", type, (char)type), exitcxx . . $ exit(44ed87f96534fad7).(1);
60 return(t);
61 }
62
63
64
65 // Looks for 1's at the end of a Y, that have the same match id
66 void
67 findExtendedcxx . . $ findExtended(a7abe536f834c7ea).(annoListcxx . . $ annoList# *AL, uint32cxx . . $ uint32# ALlen) {
68
69 class stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# {
70 public:
71 uint32cxx . . $ uint32# countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count.;
72 uint32cxx . . $ uint32# lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len.;
73
74 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).() {
75 countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count. = 0;
76 lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len. = 0;
77 };
78
79 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# &operatorcxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(eaa66fc6607ecd57).+=(uint32cxx . . $ uint32# x) {
80 countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count.++;
81 lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len. += x;
82 return(*this);
83 };
84 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# &operatorcxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9).+=(stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# &x) {
85 countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count. += x.countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count.;
86 lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len. += x.lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len.;
87 return(*this);
88 };
89
90 void printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).(char const *msg) {
91 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "%s: "uint32FMTcxx . . $ `libutil/util.h:65:10`!" len:"uint32FMTcxx . . $ `libutil/util.h:65:10`!"\n", msg, countcxx . . $ findExtended(a7abe536f834c7ea).stat_s#count., lencxx . . $ findExtended(a7abe536f834c7ea).stat_s#len.);
92 };
93 };
94
95 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# count1cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).[6][6][2][2][2];
96 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# count2cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).[6][6][2][2][2];
97
98 // Look forward for the next event:
99 // non-1
100 // the iid changed
101 //
102 // End is the match after the 1, beg is the match before the 1.
103 //
104 for (uint32cxx . . $ uint32# i=0; i<ALlen; i++) {
105 if (AL[i].typecxx . . $ annoList#type. == '1') {
106 uint32cxx . . $ uint32# beg = i-1;
107 uint32cxx . . $ uint32# gap = i;
108 uint32cxx . . $ uint32# end = i;
109 uint32cxx . . $ uint32# len = 0;
110
111 if (AL[gap].iid2acxx . . $ annoList#iid2a.) {
112 while ((AL[gap].iid2acxx . . $ annoList#iid2a. == AL[end].iid2acxx . . $ annoList#iid2a.) && (AL[end].typecxx . . $ annoList#type. == '1')) {
113 len += AL[end].len1cxx . . $ annoList#len1.;
114 end++;
115 }
116 } else {
117 while ((AL[gap].iid2bcxx . . $ annoList#iid2b. == AL[end].iid2bcxx . . $ annoList#iid2b.) && (AL[end].typecxx . . $ annoList#type. == '1')) {
118 len += AL[end].len1cxx . . $ annoList#len1.;
119 end++;
120 }
121 }
122
123 if (beg == gap)
124 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "beg == gap?\n"), exitcxx . . $ exit(44ed87f96534fad7).(1);
125 if (gap == end)
126 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "end == gap?\n"), exitcxx . . $ exit(44ed87f96534fad7).(1);
127
128 uint32cxx . . $ uint32# tbeg = encodeTypecxx . . $ encodeType(2141b656ce2cc063).(AL[beg].typecxx . . $ annoList#type.);
129 uint32cxx . . $ uint32# tend = encodeTypecxx . . $ encodeType(2141b656ce2cc063).(AL[end].typecxx . . $ annoList#type.);
130
131 bool mbeg, mend, moth;
132 if (AL[gap].iid2acxx . . $ annoList#iid2a.) {
133 mbeg = (AL[beg].iid2acxx . . $ annoList#iid2a. == AL[gap].iid2acxx . . $ annoList#iid2a.);
134 mend = (AL[end].iid2acxx . . $ annoList#iid2a. == AL[gap].iid2acxx . . $ annoList#iid2a.);
135 moth = (AL[beg].iid2bcxx . . $ annoList#iid2b. == AL[end].iid2bcxx . . $ annoList#iid2b.);
136 count1[tbeg][tend][mbeg][mend][moth] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(eaa66fc6607ecd57). len;
137 } else {
138 mbeg = (AL[beg].iid2bcxx . . $ annoList#iid2b. == AL[gap].iid2bcxx . . $ annoList#iid2b.);
139 mend = (AL[end].iid2bcxx . . $ annoList#iid2b. == AL[gap].iid2bcxx . . $ annoList#iid2b.);
140 moth = (AL[beg].iid2acxx . . $ annoList#iid2a. == AL[end].iid2acxx . . $ annoList#iid2a.);
141 count2[tbeg][tend][mbeg][mend][moth] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(eaa66fc6607ecd57). len;
142 }
143 }
144 }
145
146
147 char label[6] = {'U', '1', 'Y', 'N', '?', '!'};
148
149 #define TYPE_Ucxx . . $ `atac-driver/alignOverlap/overlap-find.C:149:9`! 0
150 #define TYPE_1cxx . . $ `atac-driver/alignOverlap/overlap-find.C:150:9`! 1
151 #define TYPE_Ycxx . . $ `atac-driver/alignOverlap/overlap-find.C:151:9`! 2
152 #define TYPE_Ncxx . . $ `atac-driver/alignOverlap/overlap-find.C:152:9`! 3
153 #define TYPE_Qcxx . . $ `atac-driver/alignOverlap/overlap-find.C:153:9`! 4
154 #define TYPE_Ecxx . . $ `atac-driver/alignOverlap/overlap-find.C:154:9`! 5
155
156 // If the other iid is the same, then these are all interesting cases
157 // Maybe not.
158 #if 0
159 stat_s oth_cnst_1;
160 stat_s oth_cnst_2;
161 stat_s oth_diff_1;
162 stat_s oth_diff_2;
163
164 for (uint32 i=0; i<6; i++)
165 for (uint32 j=0; j<6; j++)
166 for (uint32 k=0; k<2; k++)
167 for (uint32 l=0; l<2; l++) {
168 oth_cnst_1 += count1[i][j][k][l][1];
169 oth_cnst_2 += count2[i][j][k][l][1];
170 oth_diff_1 += count1[i][j][k][l][0];
171 oth_diff_2 += count2[i][j][k][l][0];
172 }
173 fprintf(stderr, "count1 other iid constant: "uint32FMT" len:"uint32FMT"\n", oth_cnst_1.count, oth_cnst_1.len);
174 fprintf(stderr, "count2 other iid constant: "uint32FMT" len:"uint32FMT"\n", oth_cnst_2.count, oth_cnst_2.len);
175 fprintf(stderr, "count1 other iid different: "uint32FMT" len:"uint32FMT"\n", oth_diff_1.count, oth_diff_1.len);
176 fprintf(stderr, "count2 other iid different: "uint32FMT" len:"uint32FMT"\n", oth_diff_2.count, oth_diff_2.len);
177 #endif
178
179 #if 0
180 for (uint32 tbeg=0; tbeg<6; tbeg++)
181 for (uint32 tend=0; tend<6; tend++)
182 for (uint32 mbeg=0; mbeg<2; mbeg++)
183 for (uint32 mend=0; mend<2; mend++)
184 for (uint32 moth=0; moth<2; moth++) {
185 }
186 #endif
187
188
189 // Look for things with an extra piece in the middle -- mbeg and mend
190 //
191 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extraMid1cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).[7];
192 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extraMid2cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).[7];
193
194 for (uint32cxx . . $ uint32# tbeg=0; tbeg<6; tbeg++)
195 for (uint32cxx . . $ uint32# tend=0; tend<6; tend++)
196 for (uint32cxx . . $ uint32# mbeg=0; mbeg<2; mbeg++)
197 for (uint32cxx . . $ uint32# mend=0; mend<2; mend++)
198 for (uint32cxx . . $ uint32# moth=0; moth<2; moth++) {
199 if (mbeg && mend) {
200 extraMid1[6] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count1[tbeg][tend][mbeg][mend][moth];
201 extraMid2[6] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count2[tbeg][tend][mbeg][mend][moth];
202
203 if (tbeg == tend) {
204 extraMid1[tbeg] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count1[tbeg][tend][mbeg][mend][moth];
205 extraMid2[tbeg] +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count2[tbeg][tend][mbeg][mend][moth];
206 }
207 }
208 }
209
210 extraMid1[6].printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extra middle 1");
211 extraMid2[6].printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extra middle 2");
212 for (uint32cxx . . $ uint32# i=0; i<6; i++) {
213 char l[64];
214 sprintf(l, "extra middle 1 %c", label[i]);
215 extraMid1[i].printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).(l);
216 sprintf(l, "extra middle 2 %c", label[i]);
217 extraMid2[i].printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).(l);
218 }
219
220 // Look for true extensions
221 //
222 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extY1cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).;
223 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extN1cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).;
224 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extY2cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).;
225 stat_scxx . . $ findExtended(a7abe536f834c7ea).stat_s# extN2cxx . . $ findExtended(a7abe536f834c7ea).stat_s#stat_s(49f6e7a06ebc5aa8).;
226
227 for (uint32cxx . . $ uint32# tbeg=0; tbeg<6; tbeg++)
228 for (uint32cxx . . $ uint32# tend=0; tend<6; tend++)
229 for (uint32cxx . . $ uint32# mbeg=0; mbeg<2; mbeg++)
230 for (uint32cxx . . $ uint32# mend=0; mend<2; mend++)
231 for (uint32cxx . . $ uint32# moth=0; moth<2; moth++) {
232 if (mbeg && !mend) {
233 if (tbeg == TYPE_Ycxx . . $ `atac-driver/alignOverlap/overlap-find.C:151:9`!) {
234 extY1 +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count1[tbeg][tend][mbeg][mend][moth];
235 } else {
236 extN1 +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count1[tbeg][tend][mbeg][mend][moth];
237 }
238 }
239 if (!mbeg && mend) {
240 if (tend == TYPE_Ycxx . . $ `atac-driver/alignOverlap/overlap-find.C:151:9`!) {
241 extY2 +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count2[tbeg][tend][mbeg][mend][moth];
242 } else {
243 extN2 +=cxx . . $ findExtended(a7abe536f834c7ea).stat_s#`operator+=`(5cfae162e3d76a9). count2[tbeg][tend][mbeg][mend][moth];
244 }
245 }
246 }
247 extY1.printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extension Y 1");
248 extN1.printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extension N 1");
249 extY2.printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extension Y 2");
250 extN2.printcxx . . $ findExtended(a7abe536f834c7ea).stat_s#print(85c52e162fed56f9).("extension N 2");
251
252
253 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "----------------------------------------\n");
254 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "BEGIN IID SAME, END IID SAME, OTHER IID SAME\n");
255 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "----------------------------------------\n");
256 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "END IID\n");
257 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "----------------------------------------\n");
258 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "OTHER IID\n");
259 }