1 #ifndef PAIREDENDREADQ_H_
2 #define PAIREDENDREADQ_H_
9 #include "SingleReadQ.h"
11 class PairedEndReadQ : public Read {
13 PairedEndReadQ() : mate1(), mate2() {}
14 PairedEndReadQ(const SingleReadQ& mate1, const SingleReadQ& mate2) {
17 this->name = mate1.getName();
22 bool read(int argc, std::istream* argv[], int flags = 7);
23 void write(int argc, std::ostream* argv[]);
25 const SingleReadQ& getMate1() const { return mate1; }
26 const SingleReadQ& getMate2() const { return mate2; }
27 const SingleReadQ& getMate(int i) const {
28 if (i == 1) return mate1;
33 SingleReadQ mate1, mate2;
38 bool PairedEndReadQ::read(int argc, std::istream* argv[], int flags) {
40 std::istream *inpMate1[1], *inpMate2[1];
43 inpMate1[0] = argv[0]; inpMate2[0] = argv[1];
44 success = mate1.read(1, inpMate1, flags) && mate2.read(1, inpMate2, flags);
46 if (flags & 4) { name = mate1.getName(); } //May chop 1 char later if we want
48 if (flags & 1) calc_lq();
53 void PairedEndReadQ::write(int argc, std::ostream* argv[]) {
54 std::ostream *outMate1[1], *outMate2[1];
57 outMate1[0] = argv[0]; outMate2[0] = argv[1];
58 mate1.write(1, outMate1);
59 mate2.write(1, outMate2);
62 void PairedEndReadQ::calc_lq() {
63 low_quality = mate1.isLowQuality() && mate2.isLowQuality();
64 if (mate1.getReadLength() < OLEN || mate2.getReadLength() < OLEN) low_quality = true;
67 #endif /* PAIREDENDREADQ_H_ */