Skip to content

Commit

Permalink
infinite loop bug fix scorecomplex
Browse files Browse the repository at this point in the history
  • Loading branch information
Woosub-Kim committed Jan 31, 2024
1 parent 9ca2024 commit 095102f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/strucclustutils/scorecomplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class DBSCANCluster {
std::set<cluster_t> finalClusters;
std::map<unsigned int, float> qBestBitScore;
std::map<unsigned int, float> dbBestBitScore;

unsigned int runDBSCAN() {
initializeAlnLabels();
if (eps > maxDist) return finishDBSCAN();
Expand Down Expand Up @@ -416,10 +417,10 @@ class DBSCANCluster {
distMap.insert({{i,j}, dist});
}
}
// eps = minDist;
// learningRate = (maxDist - minDist) / CLUSTERING_STEPS;
eps = 0.1;
learningRate = 0.1;
eps = minDist;
learningRate = (maxDist - minDist) / CLUSTERING_STEPS;
// eps = 0.1;
// learningRate = 0.1;
}

void getNeighbors(unsigned int centerIdx, std::vector<unsigned int> &neighborVec) {
Expand Down Expand Up @@ -467,14 +468,13 @@ class DBSCANCluster {
unsigned int checkClusteringNecessity() {
if (searchResult.alnVec.empty())
return UNCLUSTERED;

for (size_t alnIdx=0; alnIdx<searchResult.alnVec.size(); alnIdx++) {
neighbors.emplace_back(alnIdx);
}

if (checkChainRedundancy())
if (checkChainRedundancy()) {
fillDistMap();
return runDBSCAN();

}
prevMaxClusterSize = neighbors.size();
finalClusters.insert(neighbors);
return finishDBSCAN();
Expand All @@ -483,15 +483,13 @@ class DBSCANCluster {
unsigned int finishDBSCAN() {
initializeAlnLabels();
if (prevMaxClusterSize < minClusterSize || finalClusters.empty()) return UNCLUSTERED;

cLabel = CLUSTERED;
for (auto &cluster: finalClusters) {
for (auto alnIdx: cluster) {
searchResult.alnVec[alnIdx].label = cLabel;
}
cLabel++;
}

SORT_SERIAL(searchResult.alnVec.begin(), searchResult.alnVec.end(), compareChainToChainAlnByClusterLabel);
return CLUSTERED;
}
Expand Down

0 comments on commit 095102f

Please sign in to comment.