]> git.donarmstrong.com Git - mothur.git/blob - uchime_src/windex.h
changes while testing
[mothur.git] / uchime_src / windex.h
1 #ifndef windex_h\r
2 #define windex_h\r
3 \r
4 class SFasta;\r
5 struct SeqDB;\r
6 \r
7 typedef uint32 word_t;\r
8 typedef uint16 wordcount_t;\r
9 typedef uint32 arrsize_t;\r
10 typedef uint16 seqcountperword_t;\r
11 typedef uint32 seqindex_t;\r
12 typedef uint16 commonwordcount_t;\r
13 \r
14 const uint32 WindexFileHdr_Magic1 = 0x312DE41;\r
15 const uint32 WindexFileHdr_Magic2 = 0x312DE42;\r
16 const uint32 WindexFileHdr_Magic3 = 0x312DE43;\r
17 const uint32 WindexFileHdr_Magic4 = 0x312DE44;\r
18 \r
19 struct WindexFileHdr\r
20         {\r
21         uint32 Magic1;\r
22         uint32 IsNucleo;\r
23         uint32 WordLength;\r
24         uint32 Magic2;\r
25         };\r
26 \r
27 class Windex\r
28         {\r
29 public:\r
30         bool m_Nucleo;\r
31         bool m_RedAlpha;\r
32         unsigned m_WordLength;\r
33         unsigned m_AlphaSize;\r
34         unsigned m_WordCount;\r
35         unsigned m_Hi;\r
36         unsigned m_CapacityInc;\r
37         arrsize_t *m_Capacities;\r
38         arrsize_t *m_Sizes;\r
39         float *m_WordScores;\r
40         seqindex_t **m_SeedIndexes;\r
41         byte *m_UniqueCounts;\r
42         unsigned m_CharToLetter[256];\r
43 \r
44 public:\r
45         Windex();\r
46         void ToFile(const string &FileName) const;\r
47         void FromFile(const string &FileName);\r
48         void FromSFasta(SFasta &SF);\r
49         void FromSeqDB(const SeqDB &DB);\r
50         void Clear(bool ctor = false);\r
51         void AddWords(unsigned SeqIndex, const word_t *Words, unsigned N);\r
52         void Init(bool Nucleo, unsigned WordLength);\r
53         void Init2(bool Nucleo, unsigned TableSize);\r
54         void InitRed(unsigned WordLength);\r
55         void InitWordScores(const float *const *SubstMx);\r
56         void Reset();\r
57         void LogMe() const;\r
58         unsigned LogMemSize() const;\r
59         void LogWordStats(unsigned TopWords = 10) const;\r
60         const char *WordToStr(word_t Word) const;\r
61         word_t SeqToWord(const byte *Seq) const;\r
62         unsigned SeqToWords(const byte *Seq, unsigned L, word_t *Words) const;\r
63         unsigned SeqToWordsStep(unsigned Step, const byte *Seq, unsigned L, word_t *Words) const;\r
64         unsigned WordsToCounts(const word_t *Words, unsigned N,\r
65           word_t *UniqueWords, seqcountperword_t *Counts) const;\r
66         unsigned GetUniqueWords(const word_t *Words, unsigned N,\r
67           word_t *UniqueWords) const;\r
68         void LogSizeHisto() const;\r
69         };\r
70 \r
71 #endif // windex_h\r