X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=PairedEndRead.h;h=01d3d007a36669ac4292b777f97132ae9c747012;hp=6504e610141e9db33d027bdb47cff33fb2af95a9;hb=da57529b92adbb7ae74a89861cb39fb35ac7c62d;hpb=946f9a6adb2a82048c8453d44693cd3838d32939 diff --git a/PairedEndRead.h b/PairedEndRead.h index 6504e61..01d3d00 100644 --- a/PairedEndRead.h +++ b/PairedEndRead.h @@ -9,30 +9,28 @@ #include "SingleRead.h" class PairedEndRead : public Read { - public: - PairedEndRead() : mate1(), mate2() {} - PairedEndRead(const SingleRead& mate1, const SingleRead& mate2) { - this->mate1 = mate1; - this->mate2 = mate2; - this->name = mate1.getName(); - - calc_lq(); - } - - bool read(int argc, std::istream* argv[], int flags = 7); - void write(int argc, std::ostream* argv[]); - - const SingleRead& getMate1() const { return mate1; } - const SingleRead& getMate2() const { return mate2; } - const SingleRead& getMate(int i) const { - if (i == 1) return mate1; - else return mate2; - } - - private: - SingleRead mate1, mate2; - - void calc_lq(); +public: + PairedEndRead() : mate1(), mate2() {} + PairedEndRead(const SingleRead& mate1, const SingleRead& mate2) { + this->mate1 = mate1; + this->mate2 = mate2; + this->name = mate1.getName(); + } + + bool read(int argc, std::istream* argv[], int flags = 7); + void write(int argc, std::ostream* argv[]); + + const SingleRead& getMate1() const { return mate1; } + const SingleRead& getMate2() const { return mate2; } + const SingleRead& getMate(int i) const { + if (i == 1) return mate1; + else return mate2; + } + + void calc_lq(bool, int); // calculate if this read is low quality. Without calling this function, isLowQuality() will always be false + +private: + SingleRead mate1, mate2; }; bool PairedEndRead::read(int argc, std::istream* argv[], int flags) { @@ -45,8 +43,6 @@ bool PairedEndRead::read(int argc, std::istream* argv[], int flags) { name = ""; if (flags & 4) { name = mate1.getName(); } //May chop 1 char later if we want - if (flags & 1) calc_lq(); - return success; } @@ -59,9 +55,13 @@ void PairedEndRead::write(int argc, std::ostream *argv[]) { mate2.write(1, outMate2); } -void PairedEndRead::calc_lq() { - low_quality = mate1.isLowQuality() && mate2.isLowQuality(); - if (mate1.getReadLength() < OLEN || mate2.getReadLength() < OLEN) low_quality = true; +//calculate if this read is low quality +void PairedEndRead::calc_lq(bool hasPolyA, int seedLen) { + low_quality = false; + mate1.calc_lq(hasPolyA, seedLen); + mate2.calc_lq(hasPolyA, seedLen); + if (mate1.getReadLength() < seedLen || mate2.getReadLength() < seedLen) low_quality = true; + else low_quality = mate1.isLowQuality() && mate2.isLowQuality(); } #endif