| 1 | #ifndef MERYL_H |
| 2 | #define MERYL_H |
| 3 | |
| 4 | #include "bio++.H" |
| 5 | |
| 6 | #define PERSONALITY_MERGE 0xff |
| 7 | |
| 8 | #define PERSONALITY_MIN 0x01 |
| 9 | #define PERSONALITY_MINEXIST 0x02 |
| 10 | #define PERSONALITY_MAX 0x03 |
| 11 | #define PERSONALITY_MAXEXIST 0x04 |
| 12 | #define PERSONALITY_ADD 0x05 |
| 13 | #define PERSONALITY_SUB 0x06 |
| 14 | #define PERSONALITY_DIVIDE 0x07 |
| 15 | #define PERSONALITY_ABS 0x08 |
| 16 | |
| 17 | #define PERSONALITY_AND 0x10 |
| 18 | #define PERSONALITY_NAND 0x11 |
| 19 | #define PERSONALITY_OR 0x12 |
| 20 | #define PERSONALITY_XOR 0x13 |
| 21 | #define PERSONALITY_LEQ 0x14 |
| 22 | #define PERSONALITY_GEQ 0x15 |
| 23 | #define PERSONALITY_EQ 0x16 |
| 24 | |
| 25 | class merylArgs { |
| 26 | public: |
| 27 | merylArgs(int argc, char **argv); |
| 28 | merylArgs(const char *prefix); |
| 29 | ~merylArgs(); |
| 30 | |
| 31 | void usage(void); |
| 32 | void clear(void); |
| 33 | |
| 34 | uint64 hash(kMer const &mer) { |
| 35 | return(mer.startOfMer(numBuckets_log2)); |
| 36 | }; |
| 37 | |
| 38 | bool writeConfig(void); |
| 39 | bool readConfig(const char *prefix); |
| 40 | public: |
| 41 | char *execName; |
| 42 | char *options; |
| 43 | |
| 44 | bool beVerbose; |
| 45 | bool doForward; |
| 46 | bool doReverse; |
| 47 | bool doCanonical; |
| 48 | |
| 49 | char *inputFile; |
| 50 | char *outputFile; |
| 51 | char *queryFile; |
| 52 | |
| 53 | uint32 merSize; |
| 54 | uint32 merComp; |
| 55 | bool positionsEnabled; |
| 56 | |
| 57 | uint64 numMersEstimated; |
| 58 | uint64 numMersActual; |
| 59 | |
| 60 | uint64 numBasesActual; |
| 61 | |
| 62 | uint64 mersPerBatch; |
| 63 | uint64 basesPerBatch; |
| 64 | |
| 65 | uint64 numBuckets; |
| 66 | uint32 numBuckets_log2; |
| 67 | uint32 merDataWidth; |
| 68 | uint64 merDataMask; |
| 69 | uint32 bucketPointerWidth; |
| 70 | |
| 71 | uint32 numThreads; |
| 72 | uint64 memoryLimit; |
| 73 | uint64 segmentLimit; |
| 74 | bool configBatch; |
| 75 | bool countBatch; |
| 76 | bool mergeBatch; |
| 77 | uint32 batchNumber; |
| 78 | |
| 79 | char *sgeJobName; |
| 80 | char *sgeBuildOpt; |
| 81 | char *sgeMergeOpt; |
| 82 | bool isOnGrid; |
| 83 | |
| 84 | uint32 lowCount; |
| 85 | uint32 highCount; |
| 86 | uint32 desiredCount; |
| 87 | |
| 88 | bool outputCount; |
| 89 | bool outputAll; |
| 90 | bool outputPosition; |
| 91 | |
| 92 | bool includeDefLine; |
| 93 | bool includeMer; |
| 94 | |
| 95 | uint32 mergeFilesMax; |
| 96 | uint32 mergeFilesLen; |
| 97 | char **mergeFiles; |
| 98 | |
| 99 | uint32 personality; |
| 100 | }; |
| 101 | |
| 102 | |
| 103 | uint64 |
| 104 | estimateNumMersInMemorySize(uint32 merSize, |
| 105 | uint64 mem, |
| 106 | bool positionsEnabled, |
| 107 | bool beVerbose); |
| 108 | |
| 109 | uint64 |
| 110 | estimateMemory(uint32 merSize, |
| 111 | uint64 numMers, |
| 112 | bool positionsEnabled); |
| 113 | |
| 114 | uint32 |
| 115 | optimalNumberOfBuckets(uint32 merSize, |
| 116 | uint64 numMers, |
| 117 | bool positionsEnabled); |
| 118 | |
| 119 | void estimate(merylArgs *args); |
| 120 | void build(merylArgs *args); |
| 121 | |
| 122 | void multipleOperations(merylArgs *args); |
| 123 | void binaryOperations(merylArgs *args); |
| 124 | void unaryOperations(merylArgs *args); |
| 125 | |
| 126 | void dump(merylArgs *args); |
| 127 | void dumpThreshold(merylArgs *args); |
| 128 | void dumpPositions(merylArgs *args); |
| 129 | void countUnique(merylArgs *args); |
| 130 | void dumpDistanceBetweenMers(merylArgs *args); |
| 131 | void plotHistogram(merylArgs *args); |
| 132 | |
| 133 | #endif // MERYL_H |