Skip to content

Commit f388ead

Browse files
Add parameter --alignment-output-mode, remove alignment mode 5
1 parent ff4c902 commit f388ead

5 files changed

Lines changed: 16 additions & 13 deletions

File tree

src/alignment/Alignment.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Alignment::Alignment(const std::string &querySeqDB, const std::string &targetSeq
2323
covThr(par.covThr), canCovThr(par.covThr), covMode(par.covMode), seqIdMode(par.seqIdMode), evalThr(par.evalThr), seqIdThr(par.seqIdThr),
2424
alnLenThr(par.alnLenThr), includeIdentity(par.includeIdentity), addBacktrace(par.addBacktrace), realign(par.realign), scoreBias(par.scoreBias), realignScoreBias(par.realignScoreBias), realignMaxSeqs(par.realignMaxSeqs),
2525
threads(static_cast<unsigned int>(par.threads)), compressed(par.compressed), outDB(outDB), outDBIndex(outDBIndex),
26-
maxSeqLen(par.maxSeqLen), compBiasCorrection(par.compBiasCorrection), altAlignment(par.altAlignment), maxAccept(static_cast<unsigned int>(par.maxAccept)), maxReject(static_cast<unsigned int>(par.maxRejected)), wrappedScoring(par.wrappedScoring),
26+
maxSeqLen(par.maxSeqLen), compBiasCorrection(par.compBiasCorrection), altAlignment(par.altAlignment), alignmentOutputMode(par.alignmentOutputMode),
27+
maxAccept(static_cast<unsigned int>(par.maxAccept)), maxReject(static_cast<unsigned int>(par.maxRejected)), wrappedScoring(par.wrappedScoring),
2728
lcaAlign(lcaAlign), qdbr(NULL), qDbrIdx(NULL), tdbr(NULL), tDbrIdx(NULL) {
2829
unsigned int alignmentMode = par.alignmentMode;
2930
if (alignmentMode == Parameters::ALIGNMENT_MODE_UNGAPPED) {
@@ -34,11 +35,7 @@ Alignment::Alignment(const std::string &querySeqDB, const std::string &targetSeq
3435
if (addBacktrace == true) {
3536
alignmentMode = Parameters::ALIGNMENT_MODE_SCORE_COV_SEQID;
3637
}
37-
outputClusterFormat = false;
38-
if (par.alignmentMode == Parameters::ALIGNMENT_MODE_CLUSTER) {
39-
alignmentMode = Parameters::ALIGNMENT_MODE_SCORE_ONLY;
40-
outputClusterFormat = true;
41-
}
38+
4239

4340
if (lcaAlign == true) {
4441
lcaSwMode = initSWMode(std::max(alignmentMode, (unsigned int)Parameters::ALIGNMENT_MODE_SCORE_ONLY), 0.0f, 0.0f);
@@ -257,7 +254,7 @@ void Alignment::run() {
257254

258255
void Alignment::run(const std::string &outDB, const std::string &outDBIndex, const size_t dbFrom, const size_t dbSize, bool merge) {
259256
int dbtype = Parameters::DBTYPE_ALIGNMENT_RES;
260-
if(outputClusterFormat){
257+
if(alignmentOutputMode == Parameters::ALIGNMENT_OUTPUT_CLUSTER){
261258
dbtype = Parameters::DBTYPE_CLUSTER_RES;
262259
}
263260
DBWriter dbw(outDB.c_str(), outDBIndex.c_str(), threads, compressed, dbtype);
@@ -506,7 +503,7 @@ void Alignment::run(const std::string &outDB, const std::string &outDBIndex, con
506503

507504
returnRes = &swRealignResults;
508505
}
509-
if(outputClusterFormat) {
506+
if(alignmentOutputMode == Parameters::ALIGNMENT_OUTPUT_CLUSTER) {
510507
for (size_t result = 0; result < returnRes->size(); result++) {
511508
alnResultsOutString.append(SSTR((*returnRes)[result].dbKey));
512509
alnResultsOutString.push_back('\n');

src/alignment/Alignment.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ class Alignment {
8585
int targetSeqType;
8686
bool compBiasCorrection;
8787

88-
bool outputClusterFormat;
89-
9088
int altAlignment;
89+
int alignmentOutputMode;
9190

9291
const unsigned int maxAccept;
9392
const unsigned int maxReject;

src/commons/Parameters.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Parameters::Parameters():
6363
PARAM_SPACED_KMER_PATTERN(PARAM_SPACED_KMER_PATTERN_ID, "--spaced-kmer-pattern", "Spaced k-mer pattern", "User-specified spaced k-mer pattern", typeid(std::string), (void *) &spacedKmerPattern, "^1[01]*1$", MMseqsParameter::COMMAND_PREFILTER | MMseqsParameter::COMMAND_EXPERT),
6464
PARAM_LOCAL_TMP(PARAM_LOCAL_TMP_ID, "--local-tmp", "Local temporary path", "Path where some of the temporary files will be created", typeid(std::string), (void *) &localTmp, "", MMseqsParameter::COMMAND_PREFILTER | MMseqsParameter::COMMAND_EXPERT),
6565
// alignment
66-
PARAM_ALIGNMENT_MODE(PARAM_ALIGNMENT_MODE_ID, "--alignment-mode", "Alignment mode", "How to compute the alignment:\n0: automatic\n1: only score and end_pos\n2: also start_pos and cov\n3: also seq.id\n4: only ungapped alignment\n5: score only (output) cluster format", typeid(int), (void *) &alignmentMode, "^[0-5]{1}$", MMseqsParameter::COMMAND_ALIGN),
66+
PARAM_ALIGNMENT_MODE(PARAM_ALIGNMENT_MODE_ID, "--alignment-mode", "Alignment mode", "How to compute the alignment:\n0: automatic\n1: only score and end_pos\n2: also start_pos and cov\n3: also seq.id\n4: only ungapped alignment", typeid(int), (void *) &alignmentMode, "^[0-5]{1}$", MMseqsParameter::COMMAND_ALIGN),
67+
PARAM_ALIGNMENT_OUTPUT_MODE(PARAM_ALIGNMENT_OUTPUT_MODE_ID, "--alignment-output-mode", "Alignment mode", "How to compute the alignment:\n0: automatic\n1: only score and end_pos\n2: also start_pos and cov\n3: also seq.id\n4: only ungapped alignment\n5: score only (output) cluster format", typeid(int), (void *) &alignmentOutputMode, "^[0-1]{1}$", MMseqsParameter::COMMAND_ALIGN),
6768
PARAM_E(PARAM_E_ID, "-e", "E-value threshold", "List matches below this E-value (range 0.0-inf)", typeid(double), (void *) &evalThr, "^([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)|[0-9]*(\\.[0-9]+)?$", MMseqsParameter::COMMAND_ALIGN),
6869
PARAM_C(PARAM_C_ID, "-c", "Coverage threshold", "List matches above this fraction of aligned (covered) residues (see --cov-mode)", typeid(float), (void *) &covThr, "^0(\\.[0-9]+)?|^1(\\.0+)?$", MMseqsParameter::COMMAND_ALIGN | MMseqsParameter::COMMAND_CLUSTLINEAR),
6970
PARAM_COV_MODE(PARAM_COV_MODE_ID, "--cov-mode", "Coverage mode", "0: coverage of query and target\n1: coverage of target\n2: coverage of query\n3: target seq. length has to be at least x% of query length\n4: query seq. length has to be at least x% of target length\n5: short seq. needs to be at least x% of the other seq. length", typeid(int), (void *) &covMode, "^[0-5]{1}$", MMseqsParameter::COMMAND_ALIGN),
@@ -336,6 +337,7 @@ Parameters::Parameters():
336337
align.push_back(&PARAM_SUB_MAT);
337338
align.push_back(&PARAM_ADD_BACKTRACE);
338339
align.push_back(&PARAM_ALIGNMENT_MODE);
340+
align.push_back(&PARAM_ALIGNMENT_OUTPUT_MODE);
339341
align.push_back(&PARAM_WRAPPED_SCORING);
340342
align.push_back(&PARAM_E);
341343
align.push_back(&PARAM_MIN_SEQ_ID);
@@ -2106,6 +2108,7 @@ void Parameters::setDefaults() {
21062108
spacedKmer = true;
21072109
includeIdentity = false;
21082110
alignmentMode = ALIGNMENT_MODE_FAST_AUTO;
2111+
alignmentOutputMode = ALIGNMENT_OUTPUT_ALIGNMENT;
21092112
evalThr = 0.001;
21102113
covThr = 0.0;
21112114
covMode = COV_MODE_BIDIRECTIONAL;

src/commons/Parameters.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ class Parameters {
106106
static const unsigned int ALIGNMENT_MODE_SCORE_COV = 2;
107107
static const unsigned int ALIGNMENT_MODE_SCORE_COV_SEQID = 3;
108108
static const unsigned int ALIGNMENT_MODE_UNGAPPED = 4;
109-
static const unsigned int ALIGNMENT_MODE_CLUSTER = 5;
109+
110+
static const unsigned int ALIGNMENT_OUTPUT_ALIGNMENT = 0;
111+
static const unsigned int ALIGNMENT_OUTPUT_CLUSTER = 1;
110112

111113
static const unsigned int EXPAND_TRANSFER_EVALUE = 0;
112114
static const unsigned int EXPAND_RESCORE_BACKTRACE = 1;
@@ -384,6 +386,7 @@ class Parameters {
384386
// ALIGNMENT
385387
int alignmentMode; // alignment mode 0=fastest on parameters,
386388
// 1=score only, 2=score, cov, start/end pos, 3=score, cov, start/end pos, seq.id,
389+
int alignmentOutputMode; // alignment output mode 0=alignment, 1=cluster
387390
double evalThr; // e-value threshold for acceptance
388391
float covThr; // coverage query&target threshold for acceptance
389392
int covMode; // coverage target threshold for acceptance
@@ -702,6 +705,7 @@ class Parameters {
702705

703706
// alignment
704707
PARAMETER(PARAM_ALIGNMENT_MODE)
708+
PARAMETER(PARAM_ALIGNMENT_OUTPUT_MODE)
705709
PARAMETER(PARAM_E)
706710
PARAMETER(PARAM_C)
707711
PARAMETER(PARAM_COV_MODE)

src/workflow/Search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ int search(int argc, const char **argv, const Command& command) {
343343
par.rescoreMode = originalRescoreMode;
344344
} else {
345345
cmd.addVariable("ALIGNMENT_PAR", par.createParameterString(par.align).c_str());
346-
par.alignmentMode = Parameters::ALIGNMENT_MODE_CLUSTER;
346+
par.alignmentOutputMode = Parameters::ALIGNMENT_OUTPUT_CLUSTER;
347347
cmd.addVariable("ALIGNMENT_IT_PAR", par.createParameterString(par.align).c_str());
348348
}
349349

0 commit comments

Comments
 (0)