Skip to content
Browse files

Added a method to read in the non-RLE BWT from a binary bwt file.

  • Loading branch information...
1 parent 737df47 commit 74149fe3cd127ce30719d70b0c4016facd8a0258 @jts committed
View
2 src/SGA/rmdup.cpp
@@ -121,7 +121,7 @@ void rmdup()
delete pBWT;
delete pRBWT;
delete pTimer;
-
+
std::string out_prefix = stripFilename(opt::outFile);
std::string dupsFile = parseDupHits(hitsFilenames, out_prefix);
View
16 src/SuffixTools/BWTReaderBinary.cpp
@@ -35,6 +35,22 @@ void BWTReaderBinary::read(RLBWT* pRLBWT)
//pRLBWT->print();
}
+void BWTReaderBinary::read(SBWT* pSBWT)
+{
+ BWFlag flag;
+ size_t numSymbols;
+ readHeader(pSBWT->m_numStrings, numSymbols, flag);
+ size_t numRead = 0;
+ pSBWT->m_bwStr.resize(numSymbols);
+ while(numRead < numSymbols)
+ {
+ char b = readBWChar();
+ pSBWT->m_bwStr.set(numRead++, b);
+ }
+
+ assert(m_numRunsOnDisk > 0);
+}
+
//
void BWTReaderBinary::readHeader(size_t& num_strings, size_t& num_symbols, BWFlag& flag)
{
View
2 src/SuffixTools/BWTReaderBinary.h
@@ -27,6 +27,8 @@ class BWTReaderBinary : public IBWTReader
//
virtual void read(RLBWT* pRLBWT);
+ virtual void read(SBWT* pSBWT);
+
virtual void readHeader(size_t& num_strings, size_t& num_symbols, BWFlag& flag);
virtual char readBWChar();
virtual void readRuns(RLVector& out, size_t numRuns);
View
5 src/SuffixTools/SBWT.cpp
@@ -9,6 +9,7 @@
#include "SBWT.h"
#include "Timer.h"
#include "BWTReaderAscii.h"
+#include "BWTReaderBinary.h"
#include "BWTWriterAscii.h"
#include <istream>
#include <queue>
@@ -21,7 +22,7 @@
// Parse a BWT from a file
SBWT::SBWT(const std::string& filename, int sampleRate)
{
- BWTReaderAscii reader(filename);
+ BWTReaderBinary reader(filename);
reader.read(this);
initializeFMIndex(sampleRate);
}
@@ -136,5 +137,5 @@ void SBWT::printInfo() const
printf("Sample rate: %zu\n", m_occurrence.getSampleRate());
printf("Memory -- OCC: %zu C: %zu Str: %zu Misc: %zu TOTAL: %zu (%lf MB)\n",
o_size, p_size, bwStr_size, offset_size, total_size, total_mb);
- printf("N: %zu Bytes per suffix: %lf\n", m_bwStr.length(), (double)total_size / m_bwStr.length());
+ printf("N: %zu Bytes per symbol: %lf\n", m_bwStr.length(), (double)total_size / m_bwStr.length());
}
View
3 src/SuffixTools/SBWT.h
@@ -76,7 +76,8 @@ class SBWT
friend class BWTReaderAscii;
friend class BWTWriterAscii;
- static const int DEFAULT_SAMPLE_RATE = 64;
+ static const int DEFAULT_SAMPLE_RATE = 128;
+ static const int DEFAULT_SAMPLE_RATE_SMALL = DEFAULT_SAMPLE_RATE;
private:

0 comments on commit 74149fe

Please sign in to comment.
Something went wrong with that request. Please try again.