Skip to content

Commit

Permalink
Fix multiline check in createdb to not depend on --dbtype not being set.
Browse files Browse the repository at this point in the history
  • Loading branch information
milot-mirdita committed Mar 7, 2023
1 parent 60b77df commit 6b93884
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/util/createdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,28 +228,29 @@ int createdb(int argc, const char **argv, const Command& command) {
}
sampleCount++;
}
if (par.createdbMode == Parameters::SEQUENCE_SPLIT_MODE_SOFT) {
if (e.newlineCount != 1) {
if (e.newlineCount == 0) {
Debug(Debug::WARNING) << "Fasta entry " << entries_num << " has no newline character\n";
} else if (e.newlineCount > 1) {
Debug(Debug::WARNING) << "Multiline fasta can not be combined with --createdb-mode 0\n";
}
Debug(Debug::WARNING) << "We recompute with --createdb-mode 1\n";
par.createdbMode = Parameters::SEQUENCE_SPLIT_MODE_HARD;
progress.reset(SIZE_MAX);
hdrWriter.close();
seqWriter.close();
delete kseq;
if (fclose(source) != 0) {
Debug(Debug::ERROR) << "Cannot close file " << sourceFile << "\n";
EXIT(EXIT_FAILURE);
}
for (size_t i = 0; i < shuffleSplits; ++i) {
sourceLookup[i].clear();
}
goto redoComputation;
}

if (par.createdbMode == Parameters::SEQUENCE_SPLIT_MODE_SOFT) {
if (e.newlineCount != 1) {
if (e.newlineCount == 0) {
Debug(Debug::WARNING) << "Fasta entry " << entries_num << " has no newline character\n";
} else if (e.newlineCount > 1) {
Debug(Debug::WARNING) << "Multiline fasta can not be combined with --createdb-mode 0\n";
}
Debug(Debug::WARNING) << "We recompute with --createdb-mode 1\n";
par.createdbMode = Parameters::SEQUENCE_SPLIT_MODE_HARD;
progress.reset(SIZE_MAX);
hdrWriter.close();
seqWriter.close();
delete kseq;
if (fclose(source) != 0) {
Debug(Debug::ERROR) << "Cannot close file " << sourceFile << "\n";
EXIT(EXIT_FAILURE);
}
for (size_t i = 0; i < shuffleSplits; ++i) {
sourceLookup[i].clear();
}
goto redoComputation;
}
}

Expand Down

0 comments on commit 6b93884

Please sign in to comment.