Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-steinegger committed Jul 19, 2023
1 parent 4294ca8 commit baea63b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 14 deletions.
1 change: 0 additions & 1 deletion data/structurecluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ buildMergedDb() {
[ "$#" -ne 3 ] && echo "Please provide <sequenceDB> <outDB> <tmp>" && exit 1;
# check if files exist
[ ! -f "$1.dbtype" ] && echo "$1.dbtype not found!" && exit 1;
[ -f "$2.dbtype" ] && echo "$2.dbtype exists already!" && exit 1;
[ ! -d "$3" ] && echo "tmp directory $3 not found!" && mkdir -p "$3";

INPUT="$1"
Expand Down
8 changes: 8 additions & 0 deletions lib/mmseqs/src/prefiltering/QueryMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ size_t QueryMatcher::match(Sequence *seq, float *compositionBias) {
outer:
indexPointer[indexTo + 1] = databaseHits + numMatches;
// fill the output
if((foundDiagonalsSize - overflowHitCount) < 0.1 * foundDiagonalsSize){
foundDiagonalsSize *= 1.5;
foundDiagonals = (CounterResult*) realloc(foundDiagonals, foundDiagonalsSize * sizeof(CounterResult));
if(foundDiagonals == NULL){
Debug(Debug::ERROR) << "Out of memory in QueryMatcher::match\n";
EXIT(EXIT_FAILURE);
}
}
size_t hitCount = findDuplicates(indexPointer, foundDiagonals + overflowHitCount,
foundDiagonalsSize - overflowHitCount, indexStart, indexTo, (diagonalScoring == false));
if (overflowHitCount != 0) {
Expand Down
5 changes: 3 additions & 2 deletions src/commons/TMaligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TMaligner::TMaligner(unsigned int maxSeqLen, bool tmAlignFast, bool tmScoreOnly)
querySecStruc = new char[maxSeqLen];
targetSecStruc = new char[maxSeqLen];
invmap = new int[maxSeqLen];
allocatedLength = maxSeqLen;
}

TMaligner::~TMaligner(){
Expand Down Expand Up @@ -64,7 +65,7 @@ TMaligner::TMscoreResult TMaligner::computeTMscore(float *x, float *y, float *z,
tPos++;
}
}

std::cout << targetLen << std::endl;
memcpy(target_x, x, sizeof(float) * targetLen);
memcpy(target_y, y, sizeof(float) * targetLen);
memcpy(target_z, z, sizeof(float) * targetLen);
Expand Down Expand Up @@ -101,6 +102,7 @@ TMaligner::TMscoreResult TMaligner::computeTMscore(float *x, float *y, float *z,
}

void TMaligner::initQuery(float *x, float *y, float *z, char * querySeq, unsigned int queryLen){
// reallocate memory if necessary
memset(querySecStruc, 0, sizeof(char) * queryLen);
memcpy(query_x, x, sizeof(float) * queryLen);
memcpy(query_y, y, sizeof(float) * queryLen);
Expand All @@ -112,7 +114,6 @@ void TMaligner::initQuery(float *x, float *y, float *z, char * querySeq, unsigne
queryCaCords.y = query_y;
queryCaCords.z = query_z;
make_sec(queryCaCords, queryLen, querySecStruc); // secondary structure assignment

}

Matcher::result_t TMaligner::align(unsigned int dbKey, float *x, float *y, float *z, char * targetSeq, unsigned int targetLen, float &TM1){
Expand Down
1 change: 1 addition & 0 deletions src/commons/TMaligner.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class TMaligner{
bool tmAlignFast;
Coordinates xtm, ytm, xt, r1, r2;
int * invmap;
size_t allocatedLength;
};

#endif //FOLDSEEK_TMALIGNER_H
6 changes: 5 additions & 1 deletion src/strucclustutils/createcomplexreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ int createcomplexreport(int argc, const char **argv, const Command &command) {
IndexReader qDbr(par.db1, par.threads, IndexReader::SRC_SEQUENCES, (touch) ? (IndexReader::PRELOAD_INDEX | IndexReader::PRELOAD_DATA) : 0, dbaccessMode);
IndexReader qDbrHeader(par.db1, par.threads, IndexReader::SRC_HEADERS , (touch) ? (IndexReader::PRELOAD_INDEX | IndexReader::PRELOAD_DATA) : 0);
IndexReader *tDbrHeader;
tDbrHeader = sameDB ? &qDbrHeader : tDbrHeader = new IndexReader(par.db2, par.threads, IndexReader::SRC_HEADERS, (touch) ? (IndexReader::PRELOAD_INDEX | IndexReader::PRELOAD_DATA) : 0);
if(sameDB){
tDbrHeader = &qDbrHeader;
} else{
tDbrHeader = new IndexReader(par.db2, par.threads, IndexReader::SRC_HEADERS, (touch) ? (IndexReader::PRELOAD_INDEX | IndexReader::PRELOAD_DATA) : 0);
}
DBReader<unsigned int> alnDbr(par.db3.c_str(), par.db3Index.c_str(), par.threads, DBReader<unsigned int>::USE_INDEX|DBReader<unsigned int>::USE_DATA);
alnDbr.open(DBReader<unsigned int>::LINEAR_ACCCESS);

Expand Down
27 changes: 17 additions & 10 deletions src/strucclustutils/scorecomplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,26 +558,34 @@ class ComplexScorer {
unsigned int qKey = alnDbr.getId(qChainKey);
if (qKey == NOT_AVAILABLE_CHAIN_KEY)
continue;

char *data = alnDbr.getData(qKey, thread_idx);
if (*data == '\0') continue;
Matcher::result_t qAlnResult = Matcher::parseAlignmentRecord(data);
size_t qId = qCaDbr->sequenceReader->getId(qChainKey);
unsigned int qLen = q3diDbr->sequenceReader->getSeqLen(qId);
char *qCaData = qCaDbr->sequenceReader->getData(qId, thread_idx);
size_t qCaLength = qCaDbr->sequenceReader->getEntryLen(qId);
float *queryCaData = qCoords.read(qCaData, qAlnResult.qLen, qCaLength);
float *queryCaData = qCoords.read(qCaData, qLen, qCaLength);
Chain qChain = Chain(qComplexId, qChainKey);
tmAligner->initQuery(queryCaData, &queryCaData[qAlnResult.qLen], &queryCaData[qAlnResult.qLen * 2], NULL, qAlnResult.qLen);
tmAligner->initQuery(queryCaData, &queryCaData[qLen], &queryCaData[qLen * 2], NULL, qLen);
while (*data != '\0') {
char dbKeyBuffer[255 + 1];
Util::parseKey(data, dbKeyBuffer);
const auto dbKey = (unsigned int) strtoul(dbKeyBuffer, NULL, 10);
const unsigned int dbComplexId = dbChainKeyToComplexIdLookup.at(dbKey);
Matcher::result_t alnResult = Matcher::parseAlignmentRecord(data);
size_t tCaId = tCaDbr->sequenceReader->getId(dbKey);
const unsigned int dbComplexId = dbChainKeyToComplexIdLookup.at(alnResult.dbKey);
size_t tCaId = tCaDbr->sequenceReader->getId(alnResult.dbKey);
char *tCaData = tCaDbr->sequenceReader->getData(tCaId, thread_idx);
size_t tCaLength = tCaDbr->sequenceReader->getEntryLen(tCaId);
float *targetCaData = tCoords.read(tCaData, alnResult.dbLen, tCaLength);
Chain dbChain = Chain(dbComplexId, dbKey);
Chain dbChain = Chain(dbComplexId, alnResult.dbKey);
if(qChainKey == 49 && alnResult.dbKey == 685) {
for(unsigned int i = 0; i < alnResult.qLen; i++) {
std::cout << queryCaData[i] << " " << queryCaData[alnResult.qLen + i] << " " << queryCaData[alnResult.qLen + alnResult.qLen + i] << std::endl;
}
std::cout << std::endl;
for(unsigned int i = 0; i < alnResult.dbLen; i++) {
std::cout << targetCaData[i] << " " << targetCaData[alnResult.dbLen + i] << " " << targetCaData[alnResult.dbLen + alnResult.dbLen + i] << std::endl;
}
std::cout << std::endl;
}
TMaligner::TMscoreResult tmResult = tmAligner->computeTMscore(targetCaData, &targetCaData[alnResult.dbLen], &targetCaData[alnResult.dbLen + alnResult.dbLen], alnResult.dbLen, alnResult.qStartPos, alnResult.dbStartPos, Matcher::uncompressAlignment(alnResult.backtrace), alnResult.alnLength);
ChainToChainAln chainAln(qChain, dbChain, queryCaData, targetCaData, alnResult, tmResult);
parsedAlns.emplace_back(chainAln);
Expand Down Expand Up @@ -772,7 +780,6 @@ int scorecomplex(int argc, const char **argv, const Command &command) {
// for each q complex
for (size_t queryIdx = 0; queryIdx < complexScorer.qComplexIdVec.size(); queryIdx++) {
progress.updateProgress();

unsigned int qComplexId = complexScorer.qComplexIdVec[queryIdx];
std::vector<unsigned int> qChainKeys = complexScorer.getQueryChainKeys(qComplexId);
std::vector<Complex> qComplexes = complexScorer.getQComplexes(qComplexId, qChainKeys);
Expand Down

0 comments on commit baea63b

Please sign in to comment.