Skip to content

Commit 04f2dd4

Browse files
authored
Removed deadlock in the -multisample-fasta mode.
1 parent 1d60933 commit 04f2dd4

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ Parameters:
148148
* `common_table` (output) - file containing table with common k-mer counts.
149149
* `-multisample-fasta` / `-from-kmers` / `-from-minhash` - see `build` mode for details.
150150
* `-sparse` - stores output matrix in a sparse form,
151+
* `-above <a_th>` - retains elements larger then <a_th>,
152+
* `-below <b_th>` - retains elements smaller then <b_th>,
151153
* `-t <threads>` - number of threads (default: number of available cores).
152154
153155
### Single sample against the database:

src/input_file.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ bool GenomeInputFile::loadNext(
189189
std::string& sampleName
190190
) {
191191

192-
// no more sequences in multifasta
193-
if (multifastaIndex == chromosomes.size()) {
194-
return false;
195-
}
196-
197192
std::shared_ptr<MinHashFilter> minhashFilter = dynamic_pointer_cast<MinHashFilter>(filter);
198193

199194
if (!minhashFilter) {
@@ -219,7 +214,8 @@ bool GenomeInputFile::loadNext(
219214

220215
++multifastaIndex;
221216

222-
return true;
217+
// no more sequences in multifasta
218+
return multifastaIndex < chromosomes.size();
223219
}
224220

225221

src/loader_ex.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,12 @@ void LoaderEx::multifastaReaderJob() {
191191
// initialize multifasta file
192192
if (genomicFile->initMultiFasta()) {
193193

194-
LOG_DEBUG << "multifasta initialized " << endl ;
194+
LOG_DEBUG << "multifasta initialized: " << inputTask->fileId + 1 << endl ;
195195

196196
while (true) {
197-
197+
LOG_DEBUG << "wait for buf for sample " << sample_id + 1 << endl;
198198
this->queues.freeBuffers.Pop(bufferId); // wait for free buffer
199+
LOG_DEBUG << "acquired buf " << bufferId << " for sample " << sample_id + 1 << endl;
199200

200201
auto sampleTask = make_shared<SampleTask>(
201202
sample_id,
@@ -207,17 +208,17 @@ void LoaderEx::multifastaReaderJob() {
207208
kmersCollections[bufferId], positionsCollections[bufferId],
208209
sampleTask->kmers, sampleTask->kmersCount, sampleTask->kmerLength, sampleTask->fraction, sampleTask->sampleName);
209210

210-
// no more samples
211-
if (!ok) {
212-
break;
213-
}
214-
215211
++sample_id;
216212
++bufferRefCounters[bufferId];
217213
queues.output.Push((int)sampleTask->id, sampleTask);
218214
++count;
219215

220-
LOG_DEBUG << "(sample " << sampleTask->id + 1 << ") -> output queue, buf: " << bufferId << std::endl ;
216+
LOG_DEBUG << "(sample " << sampleTask->id + 1 << ") -> output queue, buf: " << bufferId << std::endl;
217+
218+
// no more samples
219+
if (!ok) {
220+
break;
221+
}
221222
}
222223
}
223224

src/version.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#pragma once
22

3-
#define VERSION "1.11.0"
4-
#define DATE "27.02.2023"
3+
#define VERSION "1.11.1"
4+
#define DATE "07.03.2023"
55

66
/*
77
88
Version history
99
10+
1.11.1 (07.03.2023)
11+
- Removed deadlock in the -multisample-fasta mode.
12+
1013
1.11.0 (27.02.2023)
1114
- Added -below and -above thresholds for all2all and new2all modes.
1215

0 commit comments

Comments
 (0)