diff --git a/src/commons/LocalParameters.h b/src/commons/LocalParameters.h index c7734b68..bcf92dc2 100644 --- a/src/commons/LocalParameters.h +++ b/src/commons/LocalParameters.h @@ -35,6 +35,7 @@ class LocalParameters : public Parameters { static const int TMSCORE_THRESHOLD_MODE_ALIGNMENT = 0; static const int TMSCORE_THRESHOLD_MODE_QUERY = 1; static const int TMSCORE_THRESHOLD_MODE_TARGET = 2; + static const int TMSCORE_THRESHOLD_MODE_MIN = 3; static const int PREF_MODE_KMER = 0; static const int PREF_MODE_UNGAPPED = 1; diff --git a/src/commons/TMaligner.cpp b/src/commons/TMaligner.cpp index 9e58518c..94a2295f 100644 --- a/src/commons/TMaligner.cpp +++ b/src/commons/TMaligner.cpp @@ -327,12 +327,14 @@ Matcher::result_t TMaligner::align(unsigned int dbKey, float *x, float *y, float } unsigned int TMaligner::normalization(int mode, unsigned int alignmentLen, unsigned int queryLen, unsigned int targetLen) { - if(mode == LocalParameters::TMSCORE_THRESHOLD_MODE_ALIGNMENT){ + if(mode == LocalParameters::TMSCORE_THRESHOLD_MODE_ALIGNMENT) { return alignmentLen; } else if(mode == LocalParameters::TMSCORE_THRESHOLD_MODE_QUERY){ return queryLen; } else if(mode == LocalParameters::TMSCORE_THRESHOLD_MODE_TARGET){ return targetLen; + } else if(mode == LocalParameters::TMSCORE_THRESHOLD_MODE_MIN){ + return std::min(queryLen, targetLen); } return 0; } diff --git a/src/strucclustutils/aln2tmscore.cpp b/src/strucclustutils/aln2tmscore.cpp index 43b6b2ca..73807c2d 100644 --- a/src/strucclustutils/aln2tmscore.cpp +++ b/src/strucclustutils/aln2tmscore.cpp @@ -103,7 +103,7 @@ int aln2tmscore(int argc, const char **argv, const Command& command) { // Matching residue index collection TMaligner::TMscoreResult tmres = tmaln.computeTMscore(tdata, &tdata[targetLen], &tdata[targetLen + targetLen], targetLen, res.qStartPos, res.dbStartPos, res.backtrace, - TMaligner::normalization(par.tmScoreThrMode, res.backtrace.size(), res.qLen, res.dbLen)); + TMaligner::normalization(par.tmScoreThrMode, std::min(res.qEndPos - res.qStartPos, res.dbEndPos - res.dbStartPos ), res.qLen, res.dbLen)); //std::cout << TMalnScore << std::endl; resultsStr.append(SSTR(dbKey)); resultsStr.push_back(' '); @@ -152,4 +152,4 @@ int aln2tmscore(int argc, const char **argv, const Command& command) { } return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/src/strucclustutils/structurealign.cpp b/src/strucclustutils/structurealign.cpp index c059b030..2fb525cd 100644 --- a/src/strucclustutils/structurealign.cpp +++ b/src/strucclustutils/structurealign.cpp @@ -388,7 +388,8 @@ int structurealign(int argc, const char **argv, const Command& command) { res.qStartPos, res.dbStartPos, res.backtrace, - TMaligner::normalization(par.tmScoreThrMode, res.backtrace.size(), res.qLen, res.dbLen)); + TMaligner::normalization(par.tmScoreThrMode, std::min(res.qEndPos - res.qStartPos, res.dbEndPos - res.dbStartPos ), res.qLen, res.dbLen)); + if (tmres.tmscore < par.tmScoreThr) { continue; } diff --git a/src/strucclustutils/structurerescorediagonal.cpp b/src/strucclustutils/structurerescorediagonal.cpp index 434533e6..b7aa43d8 100644 --- a/src/strucclustutils/structurerescorediagonal.cpp +++ b/src/strucclustutils/structurerescorediagonal.cpp @@ -344,7 +344,7 @@ int structureungappedalign(int argc, const char **argv, const Command& command) float* targetCaData = tcoords.read(tcadata, res.dbLen, tCaLength); TMaligner::TMscoreResult tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen, res.qStartPos, res.dbStartPos, Matcher::uncompressAlignment(res.backtrace), - TMaligner::normalization(par.tmScoreThrMode, res.backtrace.size(), res.qLen, res.dbLen)); + TMaligner::normalization(par.tmScoreThrMode, std::min(res.qEndPos - res.qStartPos, res.dbEndPos - res.dbStartPos ), res.qLen, res.dbLen)); if(tmres.tmscore < par.tmScoreThr){ continue; }