X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ReadReader.h;h=d244efa4236807871dcdda49c4b1f942d224f3ef;hb=4c51136f0b5ae7758258642e1183de5bfb4624af;hp=f1bd1f59a8395c5938a034199e7cd48b70d6a9fb;hpb=a95154919f950f86de9104b2b9dcf1f0c7e83387;p=rsem.git diff --git a/ReadReader.h b/ReadReader.h index f1bd1f5..d244efa 100644 --- a/ReadReader.h +++ b/ReadReader.h @@ -19,8 +19,8 @@ template class ReadReader { public: - ReadReader() { s = 0; indices = NULL; arr = NULL; } - ReadReader(int s, char readFs[][STRLEN]); + ReadReader() { s = 0; indices = NULL; arr = NULL; hasPolyA = false; seedLen = -1; } + ReadReader(int s, char readFs[][STRLEN], bool hasPolyA = false, int seedLen = -1); ~ReadReader(); void setIndices(ReadIndex** indices) { @@ -31,7 +31,9 @@ public: void reset(); bool next(ReadType& read, int flags = 7) { - return read.read(s, (std::istream**)arr, flags); + bool success = read.read(s, (std::istream**)arr, flags); + if (success && seedLen > 0) { read.calc_lq(hasPolyA, seedLen); } + return success; } private: @@ -39,10 +41,13 @@ private: ReadIndex **indices; std::ifstream** arr; std::streampos *locations; + + bool hasPolyA; + int seedLen; }; template -ReadReader::ReadReader(int s, char readFs[][STRLEN]) { +ReadReader::ReadReader(int s, char readFs[][STRLEN], bool hasPolyA, int seedLen) { assert(s > 0); this->s = s; arr = new std::ifstream*[s]; @@ -53,6 +58,8 @@ ReadReader::ReadReader(int s, char readFs[][STRLEN]) { if (!arr[i]->is_open()) { fprintf(stderr, "Cannot open %s! It may not exist.\n", readFs[i]); exit(-1); } locations[i] = arr[i]->tellg(); } + this->hasPolyA = hasPolyA; + this->seedLen = seedLen; } template