| 1 | #cxx . . $ `<file>/meryl/dump.C`/include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <string.h> |
| 4 | |
| 5 | #include "meryl.H"cxx . . $ `<file>/meryl/meryl.H`/ |
| 6 | #include "libmeryl.H"cxx . . $ `<file>/libmeryl/libmeryl.H`/ |
| 7 | |
| 8 | #include <algorithm> |
| 9 | |
| 10 | void |
| 11 | dumpThresholdcxx . . $ dumpThreshold(aab238e627804bcb).(merylArgscxx . . $ merylArgs# *args) { |
| 12 | merylStreamReadercxx . . $ merylStreamReader# *M = new merylStreamReadercxx . . $ merylStreamReader#(args->inputFilecxx . . $ merylArgs#inputFile.); |
| 13 | char str[1025]; |
| 14 | |
| 15 | while (M->nextMercxx . . $ merylStreamReader#nextMer(c9857a73d68e59ba).()) { |
| 16 | if (M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).() >= args->numMersEstimatedcxx . . $ merylArgs#numMersEstimated.) |
| 17 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, ">"uint64FMTcxx . . $ `libutil/util.h:55:10`!"\n%s\n", |
| 18 | M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).(), |
| 19 | M->theFMercxx . . $ merylStreamReader#theFMer(2767e3d60d24e1a3).().merToStringcxx . . $ kMerTiny#merToString(2648ccd788ca02e9).(str)); |
| 20 | } |
| 21 | |
| 22 | delete M; |
| 23 | } |
| 24 | |
| 25 | |
| 26 | void |
| 27 | dumpPositionscxx . . $ dumpPositions(aab238e627804bcb).(merylArgscxx . . $ merylArgs# *args) { |
| 28 | merylStreamReadercxx . . $ merylStreamReader# *M = new merylStreamReadercxx . . $ merylStreamReader#(args->inputFilecxx . . $ merylArgs#inputFile.); |
| 29 | char str[1025]; |
| 30 | |
| 31 | if (M->hasPositionscxx . . $ merylStreamReader#hasPositions(c9857a73d68e59ba).() == false) { |
| 32 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "File '%s' contains no position information.\n", args->inputFilecxx . . $ merylArgs#inputFile.); |
| 33 | } else { |
| 34 | while (M->nextMercxx . . $ merylStreamReader#nextMer(c9857a73d68e59ba).()) { |
| 35 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, ">"uint64FMTcxx . . $ `libutil/util.h:55:10`!, M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).()); |
| 36 | for (uint32cxx . . $ uint32# i=0; i<M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).(); i++) |
| 37 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, " "uint32FMTcxx . . $ `libutil/util.h:65:10`!, M->getPositioncxx . . $ merylStreamReader#getPosition(2141b656ce2cc063).(i)); |
| 38 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "\n%s\n", M->theFMercxx . . $ merylStreamReader#theFMer(2767e3d60d24e1a3).().merToStringcxx . . $ kMerTiny#merToString(2648ccd788ca02e9).(str)); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | delete M; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | void |
| 47 | countUniquecxx . . $ countUnique(aab238e627804bcb).(merylArgscxx . . $ merylArgs# *args) { |
| 48 | merylStreamReadercxx . . $ merylStreamReader# *M = new merylStreamReadercxx . . $ merylStreamReader#(args->inputFilecxx . . $ merylArgs#inputFile.); |
| 49 | |
| 50 | #warning make this a test |
| 51 | #if 0 |
| 52 | uint64 numDistinct = 0; |
| 53 | uint64 numUnique = 0; |
| 54 | uint64 numMers = 0; |
| 55 | uint64 c = 0; |
| 56 | |
| 57 | while (M->nextMer()) { |
| 58 | c = M->theCount(); |
| 59 | |
| 60 | numDistinct++; |
| 61 | if (c == 1) |
| 62 | numUnique++; |
| 63 | numMers += c; |
| 64 | } |
| 65 | |
| 66 | assert(numMers == M->numberOfTotalMers()); |
| 67 | assert(numDistinct == M->numberOfDistinctMers()); |
| 68 | assert(numUnique == M->numberOfUniqueMers()); |
| 69 | fprintf(stderr, "OK\n"); |
| 70 | #endif |
| 71 | |
| 72 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" mers.\n", M->numberOfTotalMerscxx . . $ merylStreamReader#numberOfTotalMers(f708dce9a8856c70).()); |
| 73 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" distinct mers.\n", M->numberOfDistinctMerscxx . . $ merylStreamReader#numberOfDistinctMers(f708dce9a8856c70).()); |
| 74 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" unique mers.\n", M->numberOfUniqueMerscxx . . $ merylStreamReader#numberOfUniqueMers(f708dce9a8856c70).()); |
| 75 | |
| 76 | delete M; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | void |
| 81 | plotHistogramcxx . . $ plotHistogram(aab238e627804bcb).(merylArgscxx . . $ merylArgs# *args) { |
| 82 | uint64cxx . . $ uint64# distinct = 0; |
| 83 | uint64cxx . . $ uint64# total = 0; |
| 84 | |
| 85 | merylStreamReadercxx . . $ merylStreamReader# *M = new merylStreamReadercxx . . $ merylStreamReader#(args->inputFilecxx . . $ merylArgs#inputFile.); |
| 86 | |
| 87 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" mers.\n", M->numberOfTotalMerscxx . . $ merylStreamReader#numberOfTotalMers(f708dce9a8856c70).()); |
| 88 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" distinct mers.\n", M->numberOfDistinctMerscxx . . $ merylStreamReader#numberOfDistinctMers(f708dce9a8856c70).()); |
| 89 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Found "uint64FMTcxx . . $ `libutil/util.h:55:10`!" unique mers.\n", M->numberOfUniqueMerscxx . . $ merylStreamReader#numberOfUniqueMers(f708dce9a8856c70).()); |
| 90 | |
| 91 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Largest mercount is "uint64FMTcxx . . $ `libutil/util.h:55:10`!"; "uint64FMTcxx . . $ `libutil/util.h:55:10`!" mers are too big for histogram.\n", |
| 92 | M->histogramMaximumCountcxx . . $ merylStreamReader#histogramMaximumCount(f708dce9a8856c70).(), M->histogramHugecxx . . $ merylStreamReader#histogramHuge(f708dce9a8856c70).()); |
| 93 | |
| 94 | for (uint32cxx . . $ uint32# i=1; i<M->histogramLengthcxx . . $ merylStreamReader#histogramLength(f708dce9a8856c70).(); i++) { |
| 95 | uint64cxx . . $ uint64# hist = M->histogramcxx . . $ merylStreamReader#histogram(1892545c1754497d).(i); |
| 96 | |
| 97 | if (hist > 0) { |
| 98 | distinct += hist; |
| 99 | total += hist * i; |
| 100 | |
| 101 | fprintf(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, uint32FMTcxx . . $ `libutil/util.h:65:10`!"\t"uint64FMTcxx . . $ `libutil/util.h:55:10`!"\t%.4f\t%.4f\n", |
| 102 | i, |
| 103 | hist, |
| 104 | distinct / (double)M->numberOfDistinctMerscxx . . $ merylStreamReader#numberOfDistinctMers(f708dce9a8856c70).(), |
| 105 | total / (double)M->numberOfTotalMerscxx . . $ merylStreamReader#numberOfTotalMers(f708dce9a8856c70).()); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | delete M; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | |
| 114 | void |
| 115 | dumpDistanceBetweenMerscxx . . $ dumpDistanceBetweenMers(aab238e627804bcb).(merylArgscxx . . $ merylArgs# *args) { |
| 116 | merylStreamReadercxx . . $ merylStreamReader# *M = new merylStreamReadercxx . . $ merylStreamReader#(args->inputFilecxx . . $ merylArgs#inputFile.); |
| 117 | |
| 118 | // This is now tough because we don't know where the sequences end, |
| 119 | // and our positions encode position in the chain. |
| 120 | |
| 121 | uint32cxx . . $ uint32# histMax = 64 * 1024 * 1024; |
| 122 | uint64cxx . . $ uint64# *hist = new uint64cxx . . $ uint64# [histMax]; |
| 123 | uint64cxx . . $ uint64# histHuge = 0; |
| 124 | |
| 125 | if (M->hasPositionscxx . . $ merylStreamReader#hasPositions(c9857a73d68e59ba).() == false) { |
| 126 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "File '%s' contains no position information.\n", args->inputFilecxx . . $ merylArgs#inputFile.); |
| 127 | } else { |
| 128 | while (M->nextMercxx . . $ merylStreamReader#nextMer(c9857a73d68e59ba).()) { |
| 129 | stdcxx . . $ std/::sortcxx . . $ std/sort(249673c20e2b8d5).(M->thePositionscxx . . $ merylStreamReader#thePositions(ac695d451f96e4aa).(), M->thePositionscxx . . $ merylStreamReader#thePositions(ac695d451f96e4aa).() + M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).()); |
| 130 | |
| 131 | for (uint32cxx . . $ uint32# i=1; i<M->theCountcxx . . $ merylStreamReader#theCount(f708dce9a8856c70).(); i++) { |
| 132 | uint32cxx . . $ uint32# d = M->getPositioncxx . . $ merylStreamReader#getPosition(2141b656ce2cc063).(i) - M->getPositioncxx . . $ merylStreamReader#getPosition(2141b656ce2cc063).(i-1); |
| 133 | if (d < histMax) |
| 134 | hist[d]++; |
| 135 | else |
| 136 | histHuge++; |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | uint32cxx . . $ uint32# maxd = 0; |
| 141 | |
| 142 | for (uint32cxx . . $ uint32# d=0; d<histMax; d++) |
| 143 | if (hist[d]) |
| 144 | maxd = d+1; |
| 145 | |
| 146 | for (uint32cxx . . $ uint32# d=0; d<maxd; d++) |
| 147 | if (hist[d]) |
| 148 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, uint32FMTcxx . . $ `libutil/util.h:65:10`!"\t"uint64FMTcxx . . $ `libutil/util.h:55:10`!"\n", d, hist[d]); |
| 149 | |
| 150 | if (histHuge) |
| 151 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "huge\t"uint64FMTcxx . . $ `libutil/util.h:55:10`!"\n", histHuge); |
| 152 | } |
| 153 | |
| 154 | delete [] hist; |
| 155 | delete M; |
| 156 | } |