OpenFlexTyper
indexPropsClass.h
1 #ifndef INDEXPROPSCLASS_H
2 #define INDEXPROPSCLASS_H
3 #include <set>
4 #include <iostream>
5 #include <fstream>
6 #include <map>
7 #include <experimental/filesystem>
8 #include <QSettings>
9 
10 namespace fs = std::experimental::filesystem;
11 
12 
13 namespace algo {
15 enum FileType {FQ = 1, FA, GZ};
16 
21 
23 {
24 public:
26  IndexProps();
27  IndexProps(bool verbose);
28 
30  virtual ~IndexProps();
31 
35  std::string createBash();
36 
37  void printToStdOut(std::string) const;
38 
44  uint getNumOfIndexes() const;
45  uint getNumOfReads() const;
46  uint getReadLength() const;
47 
48  bool getDelFQFlag() const;
49  bool getDelFastaFlag() const;
50  bool getRevCompFlag() const;
51  bool getPairedReadsFlag() const;
52 
53  const std::string& getReadSetName() const;
54  const std::string& getIndexName() const;
55  const algo::FileType& getReadFileType() const;
57 
62  void setNumOfIndexes(uint numIndexes);
63  void setNumOfReads(uint numOfReads);
64  void setReadLength(uint readLength);
65 
66  void setDelFQFlag(bool delFQFlag);
67  void setDelFastaFlag(bool delFastaFlag);
68  void setRevCompFlag(bool revCompFlag);
69  void setPairedReadsFlag(bool pairedReads);
70  void setVerboseFlag(bool verbose);
71  void setReadSetName(const std::string readSetName);
72  void setReadFileType(const algo::FileType& readFileType);
74 
80  const fs::path& getR1() const;
81  const fs::path& getR2() const;
82 
83  const fs::path& getBuildDir() const;
84  const fs::path& getOutputFolder() const;
85  const fs::path& getppfFolder() const;
86 
87  const std::map<fs::path, std::pair<u_int, u_int>>& getPreProcessedFastas() const;
88  const std::map<fs::path, uint>& getIndexSet() const;
90 
95  bool setR1(const fs::path& r1);
96  bool setR2(const fs::path& r2);
97 
98  void setBuildDir(const fs::path& buildDir);
99  void setIndexName(const std::string indexName);
100  void setOutputFolder(const fs::path& outputFolder);
101  void setppfFolder(const fs::path& ppfFolder);
103 
108  bool delR1();
109  bool delR2();
110 
111  void delFQ();
112  void delReadFastas();
113  void delSpecificReadFasta(const fs::path& _preProcessedFasta);
115 
120  void setPreProcessedFastas(std::map<fs::path, std::pair<u_int, u_int>>& _ppFSet);
121  void addPPF(fs::path _ppf, uint start, uint end);
122  void setIndexSet(std::map<fs::path, uint>& indexes);
123  void addToIndexSet(fs::path index, uint offset);
124  void createPPFSet();
126 
130  void countNumOfReads();
131  void countReadLength(fs::path readFile);
132 
133  void saveIndexProps(const fs::path& indexPropsFile) const;
134  void loadFromIni(const fs::path inifile);
135  u_int getOffsetForIndex(fs::path indexFile);
137 
138 private:
143  fs::path _R1;
144  fs::path _R2;
145 
146  std::map<fs::path, std::pair<u_int, u_int>> _ppFSet;
147  std::map<fs::path, uint> _indexSet;
148 
149  fs::path _outputFolder;
150  fs::path _ppfFolder;
151  fs::path _buildDir;
152 
153  uint _numOfReads;
154  uint _readLength;
155  uint _numOfIndexes = 1;
156 
157  bool _revComp = 0;
158  bool _pairedReads = 0;
159  bool _delFQ = 0;
160  bool _delFasta= 0;
161 
162  bool _verbose = 0;
163 
164  std::string _readSetName;
165  std::string _indexName = "Index";
166  algo::FileType _readFileType;
167 
168  u_int countLines(fs::path fileToCount);
170 };
171 
172 
173 }
174 #endif // INDEXPROPSCLASS_H
algo::IndexProps::IndexProps
IndexProps()
Constructor.
Definition: indexPropsClass.cpp:9
algo::IndexProps::_ppfFolder
fs::path _ppfFolder
where to save the pre processed fast files
Definition: indexPropsClass.h:150
algo::IndexProps::~IndexProps
virtual ~IndexProps()
Destructor.
Definition: indexPropsClass.cpp:392
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::IndexProps::_ppFSet
std::map< fs::path, std::pair< u_int, u_int > > _ppFSet
this is the set of pre process fasta files, plus start, end read numbers created by preprocess....
Definition: indexPropsClass.h:146
algo::IndexProps::_outputFolder
fs::path _outputFolder
where to save the indexes and ini file
Definition: indexPropsClass.h:149
algo::IndexProps::_indexSet
std::map< fs::path, uint > _indexSet
this is the set of generated index files and their offsets
Definition: indexPropsClass.h:147