| 1 | #cxx . . $ `<file>/atac-driver/clumpMaker/clumpMaker.C`/include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | |
| 4 | #include "util.h"cxx . . $ `<file>/libutil/util.h`/ |
| 5 | #include "atac.H"cxx . . $ `<file>/atac-driver/libatac/atac.H`/ |
| 6 | |
| 7 | // Aaron Halpern's clumpMaker algorithm. |
| 8 | // |
| 9 | // To reproduce the original clumpMaker exactly, assuming that your |
| 10 | // atac mapping is for a QUERYvsREFERENCE: |
| 11 | // |
| 12 | // in=VISD6vsB35LC/VISD6vsB35LC |
| 13 | // cut -d' ' -f 1-12 < $in.atac.ckpLast | grep "^M u" | sort -k5,5 -k6n > tmp.a.clumpMaker |
| 14 | // $clumpMaker -S -c 50000 -2 -f tmp.a.clumpMaker > $in.50000.clumps |
| 15 | // |
| 16 | // That is, use only the first 12 columns of info, only ungapped |
| 17 | // matches (the original also allows gapped matches, but we don't |
| 18 | // have any of those), then sort by the QUERY iid and position. Yes, |
| 19 | // the sort is supposed to be alphanumeric. |
| 20 | // |
| 21 | // Then, run clumpMaker DISABLING it's sort (which sorts iids |
| 22 | // numerically), using the second sequence as the reference. |
| 23 | // |
| 24 | |
| 25 | class tClumpHitcxx . . $ tClumpHit# { |
| 26 | public: |
| 27 | |
| 28 | void setcxx . . $ tClumpHit#set(84e3b27b005811b9).(atacMatchcxx . . $ atacMatch# *m, bool seq1IsRef) { |
| 29 | |
| 30 | matchcxx . . $ tClumpHit#match. =cxx . . $ atacMatch#`operator=`(e7f240020143bcf7). *m; |
| 31 | matchIIDcxx . . $ tClumpHit#matchIID. = m->matchiidcxx . . $ atacMatch#matchiid.; |
| 32 | |
| 33 | if (seq1IsRef) { |
| 34 | refIIDcxx . . $ tClumpHit#refIID. = m->iid1cxx . . $ atacMatch#iid1.; |
| 35 | refBegcxx . . $ tClumpHit#refBeg. = m->pos1cxx . . $ atacMatch#pos1.; |
| 36 | refEndcxx . . $ tClumpHit#refEnd. = m->pos1cxx . . $ atacMatch#pos1. + m->len1cxx . . $ atacMatch#len1.; |
| 37 | qryIIDcxx . . $ tClumpHit#qryIID. = m->iid2cxx . . $ atacMatch#iid2.; |
| 38 | qryBegcxx . . $ tClumpHit#qryBeg. = m->pos2cxx . . $ atacMatch#pos2.; |
| 39 | qryEndcxx . . $ tClumpHit#qryEnd. = m->pos2cxx . . $ atacMatch#pos2. + m->len2cxx . . $ atacMatch#len2.; |
| 40 | } else { |
| 41 | refIIDcxx . . $ tClumpHit#refIID. = m->iid2cxx . . $ atacMatch#iid2.; |
| 42 | refBegcxx . . $ tClumpHit#refBeg. = m->pos2cxx . . $ atacMatch#pos2.; |
| 43 | refEndcxx . . $ tClumpHit#refEnd. = m->pos2cxx . . $ atacMatch#pos2. + m->len2cxx . . $ atacMatch#len2.; |
| 44 | qryIIDcxx . . $ tClumpHit#qryIID. = m->iid1cxx . . $ atacMatch#iid1.; |
| 45 | qryBegcxx . . $ tClumpHit#qryBeg. = m->pos1cxx . . $ atacMatch#pos1.; |
| 46 | qryEndcxx . . $ tClumpHit#qryEnd. = m->pos1cxx . . $ atacMatch#pos1. + m->len1cxx . . $ atacMatch#len1.; |
| 47 | } |
| 48 | |
| 49 | oricxx . . $ tClumpHit#ori. = m->fwd2cxx . . $ atacMatch#fwd2. ? 1 : -1; |
| 50 | |
| 51 | bestStartcxx . . $ tClumpHit#bestStart. = -1; |
| 52 | bestExtendcxx . . $ tClumpHit#bestExtend. = -1; |
| 53 | scoreStartcxx . . $ tClumpHit#scoreStart. = 0; |
| 54 | scoreExtendcxx . . $ tClumpHit#scoreExtend. = 0; |
| 55 | clumpcxx . . $ tClumpHit#clump. = -1; |
| 56 | }; |
| 57 | |
| 58 | int64cxx . . $ int64# get_bestScorecxx . . $ tClumpHit#get_bestScore(57a65ae535d7db84).() const { |
| 59 | return(maxcxx . . $ std/max(2a338fce5842aa6a).(scoreStartcxx . . $ tClumpHit#scoreStart., scoreExtendcxx . . $ tClumpHit#scoreExtend.)); |
| 60 | }; |
| 61 | |
| 62 | atacMatchcxx . . $ atacMatch# matchcxx . . $ tClumpHit#match.; |
| 63 | |
| 64 | uint32cxx . . $ uint32# matchIIDcxx . . $ tClumpHit#matchIID.; |
| 65 | |
| 66 | uint32cxx . . $ uint32# refIIDcxx . . $ tClumpHit#refIID.; |
| 67 | int32cxx . . $ int32# refBegcxx . . $ tClumpHit#refBeg.; |
| 68 | int32cxx . . $ int32# refEndcxx . . $ tClumpHit#refEnd.; |
| 69 | |
| 70 | uint32cxx . . $ uint32# qryIIDcxx . . $ tClumpHit#qryIID.; |
| 71 | int32cxx . . $ int32# qryBegcxx . . $ tClumpHit#qryBeg.; |
| 72 | int32cxx . . $ int32# qryEndcxx . . $ tClumpHit#qryEnd.; |
| 73 | |
| 74 | int32cxx . . $ int32# oricxx . . $ tClumpHit#ori.; |
| 75 | |
| 76 | int32cxx . . $ int32# scoreStartcxx . . $ tClumpHit#scoreStart.; |
| 77 | int32cxx . . $ int32# bestStartcxx . . $ tClumpHit#bestStart.; |
| 78 | int32cxx . . $ int32# scoreExtendcxx . . $ tClumpHit#scoreExtend.; |
| 79 | int32cxx . . $ int32# bestExtendcxx . . $ tClumpHit#bestExtend.; |
| 80 | int32cxx . . $ int32# clumpcxx . . $ tClumpHit#clump.; |
| 81 | }; |
| 82 | |
| 83 | |
| 84 | |
| 85 | int |
| 86 | clumpHitCompareQrycxx . . $ clumpHitCompareQry(9148c8c3ff42c9d8).(const void *A, const void *B) { |
| 87 | const tClumpHitcxx . . $ tClumpHit# *a = (const tClumpHitcxx . . $ tClumpHit# *)A; |
| 88 | const tClumpHitcxx . . $ tClumpHit# *b = (const tClumpHitcxx . . $ tClumpHit# *)B; |
| 89 | |
| 90 | if (a->qryIIDcxx . . $ tClumpHit#qryIID. > b->qryIIDcxx . . $ tClumpHit#qryIID.) return(1); |
| 91 | if (a->qryIIDcxx . . $ tClumpHit#qryIID. < b->qryIIDcxx . . $ tClumpHit#qryIID.) return(-1); |
| 92 | if (a->qryBegcxx . . $ tClumpHit#qryBeg. > b->qryBegcxx . . $ tClumpHit#qryBeg.) return(1); |
| 93 | if (a->qryBegcxx . . $ tClumpHit#qryBeg. < b->qryBegcxx . . $ tClumpHit#qryBeg.) return(-1); |
| 94 | if (a->qryEndcxx . . $ tClumpHit#qryEnd. > b->qryEndcxx . . $ tClumpHit#qryEnd.) return(1); |
| 95 | if (a->qryEndcxx . . $ tClumpHit#qryEnd. < b->qryEndcxx . . $ tClumpHit#qryEnd.) return(-1); |
| 96 | |
| 97 | if (a->refIIDcxx . . $ tClumpHit#refIID. > b->refIIDcxx . . $ tClumpHit#refIID.) return(1); |
| 98 | if (a->refIIDcxx . . $ tClumpHit#refIID. < b->refIIDcxx . . $ tClumpHit#refIID.) return(-1); |
| 99 | if (a->refBegcxx . . $ tClumpHit#refBeg. > b->refBegcxx . . $ tClumpHit#refBeg.) return(1); |
| 100 | if (a->refBegcxx . . $ tClumpHit#refBeg. < b->refBegcxx . . $ tClumpHit#refBeg.) return(-1); |
| 101 | if (a->refEndcxx . . $ tClumpHit#refEnd. > b->refEndcxx . . $ tClumpHit#refEnd.) return(1); |
| 102 | if (a->refEndcxx . . $ tClumpHit#refEnd. < b->refEndcxx . . $ tClumpHit#refEnd.) return(-1); |
| 103 | |
| 104 | return(0); |
| 105 | } |
| 106 | |
| 107 | int |
| 108 | clumpHitCompareIIDcxx . . $ clumpHitCompareIID(9148c8c3ff42c9d8).(const void *A, const void *B) { |
| 109 | const tClumpHitcxx . . $ tClumpHit# *a = (const tClumpHitcxx . . $ tClumpHit# *)A; |
| 110 | const tClumpHitcxx . . $ tClumpHit# *b = (const tClumpHitcxx . . $ tClumpHit# *)B; |
| 111 | |
| 112 | if (a->matchIIDcxx . . $ tClumpHit#matchIID. > b->matchIIDcxx . . $ tClumpHit#matchIID.) return(1); |
| 113 | if (a->matchIIDcxx . . $ tClumpHit#matchIID. < b->matchIIDcxx . . $ tClumpHit#matchIID.) return(-1); |
| 114 | return(0); |
| 115 | } |
| 116 | |
| 117 | |
| 118 | bool |
| 119 | chainablecxx . . $ chainable(2ef5bfffb33d102b).(tClumpHitcxx . . $ tClumpHit# *a, tClumpHitcxx . . $ tClumpHit# *b, int32cxx . . $ int32# maxjump) { |
| 120 | |
| 121 | // return false if |
| 122 | // hits are to different chromosomes |
| 123 | // hits are not similarly oriented |
| 124 | // hits are too far apart on query axis |
| 125 | // hits are too far apart on reference axis |
| 126 | // hits are "out of order" (we're sorted by the qry) |
| 127 | // |
| 128 | return(!((a->refIIDcxx . . $ tClumpHit#refIID. != b->refIIDcxx . . $ tClumpHit#refIID.) || (a->qryIIDcxx . . $ tClumpHit#qryIID. != b->qryIIDcxx . . $ tClumpHit#qryIID.) || |
| 129 | (a->oricxx . . $ tClumpHit#ori. != b->oricxx . . $ tClumpHit#ori.) || |
| 130 | (b->qryBegcxx . . $ tClumpHit#qryBeg. - a->qryEndcxx . . $ tClumpHit#qryEnd. > maxjump) || |
| 131 | (a->oricxx . . $ tClumpHit#ori. * (b->refBegcxx . . $ tClumpHit#refBeg. - a->refEndcxx . . $ tClumpHit#refEnd.) > maxjump) || |
| 132 | (a->oricxx . . $ tClumpHit#ori. * (b->refBegcxx . . $ tClumpHit#refBeg. - a->refBegcxx . . $ tClumpHit#refBeg.) < 0))); |
| 133 | } |
| 134 | |
| 135 | |
| 136 | int32cxx . . $ int32# |
| 137 | score_all_hitscxx . . $ score_all_hits(b26fa2dc18368ccf).(tClumpHitcxx . . $ tClumpHit# *hits, |
| 138 | int32cxx . . $ int32# clumpcost, |
| 139 | int32cxx . . $ int32# maxjump, |
| 140 | uint32cxx . . $ uint32# num_hits){ |
| 141 | |
| 142 | // location of best score so far (to which we point whenever starting a new clump) |
| 143 | int32cxx . . $ int32# bestEnd = -1; |
| 144 | |
| 145 | |
| 146 | // best scores so far internal to a reference unit (scaffold, chromosome, etc) |
| 147 | int32cxx . . $ int32# bestEndThis = -1; |
| 148 | int32cxx . . $ int32# bestScoreThis = -clumpcost; |
| 149 | |
| 150 | // furthest back still accessible ... |
| 151 | uint32cxx . . $ uint32# furthest_back=0; |
| 152 | |
| 153 | for(uint32cxx . . $ uint32# i=0; i<num_hits; i++) { |
| 154 | |
| 155 | if ((i==0) || (hits[i].qryIIDcxx . . $ tClumpHit#qryIID. != hits[i-1].qryIIDcxx . . $ tClumpHit#qryIID.)) { |
| 156 | bestEnd = bestEndThis; // best of previous query unit |
| 157 | bestEndThis = i-1; |
| 158 | bestScoreThis = -clumpcost; |
| 159 | } |
| 160 | |
| 161 | // find best way of using this as start of a new clump |
| 162 | if ((bestEndThis >= 0) && |
| 163 | (bestScoreThis >= 0)) { |
| 164 | // start new clump that is not the first for this reference unit |
| 165 | hits[i].scoreStartcxx . . $ tClumpHit#scoreStart. = hits[i].qryEndcxx . . $ tClumpHit#qryEnd. - hits[i].qryBegcxx . . $ tClumpHit#qryBeg. + bestScoreThis - clumpcost; |
| 166 | hits[i].bestStartcxx . . $ tClumpHit#bestStart. = bestEndThis; |
| 167 | } else { |
| 168 | // clump would be first (to be used) for this reference unit |
| 169 | hits[i].scoreStartcxx . . $ tClumpHit#scoreStart. = hits[i].qryEndcxx . . $ tClumpHit#qryEnd. - hits[i].qryBegcxx . . $ tClumpHit#qryBeg. - clumpcost; |
| 170 | hits[i].bestStartcxx . . $ tClumpHit#bestStart. = bestEnd; |
| 171 | } |
| 172 | |
| 173 | // find best way of extending a clump, if any |
| 174 | if (furthest_back < i) { |
| 175 | int32cxx . . $ int32# cutoff = hits[i].qryBegcxx . . $ tClumpHit#qryBeg. - maxjump; |
| 176 | |
| 177 | while ((hits[furthest_back].qryIIDcxx . . $ tClumpHit#qryIID. != hits[i].qryIIDcxx . . $ tClumpHit#qryIID.) || |
| 178 | (hits[furthest_back].qryEndcxx . . $ tClumpHit#qryEnd. < cutoff)) |
| 179 | furthest_back++; |
| 180 | } |
| 181 | |
| 182 | int32cxx . . $ int32# extendScore = -clumpcost; |
| 183 | int32cxx . . $ int32# extendprev = -1; |
| 184 | for (uint32cxx . . $ uint32# j=furthest_back; j<i; j++) { |
| 185 | if (chainablecxx . . $ chainable(2ef5bfffb33d102b).(hits+j, hits+i, maxjump)) { |
| 186 | int32cxx . . $ int32# tmpscore = hits[j].get_bestScorecxx . . $ tClumpHit#get_bestScore(57a65ae535d7db84).() + hits[i].qryEndcxx . . $ tClumpHit#qryEnd. - hits[i].qryBegcxx . . $ tClumpHit#qryBeg.; |
| 187 | if(extendScore < tmpscore){ |
| 188 | extendScore=tmpscore; |
| 189 | extendprev=j; |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | hits[i].scoreExtendcxx . . $ tClumpHit#scoreExtend. = extendScore; |
| 194 | hits[i].bestExtendcxx . . $ tClumpHit#bestExtend. = extendprev; |
| 195 | |
| 196 | //figure out whether this is a new best ... |
| 197 | int32cxx . . $ int32# tmpscore = hits[i].get_bestScorecxx . . $ tClumpHit#get_bestScore(57a65ae535d7db84).(); |
| 198 | if (tmpscore > bestScoreThis) { |
| 199 | bestScoreThis = tmpscore; |
| 200 | bestEndThis = i; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | return(bestEndThis); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | int |
| 215 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 216 | int32cxx . . $ int32# clumpcost = 50000; |
| 217 | int32cxx . . $ int32# maxjump = 200000; |
| 218 | bool seq1IsRef = false; |
| 219 | char *filename = 0L; |
| 220 | bool isSorted = false; |
| 221 | |
| 222 | int arg=1; |
| 223 | while (arg < argc) { |
| 224 | if (strcmp(argv[arg], "-c") == 0) { |
| 225 | clumpcost = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[++arg]); |
| 226 | } else if (strcmp(argv[arg], "-j") == 0) { |
| 227 | maxjump = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[++arg]); |
| 228 | } else if (strcmp(argv[arg], "-1") == 0) { |
| 229 | seq1IsRef = true; |
| 230 | } else if (strcmp(argv[arg], "-2") == 0) { |
| 231 | seq1IsRef = false; |
| 232 | } else if (strcmp(argv[arg], "-f") == 0) { |
| 233 | filename = argv[++arg]; |
| 234 | } else if (strcmp(argv[arg], "-S") == 0) { |
| 235 | isSorted = true; |
| 236 | } else { |
| 237 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Unknown argument '%s'\n", argv[arg]); |
| 238 | } |
| 239 | arg++; |
| 240 | } |
| 241 | |
| 242 | if (filename == 0L) { |
| 243 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "usage: %s [] -f filename\n", argv[0]); |
| 244 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " -c x penalty for clump start, default 50000\n"); |
| 245 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " -j x max jump between consistent hits in a clump, default 200000\n"); |
| 246 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " -1 the reference assembly is the first one.\n"); |
| 247 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " -2 the reference assembly is the second one (default).\n"); |
| 248 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " -S assume the input is already sorted by the query IID, position.\n"); |
| 249 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " this will also make the output sorted by queryIID, queryPosition\n"); |
| 250 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 251 | } |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "1 load the matches\n"); |
| 257 | |
| 258 | atacFilecxx . . $ atacFile# *AF = new atacFilecxx . . $ atacFile#(filename); |
| 259 | uint32cxx . . $ uint32# hitsLen = AF->matchescxx . . $ atacFile#matches(33e88ebc28d05bce).()->numberOfMatchescxx . . $ atacMatchList#numberOfMatches(db52760e79bf9054).(); |
| 260 | tClumpHitcxx . . $ tClumpHit# *hits = new tClumpHitcxx . . $ tClumpHit# [hitsLen]; |
| 261 | |
| 262 | for (uint32cxx . . $ uint32# i=0; i<hitsLen; i++) |
| 263 | hits[i].setcxx . . $ tClumpHit#set(84e3b27b005811b9).(AF->matchescxx . . $ atacFile#matches(33e88ebc28d05bce).()->getMatchcxx . . $ atacMatchList#getMatch(4b949e4d42dbfd78).(i), seq1IsRef); |
| 264 | |
| 265 | |
| 266 | |
| 267 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "2 sort the matches\n"); |
| 268 | qsortcxx . . $ qsort(ebb60b13a65e77d7).(hits, hitsLen, sizeof(tClumpHitcxx . . $ tClumpHit#), clumpHitCompareQrycxx . . $ clumpHitCompareQry(9148c8c3ff42c9d8).); |
| 269 | |
| 270 | |
| 271 | |
| 272 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "3 score the matches\n"); |
| 273 | int32cxx . . $ int32# bestEnd = score_all_hitscxx . . $ score_all_hits(b26fa2dc18368ccf).(hits, |
| 274 | clumpcost, |
| 275 | maxjump, |
| 276 | hitsLen); |
| 277 | |
| 278 | // Mark the clumps |
| 279 | // |
| 280 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "4 mark clumps\n"); |
| 281 | uint32cxx . . $ uint32# clump = 0; |
| 282 | |
| 283 | while(bestEnd >= 0) { |
| 284 | hits[bestEnd].clumpcxx . . $ tClumpHit#clump. = clump; |
| 285 | |
| 286 | if (hits[bestEnd].scoreExtendcxx . . $ tClumpHit#scoreExtend. > hits[bestEnd].scoreStartcxx . . $ tClumpHit#scoreStart.) { |
| 287 | bestEnd = hits[bestEnd].bestExtendcxx . . $ tClumpHit#bestExtend.; |
| 288 | } else { |
| 289 | bestEnd = hits[bestEnd].bestStartcxx . . $ tClumpHit#bestStart.; |
| 290 | clump++; |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | // Sort the hits by iid, then merge into the output |
| 295 | // |
| 296 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "5 sort the matches\n"); |
| 297 | qsortcxx . . $ qsort(ebb60b13a65e77d7).(hits, hitsLen, sizeof(tClumpHitcxx . . $ tClumpHit#), clumpHitCompareIIDcxx . . $ clumpHitCompareIID(9148c8c3ff42c9d8).); |
| 298 | |
| 299 | |
| 300 | // For each clump, find the min/max extent in both sequences. We |
| 301 | // use this to output the clump match record. |
| 302 | // |
| 303 | int32cxx . . $ int32# *clumpLoRef = new int32cxx . . $ int32# [clump]; |
| 304 | int32cxx . . $ int32# *clumpHiRef = new int32cxx . . $ int32# [clump]; |
| 305 | int32cxx . . $ int32# *clumpLoQry = new int32cxx . . $ int32# [clump]; |
| 306 | int32cxx . . $ int32# *clumpHiQry = new int32cxx . . $ int32# [clump]; |
| 307 | bool *clumpOut = new bool [clump]; |
| 308 | |
| 309 | for (uint32cxx . . $ uint32# xx=0; xx<clump; xx++) { |
| 310 | clumpLoRef[xx] = 1000000000; |
| 311 | clumpHiRef[xx] = 0; |
| 312 | clumpLoQry[xx] = 1000000000; |
| 313 | clumpHiQry[xx] = 0; |
| 314 | clumpOut[xx] = false; |
| 315 | } |
| 316 | |
| 317 | for (uint32cxx . . $ uint32# xx=0; xx<hitsLen; xx++) { |
| 318 | int32cxx . . $ int32# cc = hits[xx].clumpcxx . . $ tClumpHit#clump.; |
| 319 | if (cc >= 0) { |
| 320 | if (hits[xx].refBegcxx . . $ tClumpHit#refBeg. < clumpLoRef[cc]) clumpLoRef[cc] = hits[xx].refBegcxx . . $ tClumpHit#refBeg.; |
| 321 | if (hits[xx].refEndcxx . . $ tClumpHit#refEnd. > clumpHiRef[cc]) clumpHiRef[cc] = hits[xx].refEndcxx . . $ tClumpHit#refEnd.; |
| 322 | |
| 323 | if (hits[xx].qryBegcxx . . $ tClumpHit#qryBeg. < clumpLoQry[cc]) clumpLoQry[cc] = hits[xx].qryBegcxx . . $ tClumpHit#qryBeg.; |
| 324 | if (hits[xx].qryEndcxx . . $ tClumpHit#qryEnd. > clumpHiQry[cc]) clumpHiQry[cc] = hits[xx].qryEndcxx . . $ tClumpHit#qryEnd.; |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | // Dump the clumps |
| 329 | // |
| 330 | |
| 331 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "6 output matches with clumps\n"); |
| 332 | |
| 333 | AF->writeHeadercxx . . $ atacFileBase#writeHeader(8d4262d45fc644ab).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 334 | |
| 335 | for (uint32cxx . . $ uint32# mm=0; mm<hitsLen; mm++) { |
| 336 | int32cxx . . $ int32# cc = hits[mm].clumpcxx . . $ tClumpHit#clump.; |
| 337 | |
| 338 | if ((cc >= 0) && |
| 339 | (clumpOut[cc] == false)) { |
| 340 | atacMatchcxx . . $ atacMatch# Ccxx . . $ atacMatch#atacMatch(49f6e7a06ebc5aa8).; |
| 341 | sprintf(C.matchuidcxx . . $ atacMatch#matchuid., "clump"int32FMTWcxx . . $ `libutil/util.h:67:10`!(06), cc); |
| 342 | sprintf(C.parentuidcxx . . $ atacMatch#parentuid., "."); |
| 343 | C.matchiidcxx . . $ atacMatch#matchiid. = 0; |
| 344 | C.typecxx . . $ atacMatch#type.[0] = 'c'; |
| 345 | C.typecxx . . $ atacMatch#type.[1] = 0; |
| 346 | |
| 347 | C.iid1cxx . . $ atacMatch#iid1. = hits[mm].matchcxx . . $ tClumpHit#match..iid1cxx . . $ atacMatch#iid1.; |
| 348 | C.iid2cxx . . $ atacMatch#iid2. = hits[mm].matchcxx . . $ tClumpHit#match..iid2cxx . . $ atacMatch#iid2.; |
| 349 | |
| 350 | // Set the position and length based on the correct reference |
| 351 | // -- in particular, since we get the IID and orientation from |
| 352 | // the copy of the match we don't need to listen to the |
| 353 | // seq1IsRef flag for those. |
| 354 | |
| 355 | if (seq1IsRef) { |
| 356 | C.pos1cxx . . $ atacMatch#pos1. = clumpLoRef[cc]; |
| 357 | C.len1cxx . . $ atacMatch#len1. = clumpHiRef[cc] - clumpLoRef[cc]; |
| 358 | C.pos2cxx . . $ atacMatch#pos2. = clumpLoQry[cc]; |
| 359 | C.len2cxx . . $ atacMatch#len2. = clumpHiQry[cc] - clumpLoQry[cc]; |
| 360 | } else { |
| 361 | C.pos1cxx . . $ atacMatch#pos1. = clumpLoQry[cc]; |
| 362 | C.len1cxx . . $ atacMatch#len1. = clumpHiQry[cc] - clumpLoQry[cc]; |
| 363 | C.pos2cxx . . $ atacMatch#pos2. = clumpLoRef[cc]; |
| 364 | C.len2cxx . . $ atacMatch#len2. = clumpHiRef[cc] - clumpLoRef[cc]; |
| 365 | } |
| 366 | |
| 367 | C.fwd1cxx . . $ atacMatch#fwd1. = hits[mm].matchcxx . . $ tClumpHit#match..fwd1cxx . . $ atacMatch#fwd1.; |
| 368 | C.fwd2cxx . . $ atacMatch#fwd2. = hits[mm].matchcxx . . $ tClumpHit#match..fwd2cxx . . $ atacMatch#fwd2.; |
| 369 | |
| 370 | C.printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, AF->labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF->labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).()); |
| 371 | |
| 372 | clumpOut[cc] = true; |
| 373 | } |
| 374 | |
| 375 | |
| 376 | if (cc >= 0) |
| 377 | sprintf(hits[mm].matchcxx . . $ tClumpHit#match..parentuidcxx . . $ atacMatch#parentuid., "clump"int32FMTWcxx . . $ `libutil/util.h:67:10`!(06), cc); |
| 378 | else |
| 379 | sprintf(hits[mm].matchcxx . . $ tClumpHit#match..parentuidcxx . . $ atacMatch#parentuid., "."); |
| 380 | |
| 381 | hits[mm].matchcxx . . $ tClumpHit#match..printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, AF->labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF->labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).()); |
| 382 | } |
| 383 | |
| 384 | return(0); |
| 385 | } |