Debian Codegraph @

atac-driver/gapShifter/coalesceMatches.C

raw symbols SCIP
1 // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/gapShifter/coalesceMatches.C`/
2 // Copyright (c) 2006 J. Craig Venter Institute
3 // Author: Brian Walenz
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received (LICENSE.txt) a copy of the GNU General Public
16 // License along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22
23 #include "bio++.H"cxx . . $ `<file>/libbio/bio++.H`/
24 #include "atac.H"cxx . . $ `<file>/atac-driver/libatac/atac.H`/
25
26 // Reads a set of matches, coalesces those on the same diagonal.
27 // Does not preserve runs.
28 //
29 // No args, reads stdin, writes stdout.
30
31 int
32 maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) {
33 atacFilecxx . . $ atacFile# AFcxx . . $ atacFile#atacFile(85c52e162fed56f9).("-");
34 atacMatchOrdercxx . . $ atacMatchOrder# MOcxx . . $ atacMatchOrder#atacMatchOrder(f3ef1525738b52af).(*AF.matchescxx . . $ atacFile#matches(33e88ebc28d05bce).());
35 atacMatchcxx . . $ atacMatch# *l = 0L;
36 atacMatchcxx . . $ atacMatch# *r = 0L;
37
38 MO.sortDiagonalcxx . . $ atacMatchOrder#sortDiagonal(b4d55b1286ff73e8).();
39
40 for (uint32cxx . . $ uint32# i=1; i<MO.numMatchescxx . . $ atacMatchOrder#numMatches(db52760e79bf9054).(); i++) {
41 l = MO[cxx . . $ atacMatchOrder#`operator[]`(4b949e4d42dbfd78).i-1];
42 r = MO[cxx . . $ atacMatchOrder#`operator[]`(4b949e4d42dbfd78).i];
43
44 if ((l->iid1cxx . . $ atacMatch#iid1. == r->iid1cxx . . $ atacMatch#iid1.) &&
45 (l->iid2cxx . . $ atacMatch#iid2. == r->iid2cxx . . $ atacMatch#iid2.) &&
46 (l->fwd1cxx . . $ atacMatch#fwd1. == r->fwd1cxx . . $ atacMatch#fwd1.) &&
47 (l->fwd2cxx . . $ atacMatch#fwd2. == r->fwd2cxx . . $ atacMatch#fwd2.) &&
48 (l->pos1cxx . . $ atacMatch#pos1. + l->len1cxx . . $ atacMatch#len1. == r->pos1cxx . . $ atacMatch#pos1.) &&
49 (l->pos2cxx . . $ atacMatch#pos2. + l->len2cxx . . $ atacMatch#len2. == r->pos2cxx . . $ atacMatch#pos2.) &&
50 (strcmp(l->typecxx . . $ atacMatch#type., r->typecxx . . $ atacMatch#type.) == 0) &&
51 (strcmp(l->parentuidcxx . . $ atacMatch#parentuid., r->parentuidcxx . . $ atacMatch#parentuid.) == 0)) {
52
53 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "MERGE:\n");
54 l->printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, AF.labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF.labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).());
55 r->printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, AF.labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF.labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).());
56
57 l->len1cxx . . $ atacMatch#len1. += r->len1cxx . . $ atacMatch#len1.;
58 l->len2cxx . . $ atacMatch#len2. += r->len2cxx . . $ atacMatch#len2.;
59
60 l->printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, AF.labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF.labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).());
61 } else {
62 l->printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, AF.labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF.labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).());
63 l = 0L;
64 }
65 }
66
67 if (l)
68 l->printcxx . . $ atacMatch#print(f61d327ebbdda89f).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, AF.labelAcxx . . $ atacFileBase#labelA(41208ce6ca65dd58).(), AF.labelBcxx . . $ atacFileBase#labelB(41208ce6ca65dd58).());
69
70 return(0);
71 }