| 1 | // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/chainer/localalign/GF_ALN_overlap.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 | #include <stdio.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <unistd.h> |
| 22 | #include <assert.h> |
| 23 | #include <string.h> |
| 24 | |
| 25 | #include "GF_ALN_local.H"cxx . . $ `<file>/atac-driver/chainer/localalign/GF_ALN_local.H`/ |
| 26 | |
| 27 | #define maxcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:27:10`!(x,y) ((x<y) ? (y):(x)) |
| 28 | #define mincxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:28:10`!(x,y) ((x>y) ? (y):(x)) |
| 29 | |
| 30 | |
| 31 | #define MIN_USABLEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:31:9`! 3 /* Smallest subpart of a segment usable for chaining */ |
| 32 | |
| 33 | |
| 34 | int MIN_ALIGNED_COLScxx . . $ MIN_ALIGNED_COLS.=30; /* minimum length of a local overlap in the following |
| 35 | sense: an overlap is defined by a set of segments; |
| 36 | each segment has a length (ignoring minor troubles |
| 37 | in determining length in the presence of small |
| 38 | indels); let the sum of the overlap for this |
| 39 | purpose be the sum of the lengths of the segments |
| 40 | that make up the overlap */ |
| 41 | |
| 42 | #define BIG_INTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:42:9`! 0x7FFFFFFF |
| 43 | |
| 44 | typedef structcxx . . $ $anonymous_type_a3911f3230601af4_0# { |
| 45 | int startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.; |
| 46 | int basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 47 | int segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment.; |
| 48 | int bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best.; |
| 49 | } Candidatecxx . . $ Candidate#; |
| 50 | |
| 51 | typedef structcxx . . $ $anonymous_type_a3911f3230601af4_1# { |
| 52 | Local_Segmentcxx . . $ Local_Segment# *itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.; |
| 53 | int isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.; |
| 54 | } Eventcxx . . $ Event#; |
| 55 | |
| 56 | typedef structcxx . . $ $anonymous_type_a3911f3230601af4_2# { |
| 57 | int valuecxx . . $ $anonymous_type_a3911f3230601af4_2#value.; |
| 58 | int sourcecxx . . $ $anonymous_type_a3911f3230601af4_2#source.; |
| 59 | int startcxx . . $ $anonymous_type_a3911f3230601af4_2#start.; |
| 60 | int colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned.; |
| 61 | } TraceElementcxx . . $ TraceElement#; |
| 62 | |
| 63 | /*** AVL-TREE LIST ROUTINES ***/ |
| 64 | |
| 65 | static void OutOfMemorycxx . . $ OutOfMemory(fda57c8427c60377).(char *where) |
| 66 | { fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"COMPARE_LOCAL: Out of memory (%s)\n",where); |
| 67 | exitcxx . . $ exit(44ed87f96534fad7). (1); |
| 68 | } |
| 69 | |
| 70 | typedef struct _AVLnodecxx . . $ _AVLnode# { |
| 71 | int RCcxx . . $ _AVLnode#RC., LNcxx . . $ _AVLnode#LN.; |
| 72 | short Hcxx . . $ _AVLnode#H.; |
| 73 | struct _AVLnodecxx . . $ _AVLnode# *Lcxx . . $ _AVLnode#L., *Rcxx . . $ _AVLnode#R.; |
| 74 | Candidatecxx . . $ Candidate# Vcxx . . $ _AVLnode#V.; |
| 75 | } AVLnodecxx . . $ AVLnode#; |
| 76 | |
| 77 | #define CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v) ((v)->L->LN) |
| 78 | |
| 79 | static AVLnodecxx . . $ AVLnode# *freeptcxx . . $ freept.; |
| 80 | static AVLnodecxx . . $ AVLnode# *NILcxx . . $ NIL.; |
| 81 | |
| 82 | #define INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`! AVLinc |
| 83 | #define DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`! AVLdec |
| 84 | #define SELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:84:9`! AVLselect |
| 85 | #define RNKcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:85:9`! AVLrank |
| 86 | #define ADDcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:86:9`! AVLinsert |
| 87 | #define DELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:87:9`! AVLdelete |
| 88 | |
| 89 | static void AVLinitcxx . . $ AVLinit(49f6e7a06ebc5aa8).(void) |
| 90 | { freeptcxx . . $ freept. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 91 | NILcxx . . $ NIL. = (AVLnodecxx . . $ AVLnode# *) malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(AVLnodecxx . . $ AVLnode#)); |
| 92 | if (NILcxx . . $ NIL. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 93 | OutOfMemorycxx . . $ OutOfMemory(fda57c8427c60377).("Candidate list"); |
| 94 | NILcxx . . $ NIL.->LNcxx . . $ _AVLnode#LN. = NILcxx . . $ NIL.->RCcxx . . $ _AVLnode#RC. = 1; |
| 95 | NILcxx . . $ NIL.->Hcxx . . $ _AVLnode#H. = 0; |
| 96 | NILcxx . . $ NIL.->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. = BIG_INTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:42:9`!; |
| 97 | NILcxx . . $ NIL.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. = BIG_INTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:42:9`!; |
| 98 | } |
| 99 | |
| 100 | static AVLnodecxx . . $ AVLnode# *AVLinccxx . . $ AVLinc(f47d429e849d0c51).(AVLnodecxx . . $ AVLnode# *v) |
| 101 | { v->RCcxx . . $ _AVLnode#RC.++; |
| 102 | return (v); |
| 103 | } |
| 104 | |
| 105 | static void AVLdeccxx . . $ AVLdec(6cedd1298a3db84d).(AVLnodecxx . . $ AVLnode# *v) |
| 106 | { v->RCcxx . . $ _AVLnode#RC.--; |
| 107 | if (v->RCcxx . . $ _AVLnode#RC. == 0) |
| 108 | { DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v->Lcxx . . $ _AVLnode#L.); |
| 109 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v->Rcxx . . $ _AVLnode#R.); |
| 110 | v->Lcxx . . $ _AVLnode#L. = freeptcxx . . $ freept.; |
| 111 | freeptcxx . . $ freept. = v; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | static int AVLlengthcxx . . $ AVLlength(b091e40f1219fc3f).(AVLnodecxx . . $ AVLnode# *v) |
| 116 | { DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v);return (v->LNcxx . . $ _AVLnode#LN. - 1); } |
| 117 | |
| 118 | static AVLnodecxx . . $ AVLnode# *NEWcxx . . $ NEW(984806a49d93f0df).(AVLnodecxx . . $ AVLnode# *l, Candidatecxx . . $ Candidate# *x, AVLnodecxx . . $ AVLnode# *r) |
| 119 | { AVLnodecxx . . $ AVLnode# *v; |
| 120 | int b; |
| 121 | |
| 122 | if (freeptcxx . . $ freept. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 123 | { v = (AVLnodecxx . . $ AVLnode# *) malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(AVLnodecxx . . $ AVLnode#)); |
| 124 | if (v == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 125 | OutOfMemorycxx . . $ OutOfMemory(fda57c8427c60377).("Candidate list"); |
| 126 | } |
| 127 | else |
| 128 | { v = freeptcxx . . $ freept.; |
| 129 | freeptcxx . . $ freept. = v->Lcxx . . $ _AVLnode#L.; |
| 130 | } |
| 131 | |
| 132 | v->RCcxx . . $ _AVLnode#RC. = 1; |
| 133 | v->Vcxx . . $ _AVLnode#V. =cxx . . $ $anonymous_type_a3911f3230601af4_0#`operator=`(f31b957e46b265bc). *x; |
| 134 | v->Lcxx . . $ _AVLnode#L. = l; |
| 135 | v->Rcxx . . $ _AVLnode#R. = r; |
| 136 | v->LNcxx . . $ _AVLnode#LN. = l->LNcxx . . $ _AVLnode#LN. + r->LNcxx . . $ _AVLnode#LN.; |
| 137 | v->Hcxx . . $ _AVLnode#H. = (l->Hcxx . . $ _AVLnode#H. < r->Hcxx . . $ _AVLnode#H. ? r->Hcxx . . $ _AVLnode#H. : l->Hcxx . . $ _AVLnode#H.) + 1; |
| 138 | |
| 139 | b = v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 140 | if (v->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < b) |
| 141 | b = v->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best.; |
| 142 | if (v->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < b) |
| 143 | b = v->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best.; |
| 144 | v->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. = b; |
| 145 | |
| 146 | return (v); |
| 147 | } |
| 148 | |
| 149 | static AVLnodecxx . . $ AVLnode# *BALcxx . . $ BAL(984806a49d93f0df).(AVLnodecxx . . $ AVLnode# *l, Candidatecxx . . $ Candidate# *x, AVLnodecxx . . $ AVLnode# *r) |
| 150 | { AVLnodecxx . . $ AVLnode# *t; |
| 151 | if (l->Hcxx . . $ _AVLnode#H. - r->Hcxx . . $ _AVLnode#H. >= -1 && l->Hcxx . . $ _AVLnode#H. - r->Hcxx . . $ _AVLnode#H. <= 1) |
| 152 | t = NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r)); |
| 153 | else if (l->Hcxx . . $ _AVLnode#H. > r->Hcxx . . $ _AVLnode#H.) |
| 154 | if (l->Lcxx . . $ _AVLnode#L.->Hcxx . . $ _AVLnode#H. >= l->Rcxx . . $ _AVLnode#R.->Hcxx . . $ _AVLnode#H.) |
| 155 | t = NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l->Lcxx . . $ _AVLnode#L.),&(l->Vcxx . . $ _AVLnode#V.),NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l->Rcxx . . $ _AVLnode#R.),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r))); |
| 156 | else |
| 157 | t = NEWcxx . . $ NEW(984806a49d93f0df).(NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l->Lcxx . . $ _AVLnode#L.),&(l->Vcxx . . $ _AVLnode#V.),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l->Rcxx . . $ _AVLnode#R.->Lcxx . . $ _AVLnode#L.)),&(l->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V.), |
| 158 | NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l->Rcxx . . $ _AVLnode#R.->Rcxx . . $ _AVLnode#R.),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r))); |
| 159 | else |
| 160 | if (r->Rcxx . . $ _AVLnode#R.->Hcxx . . $ _AVLnode#H. >= r->Lcxx . . $ _AVLnode#L.->Hcxx . . $ _AVLnode#H.) |
| 161 | t = NEWcxx . . $ NEW(984806a49d93f0df).(NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r->Lcxx . . $ _AVLnode#L.)),&(r->Vcxx . . $ _AVLnode#V.),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r->Rcxx . . $ _AVLnode#R.)); |
| 162 | else |
| 163 | t = NEWcxx . . $ NEW(984806a49d93f0df).(NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(l),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r->Lcxx . . $ _AVLnode#L.->Lcxx . . $ _AVLnode#L.)),&(r->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V.), |
| 164 | NEWcxx . . $ NEW(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r->Lcxx . . $ _AVLnode#L.->Rcxx . . $ _AVLnode#R.),&(r->Vcxx . . $ _AVLnode#V.),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(r->Rcxx . . $ _AVLnode#R.))); |
| 165 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(l); DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(r); |
| 166 | return (t); |
| 167 | } |
| 168 | |
| 169 | static Candidatecxx . . $ Candidate# *AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLnodecxx . . $ AVLnode# *v, int k) |
| 170 | { Candidatecxx . . $ Candidate# *x; |
| 171 | if (k < CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)) |
| 172 | x = SELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:84:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),k); |
| 173 | else if (k > CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)) |
| 174 | x = SELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:84:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),k-CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)); |
| 175 | else |
| 176 | x = &(v->Vcxx . . $ _AVLnode#V.); |
| 177 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 178 | return (x); |
| 179 | } |
| 180 | |
| 181 | static int AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLnodecxx . . $ AVLnode# *v, int pos) |
| 182 | { int k; |
| 183 | if (v == NILcxx . . $ NIL.) |
| 184 | k = 0; |
| 185 | else if (pos < v->Vcxx . . $ _AVLnode#V..startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.) |
| 186 | k = RNKcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:85:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),pos); |
| 187 | else |
| 188 | k = CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v) + RNKcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:85:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),pos); |
| 189 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 190 | return (k); |
| 191 | } |
| 192 | |
| 193 | static AVLnodecxx . . $ AVLnode# *AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(AVLnodecxx . . $ AVLnode# *v, int hgh, int bst) |
| 194 | { AVLnodecxx . . $ AVLnode# *r; |
| 195 | int b = 0; |
| 196 | |
| 197 | if (v == NILcxx . . $ NIL.) |
| 198 | r = v; |
| 199 | else if (hgh < v->Vcxx . . $ _AVLnode#V..startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.) |
| 200 | r = AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),hgh,bst); |
| 201 | else |
| 202 | { if (v->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < bst) |
| 203 | b = v->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best.; |
| 204 | if (v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 205 | b = v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 206 | r = AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),hgh,b); |
| 207 | if (r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 208 | bst = r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 209 | if (v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 210 | { r = v; bst = v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; } |
| 211 | if (v->Lcxx . . $ _AVLnode#L.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < bst) |
| 212 | r = AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),hgh,bst); |
| 213 | } |
| 214 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 215 | return (r); |
| 216 | } |
| 217 | |
| 218 | static AVLnodecxx . . $ AVLnode# *AVLminsufcxx . . $ AVLminsuf(c8ac7c638fcf91ff).(AVLnodecxx . . $ AVLnode# *v, int low, int bst) |
| 219 | { AVLnodecxx . . $ AVLnode# *r; |
| 220 | int b = 0; |
| 221 | |
| 222 | if (v == NILcxx . . $ NIL.) |
| 223 | r = v; |
| 224 | else if (low > v->Vcxx . . $ _AVLnode#V..startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.) |
| 225 | r = AVLminsufcxx . . $ AVLminsuf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),low,bst); |
| 226 | else |
| 227 | { if (v->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < bst) |
| 228 | b = v->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best.; |
| 229 | if (v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 230 | b = v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 231 | r = AVLminsufcxx . . $ AVLminsuf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),low,b); |
| 232 | if (r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 233 | bst = r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; |
| 234 | if (v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < bst) |
| 235 | { r = v; bst = v->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.; } |
| 236 | if (v->Rcxx . . $ _AVLnode#R.->Vcxx . . $ _AVLnode#V..bestcxx . . $ $anonymous_type_a3911f3230601af4_0#best. < bst) |
| 237 | r = AVLminsufcxx . . $ AVLminsuf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),low,bst); |
| 238 | } |
| 239 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 240 | return (r); |
| 241 | } |
| 242 | |
| 243 | static AVLnodecxx . . $ AVLnode# *AVLminrngcxx . . $ AVLminrng(c8ac7c638fcf91ff).(AVLnodecxx . . $ AVLnode# *v, int low, int hgh) |
| 244 | { AVLnodecxx . . $ AVLnode# *r, *t; |
| 245 | |
| 246 | if (v == NILcxx . . $ NIL.) |
| 247 | r = v; |
| 248 | else if (hgh < v->Vcxx . . $ _AVLnode#V..startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.) |
| 249 | r = AVLminrngcxx . . $ AVLminrng(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),low,hgh); |
| 250 | else if (low > v->Vcxx . . $ _AVLnode#V..startcxx . . $ $anonymous_type_a3911f3230601af4_0#start.) |
| 251 | r = AVLminrngcxx . . $ AVLminrng(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),low,hgh); |
| 252 | else |
| 253 | { r = v; |
| 254 | t = AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),hgh,r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.); |
| 255 | if (t->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.) |
| 256 | r = t; |
| 257 | t = AVLminsufcxx . . $ AVLminsuf(c8ac7c638fcf91ff).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),low,r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.); |
| 258 | if (t->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. < r->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base.) |
| 259 | r = t; |
| 260 | } |
| 261 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 262 | return (r); |
| 263 | } |
| 264 | |
| 265 | static AVLnodecxx . . $ AVLnode# *AVLinsertcxx . . $ AVLinsert(e848e2774d9ff43).(AVLnodecxx . . $ AVLnode# *v, int k, Candidatecxx . . $ Candidate# *x) |
| 266 | { AVLnodecxx . . $ AVLnode# *t; |
| 267 | if (v == NILcxx . . $ NIL.) |
| 268 | t = BALcxx . . $ BAL(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(NILcxx . . $ NIL.),x,INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(NILcxx . . $ NIL.)); |
| 269 | else if (k < CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)) |
| 270 | t = BALcxx . . $ BAL(984806a49d93f0df).(ADDcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:86:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),k,x),&(v->Vcxx . . $ _AVLnode#V.),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.)); |
| 271 | else |
| 272 | t = BALcxx . . $ BAL(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),&(v->Vcxx . . $ _AVLnode#V.),ADDcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:86:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),k-CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v),x)); |
| 273 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 274 | return (t); |
| 275 | } |
| 276 | |
| 277 | static AVLnodecxx . . $ AVLnode# *AVLdeletecxx . . $ AVLdelete(3c834390e74ec40f).(AVLnodecxx . . $ AVLnode# *v, int k) |
| 278 | { AVLnodecxx . . $ AVLnode# *t; |
| 279 | if (v->Lcxx . . $ _AVLnode#L. == NILcxx . . $ NIL. && v->Rcxx . . $ _AVLnode#R. == NILcxx . . $ NIL.) |
| 280 | t = INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(NILcxx . . $ NIL.); |
| 281 | else if (k <= CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v) && v->Lcxx . . $ _AVLnode#L. != NILcxx . . $ NIL.) |
| 282 | if (k == CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)) |
| 283 | t = BALcxx . . $ BAL(984806a49d93f0df).(DELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:87:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),k-1),SELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:84:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),k-1),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.)); |
| 284 | else |
| 285 | t = BALcxx . . $ BAL(984806a49d93f0df).(DELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:87:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),k),&(v->Vcxx . . $ _AVLnode#V.),INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.)); |
| 286 | else |
| 287 | if (k == CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v)) |
| 288 | t = BALcxx . . $ BAL(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),SELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:84:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),1),DELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:87:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),1)); |
| 289 | else |
| 290 | t = BALcxx . . $ BAL(984806a49d93f0df).(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Lcxx . . $ _AVLnode#L.),&(v->Vcxx . . $ _AVLnode#V.),DELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:87:9`!(INCcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:82:9`!(v->Rcxx . . $ _AVLnode#R.),k-CPcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:77:9`!(v))); |
| 291 | DECcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:83:9`!(v); |
| 292 | return (t); |
| 293 | } |
| 294 | |
| 295 | |
| 296 | |
| 297 | static int SSORTcxx . . $ SSORT(9148c8c3ff42c9d8).(const void *l, const void *r) |
| 298 | { Eventcxx . . $ Event# *x, *y; |
| 299 | int ax, ay, bx, by; |
| 300 | |
| 301 | x = (Eventcxx . . $ Event# *) l; |
| 302 | y = (Eventcxx . . $ Event# *) r; |
| 303 | if (x->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.) |
| 304 | { ax = x->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.; |
| 305 | bx = x->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 306 | } |
| 307 | else |
| 308 | { ax = x->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 309 | bx = x->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 310 | } |
| 311 | if (y->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.) |
| 312 | { ay = y->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.; |
| 313 | by = y->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 314 | } |
| 315 | else |
| 316 | { ay = y->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 317 | by = y->itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item.->beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 318 | } |
| 319 | if (ax < ay) |
| 320 | return (-1); |
| 321 | else if (ax > ay) |
| 322 | return (1); |
| 323 | else if (x->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd. != y->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.) |
| 324 | return (x->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd. - y->isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.); |
| 325 | else |
| 326 | return (bx - by); |
| 327 | } |
| 328 | |
| 329 | |
| 330 | static void convert_segscxx . . $ convert_segs(53b5c1b73069559b).(Local_Segmentcxx . . $ Local_Segment# *Segs,int NumSegs,int comp, int Alen,int Blen) |
| 331 | { int i; /* Mark and reverse all complemented local segs */ |
| 332 | |
| 333 | if (comp) |
| 334 | for (i = 0; i < NumSegs; i++) |
| 335 | { Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = Blen - Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 336 | Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = Blen - Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 337 | } |
| 338 | |
| 339 | for (i = 0; i < NumSegs; i++) |
| 340 | if (Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. > Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.) |
| 341 | { int x; |
| 342 | x = Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 343 | Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 344 | Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = x; |
| 345 | Segs[i].scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. = -Segs[i].scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score.-1; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | static void restore_segscxx . . $ restore_segs(53b5c1b73069559b).(Local_Segmentcxx . . $ Local_Segment# *Segs,int NumSegs,int comp,int Alen,int Blen) |
| 350 | { int i; /* Unmark and reverse all complemented local segs */ |
| 351 | |
| 352 | for (i = 0; i < NumSegs; i++) |
| 353 | if (Segs[i].scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. < 0) |
| 354 | { int x; |
| 355 | x = Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 356 | Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 357 | Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = x; |
| 358 | Segs[i].scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. = -Segs[i].scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score.-1; |
| 359 | } |
| 360 | |
| 361 | if (comp) |
| 362 | { for (i = 0; i < NumSegs; i++) |
| 363 | { Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = Blen - Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 364 | Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = Blen - Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | |
| 370 | Local_Overlapcxx . . $ Local_Overlap# *Find_Local_Overlapcxx . . $ Find_Local_Overlap(fddbc6197bc940a1).(int Alen, int Blen, int comp, int nextbest, |
| 371 | Local_Segmentcxx . . $ Local_Segment# *Segs, int NumSegs, |
| 372 | int MinorThresh, double GapThresh) |
| 373 | { static Candidatecxx . . $ Candidate# Cvals; |
| 374 | static int MaxTrace = -1; |
| 375 | static TraceElementcxx . . $ TraceElement# *Trace = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 376 | static Eventcxx . . $ Event# *EventList; |
| 377 | Local_Overlapcxx . . $ Local_Overlap# *Descriptor; |
| 378 | Local_Chaincxx . . $ Local_Chain# *Chain; |
| 379 | |
| 380 | if (NumSegs == 0) return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 381 | |
| 382 | if (nextbest) |
| 383 | { if (Trace == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 384 | convert_segscxx . . $ convert_segs(53b5c1b73069559b).(Segs,NumSegs,comp,Alen,Blen); |
| 385 | goto Gen_Overlap; |
| 386 | } |
| 387 | |
| 388 | if (MaxTrace < 0) |
| 389 | AVLinitcxx . . $ AVLinit(49f6e7a06ebc5aa8).(); |
| 390 | |
| 391 | if (NumSegs > MaxTrace) |
| 392 | { MaxTrace = (int)(1.3*NumSegs) + 500; |
| 393 | Trace = (TraceElementcxx . . $ TraceElement# *) |
| 394 | realloccxx . . $ realloc(42b2a9dd8f084bf2).(Trace,(sizeof(Eventcxx . . $ Event#)+2*sizeof(TraceElementcxx . . $ TraceElement#))*MaxTrace); |
| 395 | if (Trace == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 396 | OutOfMemorycxx . . $ OutOfMemory(fda57c8427c60377).("Overlap Trace Array"); |
| 397 | EventList = (Eventcxx . . $ Event# *) (Trace + MaxTrace); |
| 398 | { // We have to make sure that EventList is aligned on an appropriate boundary. |
| 399 | // It is derived from Trace which has looser alignment constraints. |
| 400 | long address = (long)EventList; |
| 401 | // By convention "long" int is big as the size of a pointer |
| 402 | long offset = (address % sizeof(void *)); |
| 403 | int pad = sizeof(void *) - offset; |
| 404 | // This is how much we need to add to get things aligned. |
| 405 | if(offset){ |
| 406 | // fprintf(stderr,"* Eventlist is %p adding %d up to ", EventList, pad); |
| 407 | EventList = (Eventcxx . . $ Event# *)(((char *)EventList) + pad); |
| 408 | // fprintf(stderr," %p\n", EventList); |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | convert_segscxx . . $ convert_segs(53b5c1b73069559b).(Segs,NumSegs,comp,Alen,Blen); |
| 414 | |
| 415 | { int i; |
| 416 | for (i = 0; i < NumSegs; i++) |
| 417 | { EventList[2*i].itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item. = Segs+i; |
| 418 | EventList[2*i].isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd. = 1; |
| 419 | EventList[2*i+1].itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item. = Segs+i; |
| 420 | EventList[2*i+1].isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd. = 0; |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | qsortcxx . . $ qsort(ebb60b13a65e77d7).(EventList,2*NumSegs,sizeof(Eventcxx . . $ Event#),SSORTcxx . . $ SSORT(9148c8c3ff42c9d8).); |
| 425 | |
| 426 | { int e; |
| 427 | AVLnodecxx . . $ AVLnode# *elist, *ilist, *olist; |
| 428 | |
| 429 | elist = AVLinccxx . . $ AVLinc(f47d429e849d0c51).(NILcxx . . $ NIL.); |
| 430 | ilist = AVLinccxx . . $ AVLinc(f47d429e849d0c51).(NILcxx . . $ NIL.); |
| 431 | olist = AVLinccxx . . $ AVLinc(f47d429e849d0c51).(NILcxx . . $ NIL.); |
| 432 | |
| 433 | for (e = 0; e < 2*NumSegs; e++) |
| 434 | { int i, bb, be, ab, ae; |
| 435 | double err; |
| 436 | |
| 437 | /* Determine least gapped path to i'th segment */ |
| 438 | |
| 439 | i = EventList[e].itemcxx . . $ $anonymous_type_a3911f3230601af4_1#item. - Segs; |
| 440 | bb = Segs[i].bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 441 | be = Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 442 | ab = Segs[i].abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.; |
| 443 | ae = Segs[i].aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 444 | err = Segs[i].errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error.; |
| 445 | |
| 446 | if (EventList[e].isaddcxx . . $ $anonymous_type_a3911f3230601af4_1#isadd.) /* Segment begins */ |
| 447 | { int clen, best, srce; |
| 448 | |
| 449 | // this definition of best differs from the original (below) |
| 450 | // it is designed to encourage global alignment |
| 451 | // |
| 452 | best = ab+bb; /* Best from boundary */ |
| 453 | |
| 454 | //best = ab; /* Best from boundary */ |
| 455 | //if (best > bb) |
| 456 | // best = bb; |
| 457 | //best *= 2; |
| 458 | |
| 459 | |
| 460 | srce = -1; |
| 461 | clen = AVLlengthcxx . . $ AVLlength(b091e40f1219fc3f).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist)); |
| 462 | |
| 463 | { int p; /* Examine bests from elist */ |
| 464 | |
| 465 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),bb); /* Best @ start of seg */ |
| 466 | if (p > 0) |
| 467 | { Candidatecxx . . $ Candidate# *cand; |
| 468 | int altr; |
| 469 | |
| 470 | cand = AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),p); |
| 471 | altr = cand->basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. + (ab + bb); |
| 472 | if (altr < best) |
| 473 | { best = altr; |
| 474 | srce = cand->segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment.; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | while (++p <= clen) /* Bests @ midpoints of seg */ |
| 479 | { Candidatecxx . . $ Candidate# *cand; |
| 480 | int altr; |
| 481 | |
| 482 | cand = AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),p); |
| 483 | if (cand->startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. > be - MIN_USABLEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:31:9`!) break; |
| 484 | altr = cand->basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. + 2*cand->startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. + (ab - bb); |
| 485 | if (altr < best) |
| 486 | { best = altr; |
| 487 | srce = cand->segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment.; |
| 488 | } |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | /* Examine bests from ilist and olist */ |
| 493 | |
| 494 | { AVLnodecxx . . $ AVLnode# *m; |
| 495 | int bdiag, ldiag, altr; |
| 496 | |
| 497 | bdiag = bb - ab; |
| 498 | ldiag = bdiag + ((ae-ab) - MIN_USABLEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:31:9`!); |
| 499 | m = AVLminprfcxx . . $ AVLminprf(c8ac7c638fcf91ff).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(ilist),bdiag,BIG_INTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:42:9`!); |
| 500 | if (m != NILcxx . . $ NIL.) |
| 501 | { altr = m->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. + bdiag; |
| 502 | if (altr < best) |
| 503 | { srce = m->Vcxx . . $ _AVLnode#V..segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment.; |
| 504 | best = altr; |
| 505 | } |
| 506 | } |
| 507 | m = AVLminrngcxx . . $ AVLminrng(c8ac7c638fcf91ff).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(olist),-ldiag,-bdiag); |
| 508 | if (m != NILcxx . . $ NIL.) |
| 509 | { altr = m->Vcxx . . $ _AVLnode#V..basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. - bdiag; |
| 510 | if (altr < best) |
| 511 | { srce = m->Vcxx . . $ _AVLnode#V..segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment.; |
| 512 | best = altr; |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | /* Record best linkage for segment */ |
| 518 | |
| 519 | Trace[i].valuecxx . . $ $anonymous_type_a3911f3230601af4_2#value. = best; |
| 520 | Trace[i].sourcecxx . . $ $anonymous_type_a3911f3230601af4_2#source. = srce; |
| 521 | |
| 522 | Trace[i].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned. = (int)((1.-err)*(double)(mincxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:28:10`!(ae-ab,be-bb)+1)); |
| 523 | if (srce >= 0){ |
| 524 | Trace[i].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start. = Trace[srce].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start.; |
| 525 | Trace[i].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned. += Trace[srce].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned.; |
| 526 | } else |
| 527 | Trace[i].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start. = i; |
| 528 | |
| 529 | /* Add segment to ilist and olist */ |
| 530 | |
| 531 | { int p, d; |
| 532 | |
| 533 | d = be - ae; |
| 534 | Cvals.segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment. = i; |
| 535 | |
| 536 | Cvals.startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. = d; |
| 537 | Cvals.basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. = best - d; |
| 538 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(ilist),d); |
| 539 | ilist = AVLinsertcxx . . $ AVLinsert(e848e2774d9ff43).(ilist,p,&Cvals); |
| 540 | |
| 541 | d = -d; |
| 542 | Cvals.startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. = d; |
| 543 | Cvals.basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. = best - d; |
| 544 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(olist),d); |
| 545 | olist = AVLinsertcxx . . $ AVLinsert(e848e2774d9ff43).(olist,p,&Cvals); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | else /* Segment ends */ |
| 550 | { int best, clen; |
| 551 | |
| 552 | best = Trace[i].valuecxx . . $ $anonymous_type_a3911f3230601af4_2#value.; |
| 553 | clen = AVLlengthcxx . . $ AVLlength(b091e40f1219fc3f).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist)); |
| 554 | |
| 555 | /* Add candidate (if any) created by i'th segment */ |
| 556 | |
| 557 | { Candidatecxx . . $ Candidate# *cand; |
| 558 | int p, off; |
| 559 | |
| 560 | off = be + Segs[i].aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 561 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),be); |
| 562 | if (p != 0) |
| 563 | cand = AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),p); |
| 564 | if (p == 0 || best < cand->basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. + off) |
| 565 | { p += 1; |
| 566 | while (p <= clen) |
| 567 | { cand = AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),p); |
| 568 | if (cand->basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. + off < best) break; |
| 569 | elist = AVLdeletecxx . . $ AVLdelete(3c834390e74ec40f).(elist,p); |
| 570 | clen -= 1; |
| 571 | } |
| 572 | p -= 1; |
| 573 | if (p > 0) |
| 574 | { cand = AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(elist),p); |
| 575 | if (cand->startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. == be) |
| 576 | elist = AVLdeletecxx . . $ AVLdelete(3c834390e74ec40f).(elist,p--); |
| 577 | } |
| 578 | Cvals.startcxx . . $ $anonymous_type_a3911f3230601af4_0#start. = be; |
| 579 | Cvals.basecxx . . $ $anonymous_type_a3911f3230601af4_0#base. = best - off; |
| 580 | Cvals.segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment. = i; |
| 581 | elist = AVLinsertcxx . . $ AVLinsert(e848e2774d9ff43).(elist,p,&Cvals); |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | /* Remove candidates from ilist and olist */ |
| 586 | |
| 587 | { int p, d; |
| 588 | |
| 589 | d = be-ae; |
| 590 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(ilist),d); |
| 591 | while (AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(ilist),p)->segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment. != i) |
| 592 | p -= 1; |
| 593 | ilist = AVLdeletecxx . . $ AVLdelete(3c834390e74ec40f).(ilist,p); |
| 594 | |
| 595 | p = AVLrankcxx . . $ AVLrank(9bfc3c404c2a700d).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(olist),-d); |
| 596 | while (AVLselectcxx . . $ AVLselect(715fa83676e26a85).(AVLinccxx . . $ AVLinc(f47d429e849d0c51).(olist),p)->segmentcxx . . $ $anonymous_type_a3911f3230601af4_0#segment. != i) |
| 597 | p -= 1; |
| 598 | olist = AVLdeletecxx . . $ AVLdelete(3c834390e74ec40f).(olist,p); |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | } |
| 603 | |
| 604 | AVLdeccxx . . $ AVLdec(6cedd1298a3db84d).(elist); |
| 605 | AVLdeccxx . . $ AVLdec(6cedd1298a3db84d).(ilist); |
| 606 | AVLdeccxx . . $ AVLdec(6cedd1298a3db84d).(olist); |
| 607 | } |
| 608 | |
| 609 | |
| 610 | |
| 611 | Gen_Overlap: |
| 612 | |
| 613 | { int i, npiece; |
| 614 | int best, end, beg; |
| 615 | |
| 616 | best = BIG_INTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:42:9`!; /* Determine best overall overlap */ |
| 617 | end = -1; |
| 618 | for (i = 0; i < NumSegs; i++){ |
| 619 | // if (Trace[i].start >= 0) |
| 620 | if (Trace[i].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start. >= 0&&Trace[i].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned. >= MIN_ALIGNED_COLScxx . . $ MIN_ALIGNED_COLS.) { |
| 621 | int sfx; |
| 622 | |
| 623 | // this definition of sfx differs from the original (below) |
| 624 | // it is designed to encourage global alignment |
| 625 | // |
| 626 | sfx = Alen - Segs[i].aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos. + Blen - Segs[i].beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 627 | |
| 628 | //sfx = Alen - Segs[i].aepos; |
| 629 | //if (Blen - Segs[i].bepos < sfx) |
| 630 | // sfx = Blen - Segs[i].bepos; |
| 631 | //sfx *= 2; |
| 632 | |
| 633 | // The "- 2 * Trace[i].colsAligned" makes us encourage longer alignments |
| 634 | // |
| 635 | if (Trace[i].valuecxx . . $ $anonymous_type_a3911f3230601af4_2#value. + sfx - 2*Trace[i].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned. < best) { |
| 636 | best = Trace[i].valuecxx . . $ $anonymous_type_a3911f3230601af4_2#value. - 2*Trace[i].colsAlignedcxx . . $ $anonymous_type_a3911f3230601af4_2#colsAligned. + sfx; |
| 637 | end = i; |
| 638 | } |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | if (end < 0) { |
| 643 | restore_segscxx . . $ restore_segs(53b5c1b73069559b).(Segs,NumSegs,comp,Alen,Blen); |
| 644 | return (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 645 | } |
| 646 | |
| 647 | beg = Trace[end].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start.; |
| 648 | |
| 649 | /* How many segments in the best overlap? */ |
| 650 | |
| 651 | npiece = 0; |
| 652 | for (i = end; i >= 0; i = Trace[i].sourcecxx . . $ $anonymous_type_a3911f3230601af4_2#source.) |
| 653 | npiece += 1; |
| 654 | |
| 655 | |
| 656 | |
| 657 | /* Allocate result data structures in a single memory block */ |
| 658 | |
| 659 | Descriptor = (Local_Overlapcxx . . $ Local_Overlap# *) malloccxx . . $ malloc(9f008b2a9698428b).(sizeof(Local_Overlapcxx . . $ Local_Overlap#) + |
| 660 | (npiece+1)*sizeof(Local_Chaincxx . . $ Local_Chain#)); |
| 661 | if (Descriptor == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 662 | OutOfMemorycxx . . $ OutOfMemory(fda57c8427c60377).("Overlap descriptor"); |
| 663 | Chain = (Local_Chaincxx . . $ Local_Chain# *) (Descriptor + 1); |
| 664 | |
| 665 | /* Fill out the description of the chain */ |
| 666 | |
| 667 | { int n; |
| 668 | n = npiece; |
| 669 | for (i = end; i >= 0; i = Trace[i].sourcecxx . . $ $anonymous_type_a3911f3230601af4_2#source.) |
| 670 | Chain[--n].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece. =cxx . . $ $anonymous_type_48ac8bda34bc2e3_0#`operator=`(293f35f642e88d81). Segs[i]; |
| 671 | } |
| 672 | |
| 673 | |
| 674 | #define ALLOW_DUP_SEGS_IN_NEXTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:674:9`! /* allow all but the first segment to be |
| 675 | used in later attempts */ |
| 676 | #ifndef ALLOW_DUP_SEGS_IN_NEXTcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:674:9`! |
| 677 | for (i = 0; i < NumSegs; i++) |
| 678 | if (Trace[i].start == beg) |
| 679 | Trace[i].start = -1; /* this seems to prevent reuse of segments |
| 680 | in subsequent calls, and/or if we reject |
| 681 | this segment as too noisy and jump back |
| 682 | to the top */ |
| 683 | #else |
| 684 | Trace[end].startcxx . . $ $anonymous_type_a3911f3230601af4_2#start. = -1; /* this seems to prevent reuse of segments |
| 685 | in subsequent calls, and/or if we reject |
| 686 | this segment as too noisy and jump back |
| 687 | to the top */ |
| 688 | #define REUSE_CURRENT_LAST_AS_NONTERMINAL_SEGcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:688:11`! |
| 689 | #ifndef REUSE_CURRENT_LAST_AS_NONTERMINAL_SEGcxx . . $ `atac-driver/chainer/localalign/GF_ALN_overlap.C:688:11`! |
| 690 | for (i = 0; i < NumSegs; i++) |
| 691 | if (Trace[i].source == beg) |
| 692 | Trace[i].source = -1; |
| 693 | #endif |
| 694 | |
| 695 | #endif |
| 696 | |
| 697 | |
| 698 | {// The last segment doesn't describe an alignment, only a gap. Initialize it to reasonable values |
| 699 | Local_Segmentcxx . . $ Local_Segment# *lastseg = &Chain[npiece].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece.; |
| 700 | lastseg->abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos. = lastseg->bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = -1; |
| 701 | lastseg->aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos. = lastseg->beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = -1; |
| 702 | lastseg->ldiagcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#ldiag. = lastseg->hdiagcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#hdiag. = -1; |
| 703 | lastseg->scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. = -1; |
| 704 | lastseg->errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error. = -1.0; |
| 705 | } |
| 706 | |
| 707 | { int gl; |
| 708 | /* there's basically a bug here: abpos = 1 means starts at first char of A; |
| 709 | so, agap should be 0, but gets set to 1; i.e., every first gap size |
| 710 | gets set to one too many; but there's existing code that relies on |
| 711 | this fact, so leave it alone for now */ |
| 712 | gl = Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.; |
| 713 | if (gl > Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.) |
| 714 | gl = Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 715 | Chain[0].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. = gl; |
| 716 | Chain[0].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. = gl; |
| 717 | } |
| 718 | |
| 719 | for (i = 1; i < npiece; i++) |
| 720 | { Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. = Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos. - Chain[i-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 721 | Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. = Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. - Chain[i-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 722 | } |
| 723 | |
| 724 | { int gl; |
| 725 | gl = Alen - Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.; |
| 726 | if (gl > Blen - Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.) |
| 727 | gl = Blen - Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 728 | Chain[npiece].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. = gl; |
| 729 | Chain[npiece].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. = gl; |
| 730 | } |
| 731 | |
| 732 | for (i = 0; i <= npiece; i++) |
| 733 | { if (abscxx . . $ abs(a1851578aea3f541).(Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.) <= MinorThresh) |
| 734 | { if (abscxx . . $ abs(a1851578aea3f541).(Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) <= MinorThresh) |
| 735 | { if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. != 0 || Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. != 0) |
| 736 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_MINORcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:180:9`!; |
| 737 | else |
| 738 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_BOUNDARYcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:179:9`!; |
| 739 | } |
| 740 | else if (Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < 0) |
| 741 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_REPEATcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:183:9`!; |
| 742 | else if (Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. > 4*Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.) |
| 743 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_INDELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:182:9`!; |
| 744 | else |
| 745 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_DISAGREEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:181:9`!; |
| 746 | } |
| 747 | else if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < 0) |
| 748 | { if (Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < MinorThresh) |
| 749 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_REPEATcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:183:9`!; |
| 750 | else |
| 751 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_REPnDELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:184:9`!; |
| 752 | } |
| 753 | else |
| 754 | { if (abscxx . . $ abs(a1851578aea3f541).(Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) < MinorThresh) |
| 755 | if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. > 4*Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) |
| 756 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_INDELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:182:9`!; |
| 757 | else |
| 758 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_DISAGREEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:181:9`!; |
| 759 | else if (Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < 0) |
| 760 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_REPnDELcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:184:9`!; |
| 761 | else |
| 762 | Chain[i].typecxx . . $ $anonymous_type_48ac8bda34bc2e3_1#type. = LOCAL_DISAGREEcxx . . $ `atac-driver/chainer/localalign/GF_ALN_local.H:181:9`!; |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | /* Fill out overlap descriptor */ |
| 767 | |
| 768 | Descriptor->num_piecescxx . . $ $anonymous_type_48ac8bda34bc2e3_2#num_pieces. = npiece; |
| 769 | Descriptor->scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_2#score. = best; |
| 770 | Descriptor->chaincxx . . $ $anonymous_type_48ac8bda34bc2e3_2#chain. = Chain; |
| 771 | Descriptor->compcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#comp. = comp; |
| 772 | |
| 773 | { Local_Segmentcxx . . $ Local_Segment# *sg; |
| 774 | int ln; |
| 775 | |
| 776 | Descriptor->indifcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#indif. = 0; |
| 777 | |
| 778 | for (i = 0; i < npiece; i++) |
| 779 | { sg = &(Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece.); |
| 780 | ln = ((sg->aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos. - sg->abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.) + (sg->beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. - sg->bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.)) / 2; |
| 781 | if (i > 0 && Chain[i-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error. < sg->errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error.) |
| 782 | { if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) |
| 783 | { if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < 0) |
| 784 | ln += Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.; |
| 785 | } |
| 786 | else |
| 787 | { if (Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < 0) |
| 788 | ln += Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.; |
| 789 | } |
| 790 | } |
| 791 | if (i < npiece-1 && Chain[i+1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error. <= sg->errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error.) |
| 792 | { if (Chain[i+1].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < Chain[i+1].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) |
| 793 | { if (Chain[i+1].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < 0) |
| 794 | ln += Chain[i+1].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.; |
| 795 | } |
| 796 | else |
| 797 | { if (Chain[i+1].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < 0) |
| 798 | ln += Chain[i+1].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.; |
| 799 | } |
| 800 | } |
| 801 | if (ln > 0) |
| 802 | Descriptor->indifcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#indif. += (int)(ln * sg->errorcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#error.); |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | Descriptor->diffscxx . . $ $anonymous_type_48ac8bda34bc2e3_2#diffs. = Descriptor->indifcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#indif.; |
| 807 | |
| 808 | for (i = 0; i <= npiece; i++) |
| 809 | { int d; |
| 810 | if (Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap. < 0 || Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap. < 0) |
| 811 | d = abscxx . . $ abs(a1851578aea3f541).( (Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. - Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos.) - |
| 812 | (Chain[i-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. - Chain[i-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.)); |
| 813 | else |
| 814 | { d = Chain[i].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.; |
| 815 | if (d < Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) d = Chain[i].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.; |
| 816 | } |
| 817 | Descriptor->diffscxx . . $ $anonymous_type_48ac8bda34bc2e3_2#diffs. += d; |
| 818 | } |
| 819 | |
| 820 | { int overa, overb; |
| 821 | overa = (Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos. + Chain[npiece].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.) |
| 822 | - (Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos. - Chain[0].agapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#agap.); |
| 823 | overb = (Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. + Chain[npiece].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.) |
| 824 | - (Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. - Chain[0].bgapcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#bgap.); |
| 825 | Descriptor->lengthcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#length. = (overa + overb) / 2; |
| 826 | } |
| 827 | |
| 828 | Descriptor->begposcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#begpos. = Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..abposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#abpos. - Chain[0].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 829 | Descriptor->endposcxx . . $ $anonymous_type_48ac8bda34bc2e3_2#endpos. = (Blen - Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.) |
| 830 | - (Alen - Chain[npiece-1].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..aeposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#aepos.); |
| 831 | |
| 832 | for (i = 0; i < npiece; i++) |
| 833 | if (Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. < 0) |
| 834 | { int x; |
| 835 | x = Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos.; |
| 836 | Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..bbposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bbpos. = Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos.; |
| 837 | Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..beposcxx . . $ $anonymous_type_48ac8bda34bc2e3_0#bepos. = x; |
| 838 | Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score. = - Chain[i].piececxx . . $ $anonymous_type_48ac8bda34bc2e3_1#piece..scorecxx . . $ $anonymous_type_48ac8bda34bc2e3_0#score.-1; |
| 839 | Chain[i].reversedcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#reversed. = 1; |
| 840 | } |
| 841 | else |
| 842 | Chain[i].reversedcxx . . $ $anonymous_type_48ac8bda34bc2e3_1#reversed. = 0; |
| 843 | } |
| 844 | |
| 845 | restore_segscxx . . $ restore_segs(53b5c1b73069559b).(Segs,NumSegs,comp,Alen,Blen); /* undo comp and rc changes */ |
| 846 | |
| 847 | return (Descriptor); |
| 848 | } |