From 421a324725165d39ec17f5d55438500ea1cb9457 Mon Sep 17 00:00:00 2001 From: Giulio Formenti Date: Mon, 25 Nov 2024 12:50:01 -0500 Subject: [PATCH] do not keep reads if they are not printed --- src/reads.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reads.cpp b/src/reads.cpp index 866f49b..0a4f69a 100644 --- a/src/reads.cpp +++ b/src/reads.cpp @@ -178,7 +178,7 @@ void InReads::load() { StreamObj streamObj; stream = streamObj.openStream(userInput, 'r', i); - Sequences* readBatch = new Sequences; + //Sequences* readBatch = new Sequences; while (getline(*stream, newLine)) { @@ -247,22 +247,24 @@ bool InReads::traverseInReads(Sequences* readBatch) { // traverse the read if (read->inSequenceQuality != NULL) batchAvgQualities.push_back(read->avgQuality); - inReadsBatch.push_back(read); + if (userInput.outFiles.size()) + inReadsBatch.push_back(read); + else + delete read; } std::unique_lock lck(mtx); - readBatches.emplace_back(inReadsBatch,readBatch->batchN); delete readBatch; readLens.insert(std::end(readLens), std::begin(readLensBatch), std::end(readLensBatch)); avgQualities.insert(std::end(avgQualities), std::begin(batchAvgQualities), std::end(batchAvgQualities)); - totReads += inReadsBatch.size(); totA+=batchA; totT+=batchT; totC+=batchC; totG+=batchG; totN+=batchN; + totReads += readN; logs.push_back(threadLog); return true;