Skip to content

Commit

Permalink
change names for tm based rbh filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Woosub-Kim committed Feb 25, 2024
1 parent 405e64c commit d785457
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
6 changes: 2 additions & 4 deletions src/strucclustutils/createcomplexreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ const double MAX_ASSIGNED_CHAIN_RATIO = 1.0;
const double TOO_SMALL_MEAN = 1.0;
const double TOO_SMALL_CV = 0.1;
const double FILTERED_OUT = 0.0;
//const bool UNCLUSTERED = false;
//const bool CLUSTERED = true;
const unsigned int INITIALIZED_LABEL = 0;
const unsigned int MIN_PTS = 2;
const float DEFAULT_EPS = 0.1;
const float LEARNING_RATE = 0.1;
const float BIT_SCORE_MARGIN = 0.7;
const float DEF_BIT_SCORE = -1.0;
const float TM_SCORE_MARGIN = 0.5;
const float DEF_TM_SCORE = -1.0;
const int UNINITIALIZED = 0;
const unsigned int MULTIPLE_CHAINED_COMPLEX = 2;
typedef std::pair<std::string, std::string> compNameChainName_t;
Expand Down
36 changes: 16 additions & 20 deletions src/strucclustutils/scorecomplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ struct Chain {

struct ChainToChainAln {
ChainToChainAln() {}
// ChainToChainAln(Chain &queryChain, Chain &targetChain, float *qCaData, float *dbCaData, Matcher::result_t &alnResult, TMaligner::TMscoreResult &tmResult) : qChain(queryChain), dbChain(targetChain), bitScore((float)alnResult.score) {
ChainToChainAln(Chain &queryChain, Chain &targetChain, float *qCaData, float *dbCaData, Matcher::result_t &alnResult, TMaligner::TMscoreResult &tmResult) : qChain(queryChain), dbChain(targetChain), bitScore((float)tmResult.tmscore) {
ChainToChainAln(Chain &queryChain, Chain &targetChain, float *qCaData, float *dbCaData, Matcher::result_t &alnResult, TMaligner::TMscoreResult &tmResult) : qChain(queryChain), dbChain(targetChain), tmScore((float)tmResult.tmscore) {
alnLength = alnResult.alnLength;
matches = 0;
unsigned int qPos = alnResult.qStartPos;
Expand Down Expand Up @@ -83,7 +82,7 @@ struct ChainToChainAln {
resultToWrite_t resultToWrite;
double superposition[12];
unsigned int label;
float bitScore;
float tmScore;

float getDistance(const ChainToChainAln &o) {
float dist = 0;
Expand Down Expand Up @@ -337,8 +336,8 @@ class DBSCANCluster {
distMap_t distMap;
std::vector<cluster_t> currClusters;
std::set<cluster_t> &finalClusters;
std::map<unsigned int, float> qBestBitScore;
std::map<unsigned int, float> dbBestBitScore;
std::map<unsigned int, float> qBestTmScore;
std::map<unsigned int, float> dbBestTmScore;

bool runDBSCAN() {
initializeAlnLabels();
Expand Down Expand Up @@ -489,39 +488,36 @@ class DBSCANCluster {

void filterAlnsByRBH() {
unsigned int alnIdx = 0;
float bitScore;
float tmScore;
unsigned int qKey;
unsigned int dbKey;
qBestBitScore.clear();
dbBestBitScore.clear();
qBestTmScore.clear();
dbBestTmScore.clear();
for (auto qChainKey: searchResult.qChainKeys) {
qBestBitScore.insert({qChainKey, DEF_BIT_SCORE});
qBestTmScore.insert({qChainKey, DEF_TM_SCORE});
}

for (auto dbChainKey: searchResult.dbChainKeys) {
dbBestBitScore.insert({dbChainKey, DEF_BIT_SCORE});
dbBestTmScore.insert({dbChainKey, DEF_TM_SCORE});
}

for (auto &aln: searchResult.alnVec) {
qKey = aln.qChain.chainKey;
dbKey = aln.dbChain.chainKey;
bitScore = aln.bitScore;
qBestBitScore[qKey] = qBestBitScore[qKey]<UNINITIALIZED ? bitScore : std::max(bitScore, qBestBitScore[qKey]);
dbBestBitScore[dbKey] = dbBestBitScore[dbKey]<UNINITIALIZED ? bitScore : std::max(bitScore, dbBestBitScore[dbKey]);
tmScore = aln.tmScore;
qBestTmScore[qKey] = qBestTmScore[qKey] < UNINITIALIZED ? tmScore : std::max(tmScore, qBestTmScore[qKey]);
dbBestTmScore[dbKey] = dbBestTmScore[dbKey] < UNINITIALIZED ? tmScore : std::max(tmScore, dbBestTmScore[dbKey]);
}

while (alnIdx < searchResult.alnVec.size()) {
qKey = searchResult.alnVec[alnIdx].qChain.chainKey;
dbKey = searchResult.alnVec[alnIdx].dbChain.chainKey;
bitScore = searchResult.alnVec[alnIdx].bitScore;
if (bitScore >= std::max(qBestBitScore[qKey], dbBestBitScore[dbKey]) * BIT_SCORE_MARGIN) {
tmScore = searchResult.alnVec[alnIdx].tmScore;
if (tmScore >= std::max(qBestTmScore[qKey], dbBestTmScore[dbKey]) * TM_SCORE_MARGIN) {
alnIdx ++;
continue;
}
searchResult.alnVec.erase(searchResult.alnVec.begin() + alnIdx);
}
qBestBitScore.clear();
dbBestBitScore.clear();
qBestTmScore.clear();
dbBestTmScore.clear();
// return;
}

Expand Down

0 comments on commit d785457

Please sign in to comment.