Debian Codegraph @

atac-driver/alignOverlap/overlap-stats.H

raw symbols SCIP
1 // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/alignOverlap/overlap-stats.H`/
2 // Copyright (c) 2005 J. Craig Venter Institute
3 // Author: Brian Walenz
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received (LICENSE.txt) a copy of the GNU General Public
16 // License along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 #ifndef OVERLAP_STATS_H
20 #define OVERLAP_STATS_Hcxx . . $ `atac-driver/alignOverlap/overlap-stats.H:20:9`!
21
22 #include "overlap.H"cxx . . $ `<file>/atac-driver/alignOverlap/overlap.H`/
23
24 // Statistics and Histograms
25 //
26 // Index 1 is the assembly, 2 is the mapping. Stats count the
27 // number of bases covered, histograms are of the block sizes.
28 //
29 class histogramcxx . . $ histogram# {
30 public:
31 histogramcxx . . $ histogram#histogram(cb2f890c2fdad230).(uint32cxx . . $ uint32# max=65536) {
32 histMaxcxx . . $ histogram#histMax. = max;
33 histcxx . . $ histogram#hist. = new uint32cxx . . $ uint32# [histMaxcxx . . $ histogram#histMax.];
34 sumcxx . . $ histogram#sum. = 0;
35
36 for (uint32cxx . . $ uint32# i=0; i<histMaxcxx . . $ histogram#histMax.; i++)
37 histcxx . . $ histogram#hist.[i] = 0;
38 };
39 ~cxx . . $ histogram#`~histogram`(ced63f7c635d850d).histogramcxx . . $ histogram#() {
40 delete [] histcxx . . $ histogram#hist.;
41 };
42
43 void updatecxx . . $ histogram#update(cb2f890c2fdad230).(uint32cxx . . $ uint32# length) {
44 sumcxx . . $ histogram#sum. += length;
45 histcxx . . $ histogram#hist.[ ((length) > histMaxcxx . . $ histogram#histMax.) ? 0 : length ]++;
46 };
47
48 void operatorcxx . . $ histogram#`operator+=`(cb2f890c2fdad230).+=(uint32cxx . . $ uint32# length) {
49 updatecxx . . $ histogram#update(cb2f890c2fdad230).(length);
50 };
51
52 uint32cxx . . $ uint32# getSumcxx . . $ histogram#getSum(db52760e79bf9054).(void) {
53 return(sumcxx . . $ histogram#sum.);
54 };
55
56 void writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(char const *prefix, char const *label) {
57 char filename[1024];
58 sprintf(filename, "%s.%s", prefix, label);
59 errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = 0;
60 FILE *out = fopen(filename, "w");
61 if (errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)
62 fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Failed to open '%s': %s\n", filename, strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)), exitcxx . . $ exit(44ed87f96534fad7).(1);
63 for (uint32cxx . . $ uint32# i=0; i<histMaxcxx . . $ histogram#histMax.; i++)
64 fprintf(out, uint32FMTcxx . . $ `libutil/util.h:65:10`!" "uint32FMTcxx . . $ `libutil/util.h:65:10`!"\n", i, histcxx . . $ histogram#hist.[i]);
65 fclose(out);
66 };
67
68 private:
69 uint32cxx . . $ uint32# *histcxx . . $ histogram#hist.;
70 uint32cxx . . $ uint32# histMaxcxx . . $ histogram#histMax.;
71 uint32cxx . . $ uint32# sumcxx . . $ histogram#sum.;
72 };
73
74 class overlapStatscxx . . $ overlapStats# {
75 public:
76 histogramcxx . . $ histogram# unmappedcxx . . $ overlapStats#unmapped.;
77 histogramcxx . . $ histogram# map1uniquecxx . . $ overlapStats#map1unique.;
78 histogramcxx . . $ histogram# map2uniquecxx . . $ overlapStats#map2unique.;
79 histogramcxx . . $ histogram# differentcxx . . $ overlapStats#different.;
80 histogramcxx . . $ histogram# wilddiffcxx . . $ overlapStats#wilddiff.;
81 histogramcxx . . $ histogram# samecxx . . $ overlapStats#same.;
82 histogramcxx . . $ histogram# inconsistentcxx . . $ overlapStats#inconsistent.;
83
84 void writeHistogramcxx . . $ overlapStats#writeHistogram(85c52e162fed56f9).(char const *prefix) {
85 unmappedcxx . . $ overlapStats#unmapped..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "unmapped");
86 map1uniquecxx . . $ overlapStats#map1unique..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "map1unique");
87 map2uniquecxx . . $ overlapStats#map2unique..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "map2unique");
88 differentcxx . . $ overlapStats#different..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "different");
89 wilddiffcxx . . $ overlapStats#wilddiff..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "wilddiff");
90 samecxx . . $ overlapStats#same..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "same");
91 inconsistentcxx . . $ overlapStats#inconsistent..writeHistogramcxx . . $ histogram#writeHistogram(2fa786934fe80e24).(prefix, "inconsistent");
92 };
93 };
94
95
96 #endif // OVERLAP_STATS_H