OpenFlexTyper
kmerClass.h
1 #ifndef KMERCLASS_H
2 #define KMERCLASS_H
3 
4 #include <set>
5 #include <bitset>
6 #include <iostream>
7 #include <map>
8 #include "ftPropsClass.h"
9 
10 namespace ft {
11 
16 class KmerClass
17 {
18 public:
21  KmerClass(std::string kmer);
22  KmerClass();
23 
25  virtual ~KmerClass();
26 
31  const std::string& getKmer() const;
32  const std::bitset<8>& getKFlags()const;
33  const std::set<long long>& getKPositions()const;
34  const std::set<ft::ReadID>& getReadIDs()const;
35  uint getOCC()const {return _occ;};
36  //uint getKmerMapSize()const;
38 
43  void setKFlags(std::set<ft::FlagType> kFlags);
44  void setKPositions(const std::set<long long>& kPositions);
45  void adjustPosForOffset(uint offset = 0);
46  void setReadIDs(std::set<ft::ReadID> readIDs);
47  void setOCC(uint occ) {_occ=occ;};
49 
54  void addKFlag(const ft::FlagType& kFlag);
55  void addKPosition(const size_t& kPosition, const uint& offset = 0);
56  void addReadID(const ft::ReadID& readID);
58 
63  void removeKFlag(ft::FlagType kFlag);
64  void removeKPosition(size_t kPosition, uint offset = 0);
65  void removeReadID(ft::ReadID readID);
67 
72  bool isKmerEqual(const KmerClass& test) const;
73  bool hasKmer(const std::string& test) const;
74  bool hasFlag(const ft::FlagType& flag);
75  bool hasKPosition(const size_t& position) const;
76  bool hasReadID(const ft::ReadID& readID) const;
78 
83  void convertPosToReadID(uint readLength, uint numOfReads, bool pairedReads, bool indexRevComp = false);
84  bool matchingReadID(const ft::ReadID &a, const ft::ReadID &b) const;
85  void adjustPositionsWithOffset(uint offset);
87 
90  bool operator< (const ft::KmerClass &k) const;
91  bool operator== (const ft::KmerClass &k) const;
93 
94 private:
99  std::string _kmer;
100  std::bitset<8> _kFlags;
101  std::set<long long> _positions;
102  std::set<ft::ReadID> _readIDs;
103  uint _occ; //from sdsl::count(_index, _kmer)
104  bool _isOffsetAdjusted;
106 
107 };
108 }
109 
110 #endif // KMERCLASS_H
ft::KmerClass
A class that contains information for a single Kmer.
Definition: kmerClass.h:17
ft
This namespace contains all the functions to interact with the search.
Definition: directSearch.h:16
ft::FlagType
FlagType
Definition: ftPropsClass.h:56
ft::ReadID
std::pair< int, int > ReadID
Pair to create a unique Read ID: (Read Number, Read Pair)
Definition: ftPropsClass.h:48
ft::KmerClass::~KmerClass
virtual ~KmerClass()
Class Destructor.
Definition: kmerClass.cpp:167