| 1 | // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/chainer/halign/halign.C`/ |
| 2 | // Copyright (c) 2004 Applera Corporation |
| 3 | // Author: Clark Mobarry |
| 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 | |
| 20 | #include <stdio.h> |
| 21 | #include <stdlib.h> |
| 22 | #include <unistd.h> |
| 23 | #include <string.h> |
| 24 | #include <assert.h> |
| 25 | #include <stdlib.h> |
| 26 | |
| 27 | #include "halign.H"cxx . . $ `<file>/atac-driver/chainer/halign/halign.H`/ |
| 28 | |
| 29 | #if defined (__SVR4) && defined (__sun) |
| 30 | // Solaris defines SS in sys/regset.h |
| 31 | #undef SS |
| 32 | #endif |
| 33 | |
| 34 | #define mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(x,y) ((x)<=(y) ? (x):(y)) |
| 35 | #define maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(x,y) ((x)>=(y) ? (x):(y)) |
| 36 | |
| 37 | typedef enumcxx . . $ $anonymous_type_526e28911a3460ef_0# { DELcxx . . $ DEL., INScxx . . $ INS., SUBcxx . . $ SUB., MOVcxx . . $ MOV. } OpTypecxx . . $ OpType#; |
| 38 | |
| 39 | #define STARTcxx . . $ `atac-driver/chainer/halign/halign.C:39:9`! 1 // The position of the first character. |
| 40 | #define GAP_OPENcxx . . $ `atac-driver/chainer/halign/halign.C:40:9`! 1 // These are costs. |
| 41 | #define GAP_EXTENDcxx . . $ `atac-driver/chainer/halign/halign.C:41:9`! 1 |
| 42 | #define MISMATCHcxx . . $ `atac-driver/chainer/halign/halign.C:42:9`! 1 |
| 43 | |
| 44 | class EditScriptcxx . . $ EditScript# { |
| 45 | public: |
| 46 | EditScriptcxx . . $ EditScript#EditScript(4b03adf3ac9341aa).(OpTypecxx . . $ OpType# op, int nm, EditScriptcxx . . $ EditScript# *nx) { |
| 47 | op_typecxx . . $ EditScript#op_type. = op; |
| 48 | numcxx . . $ EditScript#num. = nm; |
| 49 | nextcxx . . $ EditScript#next. = nx; |
| 50 | }; |
| 51 | |
| 52 | OpTypecxx . . $ OpType# op_typecxx . . $ EditScript#op_type.; // SUB, MOV, INS, or DEL |
| 53 | int numcxx . . $ EditScript#num.; // Number of operations |
| 54 | EditScriptcxx . . $ EditScript# *nextcxx . . $ EditScript#next.; |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | void |
| 59 | convertScriptToAlignmentcxx . . $ convertScriptToAlignment(9b2037964617156a).(EditScriptcxx . . $ EditScript# *head, |
| 60 | H_Alignment_tcxx . . $ H_Alignment_t# *aln) { |
| 61 | |
| 62 | EditScriptcxx . . $ EditScript# *tp = head; |
| 63 | EditScriptcxx . . $ EditScript# *tp1; |
| 64 | int scriptLen = 3; |
| 65 | |
| 66 | |
| 67 | // Three sets of comments, from three different sources: |
| 68 | // |
| 69 | // Condense_script - merge contiguous operations of the same type |
| 70 | // together. Remove the leftmost dummy script (Ascript[0][0]) |
| 71 | // |
| 72 | // Condense the script in block operations; this will modify the |
| 73 | // script and will cut off the dummy edit op from the linked list |
| 74 | // |
| 75 | // Condense any repeat operations. For example, condense this |
| 76 | // script: "DEL 5; DEL 3" into this array representation: "DEL 8". |
| 77 | |
| 78 | while (tp && tp->nextcxx . . $ EditScript#next.) { |
| 79 | scriptLen += 2; |
| 80 | |
| 81 | while (((tp1 = tp->nextcxx . . $ EditScript#next.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) && |
| 82 | (tp->op_typecxx . . $ EditScript#op_type. == tp1->op_typecxx . . $ EditScript#op_type.)) { |
| 83 | tp->numcxx . . $ EditScript#num. += tp1->numcxx . . $ EditScript#num.; |
| 84 | tp->nextcxx . . $ EditScript#next. = tp1->nextcxx . . $ EditScript#next.; |
| 85 | freecxx . . $ free(bd21765a0afc8e3c).(tp1); |
| 86 | } |
| 87 | |
| 88 | tp = tp->nextcxx . . $ EditScript#next.; |
| 89 | } |
| 90 | |
| 91 | // Allocate space for the alignment |
| 92 | // |
| 93 | if (aln->scriptAsArrayMaxcxx . . $ H_Alignment_t#scriptAsArrayMax. <= scriptLen) { |
| 94 | freecxx . . $ free(bd21765a0afc8e3c).(aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.); |
| 95 | |
| 96 | aln->scriptAsArrayMaxcxx . . $ H_Alignment_t#scriptAsArrayMax. = scriptLen; |
| 97 | aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray. = (int *)malloccxx . . $ malloc(9f008b2a9698428b).(scriptLen * sizeof(int)); |
| 98 | |
| 99 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(aln->scriptAsArray != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 100 | } |
| 101 | |
| 102 | aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.[0] = 0; |
| 103 | |
| 104 | // Convert. |
| 105 | // |
| 106 | int arySize = 0; |
| 107 | EditScriptcxx . . $ EditScript# *tpdel = 0L; |
| 108 | |
| 109 | tp = head; |
| 110 | while (tp != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 111 | aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.[++arySize] = tp->op_typecxx . . $ EditScript#op_type.; |
| 112 | aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.[++arySize] = tp->numcxx . . $ EditScript#num.; |
| 113 | |
| 114 | tpdel = tp; |
| 115 | tp = tp->nextcxx . . $ EditScript#next.; |
| 116 | delete tpdel; |
| 117 | } |
| 118 | |
| 119 | aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.[0] = arySize; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | |
| 124 | static |
| 125 | int |
| 126 | diffcxx . . $ diff(6164115f3a143670).(const char *s1, |
| 127 | const char *s2, |
| 128 | int len1, |
| 129 | int len2, |
| 130 | int *CC, |
| 131 | int *DD, |
| 132 | int *RR, |
| 133 | int *SS, |
| 134 | int g, |
| 135 | int h, |
| 136 | int x, |
| 137 | int start_cgap, |
| 138 | int end_cgap, |
| 139 | int free_start, |
| 140 | int free_end, |
| 141 | int tb, |
| 142 | int te, |
| 143 | EditScriptcxx . . $ EditScript# **head, |
| 144 | EditScriptcxx . . $ EditScript# **tail) { |
| 145 | |
| 146 | int i, j, s, t, c, e, tmp; |
| 147 | const char *a, *b; |
| 148 | int mincost, mintype, midi, midj; |
| 149 | EditScriptcxx . . $ EditScript# *tmp_head = 0L; |
| 150 | EditScriptcxx . . $ EditScript# *tmp_tail = 0L; |
| 151 | |
| 152 | if (len1==0 && len2==0) { |
| 153 | |
| 154 | *head = *tail = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 155 | return 0; |
| 156 | |
| 157 | } else if (len2 == 0) { |
| 158 | int tmpb, tmpe; |
| 159 | |
| 160 | *head = *tail = new EditScriptcxx . . $ EditScript#(DELcxx . . $ DEL.,len1,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 161 | tmpb = (len1 <= start_cgap) ? 0 : tb+h*(len1-start_cgap); |
| 162 | tmpe = (len1 <= end_cgap) ? 0 : te+h*(len1-end_cgap); |
| 163 | |
| 164 | return mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(tmpb,tmpe); |
| 165 | |
| 166 | } else if (len1 == 0) { |
| 167 | |
| 168 | *head = *tail = new EditScriptcxx . . $ EditScript#(INScxx . . $ INS.,len2,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 169 | return ((free_start || free_end) ? 0 : g+(len2*h)); |
| 170 | |
| 171 | } else if (len1 == 1) { |
| 172 | int tmpcost; |
| 173 | char ch; |
| 174 | |
| 175 | /* insert B, delete A; or delete A, insert B */ |
| 176 | mincost = (start_cgap ? 0 : mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(tb,te)+h) + ((free_start || free_end) ? 0 : g+len2*h); |
| 177 | mintype = 2; midj = (free_start ? len2 : 0); |
| 178 | |
| 179 | /* ... or insert some B, substitute A, insert the rest of B */ |
| 180 | for (j=0, ch=*s1; j<len2; j++) { |
| 181 | tmpcost = (ch==s2[j]) ? 0 : x; |
| 182 | if (!free_start && j) tmpcost += g+j*h; |
| 183 | if (!free_end && j+1<len2) tmpcost += g+(len2-j-1)*h; |
| 184 | if (tmpcost<mincost) { mincost = tmpcost; mintype = 1; midj = j; } |
| 185 | } |
| 186 | if (mintype==2) { |
| 187 | /* delete A */ |
| 188 | if (free_start) { |
| 189 | *tail = new EditScriptcxx . . $ EditScript#(DELcxx . . $ DEL.,1,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 190 | *head = new EditScriptcxx . . $ EditScript#(INScxx . . $ INS.,len2,*tail); |
| 191 | } else { |
| 192 | *tail = new EditScriptcxx . . $ EditScript#(INScxx . . $ INS.,len2,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 193 | *head = new EditScriptcxx . . $ EditScript#(DELcxx . . $ DEL.,1,*tail); |
| 194 | } |
| 195 | } else { /* substitute A */ |
| 196 | EditScriptcxx . . $ EditScript# *aux; |
| 197 | *tail = (midj<len2-1) ? new EditScriptcxx . . $ EditScript#(INScxx . . $ INS.,len2-midj-1,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 198 | aux = new EditScriptcxx . . $ EditScript#((ch==s2[midj] ? MOVcxx . . $ MOV. : SUBcxx . . $ SUB.),1,*tail); |
| 199 | if (*tail==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) *tail = aux; |
| 200 | *head = (midj>0) ? new EditScriptcxx . . $ EditScript#(INScxx . . $ INS.,midj,aux) : aux; |
| 201 | } |
| 202 | return mincost; |
| 203 | |
| 204 | } else { |
| 205 | int tmph, tmpg; |
| 206 | |
| 207 | midi = (int)(len1/2); |
| 208 | |
| 209 | /* compute CC and DD in the forward phase */ |
| 210 | tmph = free_start ? 0 : h; |
| 211 | tmpg = free_start ? 0 : g; |
| 212 | for (CC[0]=0, t=tmpg, j=1; j<=len2; j++) { |
| 213 | /* if free_start, allow gap-free ends in the genomic sequence */ |
| 214 | CC[j] = DD[j] = t = t+tmph; |
| 215 | DD[j] += tmpg; |
| 216 | } |
| 217 | |
| 218 | for (a=s1, i=1; i<=midi; i++, a++) { |
| 219 | |
| 220 | s = CC[0]; |
| 221 | CC[0] = c = t = maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(i-start_cgap,0)*h + (i>start_cgap)*tb; |
| 222 | |
| 223 | e = t + g; |
| 224 | for (b=s2, j=1; j<=len2; j++, b++) { |
| 225 | |
| 226 | e = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(e, c+g) + h; |
| 227 | |
| 228 | DD[j] = (j==len2 && i>=len1-end_cgap+1) ? |
| 229 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(DD[j], CC[j]) : (mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(DD[j]+(i==start_cgap+1)*g, CC[j]+g) + h); |
| 230 | |
| 231 | c = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(DD[j], mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(e, s+x*(*a!=*b))); |
| 232 | s = CC[j]; CC[j] = c; |
| 233 | } |
| 234 | } |
| 235 | DD[0] = CC[0]; |
| 236 | |
| 237 | /* compute RR and SS in the reverse phase */ |
| 238 | tmph = free_end ? 0 : h; |
| 239 | tmpg = free_end ? 0 : g; |
| 240 | for (RR[len2]=0, t=tmpg, j=len2-1; j>=0; --j) { |
| 241 | /* if free_end, allow gap-free ends in the genomic sequence */ |
| 242 | RR[j] = SS[j] = t = t+tmph; |
| 243 | SS[j] += tmpg; |
| 244 | } |
| 245 | |
| 246 | for (a=s1+len1-1, i=len1-1; i>=midi; --i, --a) { |
| 247 | |
| 248 | s = RR[len2]; |
| 249 | RR[len2] = c = t = maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!((len1-end_cgap)-i,0)*h + (i<len1-end_cgap)*te; |
| 250 | |
| 251 | e = t + g; |
| 252 | for (b=s2+len2-1, j=len2-1; j>=0; --j, --b) { |
| 253 | |
| 254 | e = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(e, c+g) + h; |
| 255 | |
| 256 | SS[j] = (j==0 && i<start_cgap) ? |
| 257 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(SS[j], RR[j]) : (mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(SS[j]+(i==len1-end_cgap-1)*g, RR[j]+g) + h); |
| 258 | c = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(SS[j], mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(e, s+x*(*a!=*b))); |
| 259 | s = RR[j]; RR[j] = c; |
| 260 | |
| 261 | |
| 262 | } |
| 263 | } |
| 264 | SS[len2] = RR[len2]; |
| 265 | } |
| 266 | |
| 267 | /* find midj that minimizes the sum */ |
| 268 | /* special cases: columns 0 and len2 */ |
| 269 | midj = 0; |
| 270 | if (CC[0]+RR[0]<=DD[0]+SS[0]-g*(midi>start_cgap)) { |
| 271 | mincost = CC[0]+RR[0]; |
| 272 | mintype = 1; |
| 273 | } else { |
| 274 | mincost = DD[0]+SS[0]-g*(midi>start_cgap); |
| 275 | mintype = 2; |
| 276 | } |
| 277 | |
| 278 | for (j=1; j<len2; j++) { |
| 279 | tmp = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(CC[j]+RR[j],DD[j]+SS[j]-g); |
| 280 | if (mincost > tmp) { |
| 281 | mincost = tmp; |
| 282 | midj = j; |
| 283 | mintype = (tmp == CC[j]+RR[j]) ? 1:2; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | tmp = mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(CC[len2]+RR[len2],DD[len2]+SS[len2]-g*(midi<len1-end_cgap)); |
| 288 | if (mincost > tmp) { |
| 289 | mincost = tmp; |
| 290 | midj = len2; |
| 291 | mintype = (tmp==CC[len2]+RR[len2]) ? 1:2; |
| 292 | } |
| 293 | /* compute recursively in the two subregions */ |
| 294 | if (mintype==1) { |
| 295 | int cost1, cost2; |
| 296 | |
| 297 | cost1 = diffcxx . . $ diff(6164115f3a143670).(s1, |
| 298 | s2, |
| 299 | midi, |
| 300 | midj, |
| 301 | CC, |
| 302 | DD, |
| 303 | RR, |
| 304 | SS, |
| 305 | g, |
| 306 | h, |
| 307 | x, |
| 308 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(start_cgap,midi), |
| 309 | maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(end_cgap-len1+midi,0), |
| 310 | free_start, |
| 311 | 0, |
| 312 | tb, |
| 313 | g, |
| 314 | head, |
| 315 | &tmp_tail); |
| 316 | cost2 = diffcxx . . $ diff(6164115f3a143670).(s1+midi, |
| 317 | s2+midj, |
| 318 | len1-midi, |
| 319 | len2-midj, |
| 320 | CC, |
| 321 | DD, |
| 322 | RR, |
| 323 | SS, |
| 324 | g, |
| 325 | h, |
| 326 | x, |
| 327 | maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(0,start_cgap-midi), |
| 328 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(end_cgap,len1-midi), |
| 329 | 0, |
| 330 | free_end, |
| 331 | g, |
| 332 | te, |
| 333 | &tmp_head, |
| 334 | tail); |
| 335 | |
| 336 | if (*head) |
| 337 | tmp_tail->nextcxx . . $ EditScript#next. = tmp_head; |
| 338 | else |
| 339 | *head = tmp_head; |
| 340 | |
| 341 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! != *tail); |
| 342 | |
| 343 | } else { |
| 344 | EditScriptcxx . . $ EditScript# *aux; |
| 345 | int cost1, cost2; |
| 346 | |
| 347 | cost1 = diffcxx . . $ diff(6164115f3a143670).(s1, |
| 348 | s2, |
| 349 | midi-1, |
| 350 | midj, |
| 351 | CC, |
| 352 | DD, |
| 353 | RR, |
| 354 | SS, |
| 355 | g, |
| 356 | h, |
| 357 | x, |
| 358 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(start_cgap,midi-1), |
| 359 | maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(end_cgap-len1+midi-1,0), |
| 360 | free_start, |
| 361 | 0, |
| 362 | tb, |
| 363 | 0, |
| 364 | head, |
| 365 | &tmp_tail); |
| 366 | |
| 367 | aux = new EditScriptcxx . . $ EditScript#(DELcxx . . $ DEL.,2,NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 368 | |
| 369 | if (*head) |
| 370 | tmp_tail->nextcxx . . $ EditScript#next. = aux; |
| 371 | else |
| 372 | tmp_tail = *head = aux; |
| 373 | |
| 374 | cost2 = diffcxx . . $ diff(6164115f3a143670).(s1+midi+1, |
| 375 | s2+midj, |
| 376 | len1-midi-1, |
| 377 | len2-midj, |
| 378 | CC, |
| 379 | DD, |
| 380 | RR, |
| 381 | SS, |
| 382 | g, |
| 383 | h, |
| 384 | x, |
| 385 | maxcxx . . $ `atac-driver/chainer/halign/halign.C:35:9`!(0,start_cgap-midi-1), |
| 386 | mincxx . . $ `atac-driver/chainer/halign/halign.C:34:9`!(end_cgap,len1-midi-1), |
| 387 | 0, |
| 388 | free_end, |
| 389 | 0, |
| 390 | te, |
| 391 | &tmp_head, |
| 392 | tail); |
| 393 | aux->nextcxx . . $ EditScript#next. = tmp_head; |
| 394 | |
| 395 | if (*tail==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 396 | *tail = aux; |
| 397 | } |
| 398 | |
| 399 | return mincost; |
| 400 | } |
| 401 | |
| 402 | |
| 403 | |
| 404 | void |
| 405 | halignStartcxx . . $ halignStart(3feb6ef6c3934a09).(char *s1, |
| 406 | char *s2, |
| 407 | H_Alignment_tcxx . . $ H_Alignment_t# *alignment) { |
| 408 | |
| 409 | int const offset1 = 0; // Sequence coordinates are base-based, starting from 0 |
| 410 | int const offset2 = 0; // but start from 1 in Liliana's code. |
| 411 | |
| 412 | if ((s1[0] == 0) || (s2[0] == 0)) |
| 413 | return; |
| 414 | |
| 415 | int len1 = strlen(s1); |
| 416 | int len2 = strlen(s2); |
| 417 | |
| 418 | int start_cgap = 0; |
| 419 | int end_cgap = 0; |
| 420 | int free_start = 0; |
| 421 | int free_end = 0; |
| 422 | int score = 0; |
| 423 | |
| 424 | EditScriptcxx . . $ EditScript# *Script_head=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 425 | EditScriptcxx . . $ EditScript# *Script_tail=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 426 | |
| 427 | int *CC = (int *)malloccxx . . $ malloc(9f008b2a9698428b).(4 * (len2+1) * sizeof(int)); |
| 428 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! != CC); |
| 429 | |
| 430 | score = diffcxx . . $ diff(6164115f3a143670).(s1, |
| 431 | s2, |
| 432 | len1, |
| 433 | len2, |
| 434 | CC, |
| 435 | CC+1*(len2+1), |
| 436 | CC+2*(len2+1), |
| 437 | CC+3*(len2+1), |
| 438 | GAP_OPENcxx . . $ `atac-driver/chainer/halign/halign.C:40:9`!, |
| 439 | GAP_EXTENDcxx . . $ `atac-driver/chainer/halign/halign.C:41:9`!, |
| 440 | MISMATCHcxx . . $ `atac-driver/chainer/halign/halign.C:42:9`!, |
| 441 | start_cgap, |
| 442 | end_cgap, |
| 443 | free_start, |
| 444 | free_end, |
| 445 | GAP_OPENcxx . . $ `atac-driver/chainer/halign/halign.C:40:9`!, |
| 446 | GAP_OPENcxx . . $ `atac-driver/chainer/halign/halign.C:40:9`!, |
| 447 | &Script_head, |
| 448 | &Script_tail); |
| 449 | |
| 450 | freecxx . . $ free(bd21765a0afc8e3c).(CC); |
| 451 | |
| 452 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! != Script_head); |
| 453 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! != Script_tail); |
| 454 | |
| 455 | Script_tail->nextcxx . . $ EditScript#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 456 | |
| 457 | convertScriptToAlignmentcxx . . $ convertScriptToAlignment(9b2037964617156a).(Script_head, alignment); |
| 458 | |
| 459 | alignment->offset1cxx . . $ H_Alignment_t#offset1. = offset1+STARTcxx . . $ `atac-driver/chainer/halign/halign.C:39:9`!; // Convert from zero to one start sequence. |
| 460 | alignment->offset2cxx . . $ H_Alignment_t#offset2. = offset2+STARTcxx . . $ `atac-driver/chainer/halign/halign.C:39:9`!; // Convert from zero to one start sequence. |
| 461 | alignment->len1cxx . . $ H_Alignment_t#len1. = len1; |
| 462 | alignment->len2cxx . . $ H_Alignment_t#len2. = len2; |
| 463 | alignment->scorecxx . . $ H_Alignment_t#score. = score; |
| 464 | alignment->firstcxx . . $ H_Alignment_t#first. = 1; |
| 465 | } |
| 466 | |
| 467 | |
| 468 | int |
| 469 | iterateUngappedAlignSharpEndscxx . . $ iterateUngappedAlignSharpEnds(9b89594693b358a1).(H_Alignment_tcxx . . $ H_Alignment_t# *aln, |
| 470 | int &bgn1, |
| 471 | int &bgn2, |
| 472 | int &len1, |
| 473 | int &len2, |
| 474 | int &nmatInSeg) { |
| 475 | |
| 476 | // Returns zero when exhasted. |
| 477 | // Returns one when the args are valid. |
| 478 | |
| 479 | static int *lastS, *endS; |
| 480 | static int i, j; |
| 481 | |
| 482 | nmatInSeg = 0; |
| 483 | |
| 484 | if(aln == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return 0; // not valid output |
| 485 | |
| 486 | if(aln->firstcxx . . $ H_Alignment_t#first.){ |
| 487 | aln->firstcxx . . $ H_Alignment_t#first. = 0; |
| 488 | i = aln->offset1cxx . . $ H_Alignment_t#offset1.; |
| 489 | j = aln->offset2cxx . . $ H_Alignment_t#offset2.; |
| 490 | |
| 491 | lastS = aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray. + 1; |
| 492 | endS = aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray. + aln->scriptAsArraycxx . . $ H_Alignment_t#scriptAsArray.[0]; |
| 493 | } |
| 494 | |
| 495 | while (lastS <= endS) { |
| 496 | int b1, l1, b2, l2; |
| 497 | int nmat; |
| 498 | switch (*lastS) { |
| 499 | case SUBcxx . . $ SUB.: |
| 500 | ++lastS; |
| 501 | i += *(lastS); |
| 502 | j += *(lastS); |
| 503 | ++lastS; |
| 504 | break; |
| 505 | |
| 506 | case MOVcxx . . $ MOV.: |
| 507 | nmat = *(lastS+1); |
| 508 | nmatInSeg ++; |
| 509 | b1 = i; |
| 510 | b2 = j; |
| 511 | lastS++; |
| 512 | i += *lastS; |
| 513 | j += *lastS; |
| 514 | l1 = i-b1; |
| 515 | l2 = j-b2; |
| 516 | lastS++; |
| 517 | |
| 518 | while (lastS<=endS && (*lastS==SUBcxx . . $ SUB. || *lastS==MOVcxx . . $ MOV.)) { |
| 519 | nmat += (*lastS==MOVcxx . . $ MOV.) ? *(lastS+1) : 0; |
| 520 | nmatInSeg += (*lastS==MOVcxx . . $ MOV.) ? *(lastS+1) : 0; |
| 521 | lastS++; |
| 522 | i += *lastS; |
| 523 | j += *lastS; |
| 524 | if (*(lastS-1) == MOVcxx . . $ MOV.) { |
| 525 | l1 = i-b1; |
| 526 | l2 = j-b2; |
| 527 | } |
| 528 | lastS++; |
| 529 | } |
| 530 | |
| 531 | bgn1=b1-STARTcxx . . $ `atac-driver/chainer/halign/halign.C:39:9`!; |
| 532 | bgn2=b2-STARTcxx . . $ `atac-driver/chainer/halign/halign.C:39:9`!; |
| 533 | len1=l1; |
| 534 | len2=l2; |
| 535 | |
| 536 | return 1; // valid output |
| 537 | break; |
| 538 | |
| 539 | case INScxx . . $ INS.: |
| 540 | j += *(++lastS); |
| 541 | ++lastS; |
| 542 | break; |
| 543 | |
| 544 | case DELcxx . . $ DEL.: |
| 545 | i += *(++lastS); |
| 546 | ++lastS; |
| 547 | break; |
| 548 | |
| 549 | default : |
| 550 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unrecognized opcode in alignment.\n"); |
| 551 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 552 | break; |
| 553 | } |
| 554 | } |
| 555 | return 0; // not valid output |
| 556 | } |