#ifndef _KMERALIGNCORE_H_ #define _KMERALIGNCORE_H_ #include "analysis/DNAVector.h" //========================================== class TranslateBasesToNumber { public: TranslateBasesToNumber() {m_range = 12;} virtual ~TranslateBasesToNumber() {} virtual void SetSize(int i) { m_range = i; } virtual int BasesToNumber(const DNAVector & b, int from) const = 0; virtual int GetRange() const {return m_range;} virtual int GetSize() const = 0; virtual int GetBoundValue() const { int i; int m = 1; for (i=0; i & GetData() const {return m_data;} private: svec m_data; }; class KmerAlignCoreRecordStoreTable { public: void SetSize(int i) { m_table.resize(i); } int GetSize() const {return m_table.isize();} KmerAlignCoreRecordStore & operator[] (int i) {return m_table[i];} const KmerAlignCoreRecordStore & operator[] (int i) const {return m_table[i];} private: svec m_table; }; class KmerAlignCore { public: KmerAlignCore(); void SetMax12Mer(int i) { m_max12 = i; } void AddData(const vecDNAVector & b); void AddData(const vecDNAVector & b, const vecNumVector & tags, int min); void AddData(const DNAVector & b, int contig, int offset = 0, bool bSort = false); void SortAll(); void SetTranslator(TranslateBasesToNumber * p) { m_pTrans = p; m_table.SetSize(m_pTrans->GetBoundValue()); } bool GetMatches(svec & matches, const DNAVector & b, int start = 0); const svec & GetMatchesDirectly(const DNAVector & b, int start = 0); void SetNumTables(int i) { m_numTables = i; } int GetWordSize() const {return m_numTables * m_pTrans->GetSize();} void SetLookAhead(int i) {m_lookAhead = i;} int GetLookAhead() const {return m_lookAhead;} void SetLAMaxFreq(int i) {m_lookAheadMaxFreq = i;} private: void MergeSortFilter(svec & result, const svec & one, const svec & two); int m_numTables; int m_lookAhead; int m_max12; int m_lookAheadMaxFreq; KmerAlignCoreRecordStoreTable m_table; TranslateBasesToNumber * m_pTrans; }; #endif //_KMERALIGNCORE_H_