Skip to content

Commit

Permalink
Fix convertalis and alignment normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Aug 29, 2024
1 parent b40729c commit 552e18d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
5 changes: 1 addition & 4 deletions src/strucclustutils/aln2tmscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ int aln2tmscore(int argc, const char **argv, const Command& command) {
float* tdata = tcoords.read(tcadata, targetLen, tCaLength);

// Matching residue index collection
unsigned int normLen = std::min(res.dbLen, res.qLen);
TMaligner::TMscoreResult tmres = tmaln.computeTMscore(tdata, &tdata[targetLen], &tdata[targetLen + targetLen], targetLen,
res.qStartPos, res.dbStartPos, res.backtrace, normLen);
tmres.tmscore = (tmres.tmscore / static_cast<double>(normLen))
* static_cast<double>(res.backtrace.size());
res.qStartPos, res.dbStartPos, res.backtrace, res.backtrace.size());
//std::cout << TMalnScore << std::endl;
resultsStr.append(SSTR(dbKey));
resultsStr.push_back(' ');
Expand Down
5 changes: 1 addition & 4 deletions src/strucclustutils/structurealign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ int structurealign(int argc, const char **argv, const Command& command) {
size_t tCaLength = tcadbr->sequenceReader->getEntryLen(tId);
float* targetCaData = tcoords.read(tcadata, res.dbLen, tCaLength);
if(needTMaligner) {
unsigned int normLen = std::min(res.dbLen, res.qLen);
tmres = tmaligner->computeTMscore(targetCaData,
&targetCaData[res.dbLen],
&targetCaData[res.dbLen +
Expand All @@ -389,9 +388,7 @@ int structurealign(int argc, const char **argv, const Command& command) {
res.qStartPos,
res.dbStartPos,
res.backtrace,
normLen);
tmres.tmscore = (tmres.tmscore / static_cast<double>(normLen))
* static_cast<double>(res.backtrace.size());
res.backtrace.size());
if (tmres.tmscore < par.tmScoreThr) {
continue;
}
Expand Down
23 changes: 13 additions & 10 deletions src/strucclustutils/structureconvertalis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ R"html(<!DOCTYPE html>
Coordinate16 tcoords;

std::string tmpBt;
double rmsd = 0.0;
#pragma omp for schedule(dynamic, 10)
for (size_t i = 0; i < alnDbr.getSize(); i++) {
progress.updateProgress();
Expand Down Expand Up @@ -653,12 +652,7 @@ R"html(<!DOCTYPE html>
}
if(needTMaligner){
tmaligner->initQuery(queryCaData, &queryCaData[res.qLen], &queryCaData[res.qLen+res.qLen], NULL, res.qLen);
unsigned int normlen= std::min(res.qLen, res.dbLen);
tmpBt = Matcher::uncompressAlignment(res.backtrace);
tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, tmpBt,normlen);
tmres.tmscore = tmres.tmscore / normlen;
rmsd = tmres.rmsd;
}
LDDTCalculator::LDDTScoreResult lddtres;
if(needLDDT) {
Expand Down Expand Up @@ -885,16 +879,25 @@ R"html(<!DOCTYPE html>
result.append(SSTR(tmres.t[2]));
break;
case LocalParameters::OUTFMT_ALNTMSCORE:
result.append(SSTR(tmres.tmscore * tmpBt.size()));
tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, tmpBt,
tmpBt.size());
result.append(SSTR(tmres.tmscore));
break;
case LocalParameters::OUTFMT_QTMSCORE:
result.append(SSTR(tmres.tmscore * res.qLen));
tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, tmpBt,res.qLen);
result.append(SSTR(tmres.tmscore));
break;
case LocalParameters::OUTFMT_TTMSCORE:
result.append(SSTR(tmres.tmscore * res.dbLen));
tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, tmpBt, res.dbLen);
result.append(SSTR(tmres.tmscore));
break;
case LocalParameters::OUTFMT_RMSD:
result.append(SSTR(rmsd));
tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, tmpBt, res.dbLen);
result.append(SSTR(tmres.rmsd));
break;
case LocalParameters::OUTFMT_LDDT:
// TODO: make SSTR_approx that outputs %2f, not %3f
Expand Down
5 changes: 1 addition & 4 deletions src/strucclustutils/structurerescorediagonal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,9 @@ int structureungappedalign(int argc, const char **argv, const Command& command)
char *tcadata = tcadbr->sequenceReader->getData(tId, thread_idx);
size_t tCaLength = tcadbr->sequenceReader->getEntryLen(tId);
float* targetCaData = tcoords.read(tcadata, res.dbLen, tCaLength);
unsigned int normLen = std::min(res.dbLen, res.qLen);
TMaligner::TMscoreResult tmres = tmaligner->computeTMscore(targetCaData, &targetCaData[res.dbLen], &targetCaData[res.dbLen+res.dbLen], res.dbLen,
res.qStartPos, res.dbStartPos, Matcher::uncompressAlignment(res.backtrace),
normLen);
tmres.tmscore = (tmres.tmscore / static_cast<double>(normLen))
* static_cast<double>(res.backtrace.size());
res.backtrace.size());
if(tmres.tmscore < par.tmScoreThr){
continue;
}
Expand Down

0 comments on commit 552e18d

Please sign in to comment.