OpenFlexTyper
fmindex.h
1 #ifndef __FM_INDEX_H__
2 #define __FM_INDEX_H__
3 #include <time.h>
4 #include <future>
5 #include <chrono>
6 #include <fstream>
7 #include <vector>
8 #include <iostream>
9 #include "ifmindex.h"
10 #include <sdsl/suffix_arrays.hpp>
11 #include <mutex>
12 #include "indexPropsClass.h"
13 
18 namespace algo {
19 
24 class FmIndex : public IFmIndex {
25 
26 public:
27 
29  FmIndex();
30  FmIndex(bool verbose);
31 
33  virtual ~FmIndex();
34 
42  std::pair<fs::path, fs::path> createFMIndex(const algo::IndexProps& _props, const fs::path& preprocessedFasta);
43 
48  void loadIndexFromFile(const fs::path& indexname);
49 
56  ft::KmerClass search(const std::string& kmer,
57  u_int maxOcc = 200
58  );
59 
61 
65  void parallelFmIndex(algo::IndexProps& _props);
66 
67 
68  int indexCount();
69 
70 private:
71 
72  FmIndex(const FmIndex& other);
73  const FmIndex& operator=(const FmIndex& other);
74 
75  bool _verbose = 0;
76 
85  csa_wt<wt_huff<rrr_vector<256>>, 512, 1024> _index;
86  long long *_indexPosition;
87 
91  std::mutex _mtx;
92 
96  size_t _kmerMapSize;
97 };
98 }
99 
100 #endif // end of __FM_INDEX_H__
algo::FmIndex::FmIndex
FmIndex()
Constructor.
Definition: fmindex.cpp:12
algo::FmIndex::loadIndexFromFile
void loadIndexFromFile(const fs::path &indexname)
loadIndexFromFile
Definition: fmindex.cpp:115
ft::KmerClass
A class that contains information for a single Kmer.
Definition: kmerClass.h:17
algo::FmIndex::createFMIndex
std::pair< fs::path, fs::path > createFMIndex(const algo::IndexProps &_props, const fs::path &preprocessedFasta)
Main function to generate the fm index files Generate the FmIndex for a preprocessed Fasta File.
Definition: fmindex.cpp:57
algo::FmIndex::search
ft::KmerClass search(const std::string &kmer, u_int maxOcc=200)
search within an index file for a kmer
Definition: fmindex.cpp:20
algo::FmIndex::_mtx
std::mutex _mtx
mutex
Definition: fmindex.h:91
algo::FmIndex::_kmerMapSize
size_t _kmerMapSize
_kmerMapSize
Definition: fmindex.h:96
algo::FmIndex::_index
csa_wt< wt_huff< rrr_vector< 256 > >, 512, 1024 > _index
This is the structure of our FmIndex. csa : compressed suffix array wt_huff : wavelet tree huffman rr...
Definition: fmindex.h:85
algo::FmIndex::parallelFmIndex
void parallelFmIndex(algo::IndexProps &_props)
parallel FM Index creation
Definition: fmindex.cpp:131
algo::FmIndex::~FmIndex
virtual ~FmIndex()
Destructor.
Definition: fmindex.cpp:170
algo::IndexProps
A class that contains all the properties for an FmIndex.
Definition: indexPropsClass.h:23
algo
This contains the functions used to interact with the FM index.
Definition: tst_indexPropsClass.cpp:6
algo::FmIndex
A class that contains all the functions for use with an FmIndex.
Definition: fmindex.h:24