Skip to content

Commit

Permalink
fixed memory leaks and renamed weightThr parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnSeidel committed Nov 15, 2022
1 parent fd1837b commit b36070a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/clustering/Clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Clustering::Clustering(const std::string &seqDB, const std::string &seqDBIndex,
}
seqDbr->sortIndex(localid2weight);
delete[] localid2weight;
delete sequenceWeights;

} else
seqDbr->open(DBReader<unsigned int>::SORT_BY_LENGTH);
Expand Down
2 changes: 1 addition & 1 deletion src/commons/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Parameters::Parameters():
PARAM_ADJUST_KMER_LEN(PARAM_ADJUST_KMER_LEN_ID, "--adjust-kmer-len", "Adjust k-mer length", "Adjust k-mer length based on specificity (only for nucleotides)", typeid(bool), (void *) &adjustKmerLength, "", MMseqsParameter::COMMAND_CLUSTLINEAR | MMseqsParameter::COMMAND_EXPERT),
PARAM_RESULT_DIRECTION(PARAM_RESULT_DIRECTION_ID, "--result-direction", "Result direction", "result is 0: query, 1: target centric", typeid(int), (void *) &resultDirection, "^[0-1]{1}$", MMseqsParameter::COMMAND_CLUSTLINEAR | MMseqsParameter::COMMAND_EXPERT),
PARAM_WEIGHT_FILE(PARAM_WEIGHT_FILE_ID, "--weights", "Weight file name", "Weights used for cluster priorization", typeid(std::string), (void*) &weightFile, "", MMseqsParameter::COMMAND_CLUSTLINEAR | MMseqsParameter::COMMAND_EXPERT ),
PARAM_WEIGHT_THR(PARAM_WEIGHT_THR_ID, "--weightThr", "Weight threshold", "Weight threshold used for cluster priorization", typeid(float), (void*) &weightThr, "^[0-9]*(\\.[0-9]+)?$", MMseqsParameter::COMMAND_CLUSTLINEAR | MMseqsParameter::COMMAND_EXPERT ),
PARAM_WEIGHT_THR(PARAM_WEIGHT_THR_ID, "--cluster-weight-threshold", "Cluster Weight threshold", "Weight threshold used for cluster priorization", typeid(float), (void*) &weightThr, "^[0-9]*(\\.[0-9]+)?$", MMseqsParameter::COMMAND_CLUSTLINEAR | MMseqsParameter::COMMAND_EXPERT ),
// workflow
PARAM_RUNNER(PARAM_RUNNER_ID, "--mpi-runner", "MPI runner", "Use MPI on compute cluster with this MPI command (e.g. \"mpirun -np 42\")", typeid(std::string), (void *) &runner, "", MMseqsParameter::COMMAND_COMMON | MMseqsParameter::COMMAND_EXPERT),
PARAM_REUSELATEST(PARAM_REUSELATEST_ID, "--force-reuse", "Force restart with latest tmp", "Reuse tmp filse in tmp/latest folder ignoring parameters and version changes", typeid(bool), (void *) &reuseLatest, "", MMseqsParameter::COMMAND_COMMON | MMseqsParameter::COMMAND_EXPERT),
Expand Down
4 changes: 4 additions & 0 deletions src/commons/SequenceWeights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ float SequenceWeights::getWeightById(unsigned int id) {
return (pos < indexSize && weightIndex[pos].id == id ) ? weightIndex[pos].weight : std::numeric_limits<float>::min();
}

SequenceWeights::~SequenceWeights() {
delete[] weightIndex;
}

2 changes: 2 additions & 0 deletions src/linclust/kmermatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ KmerPosition<T> * doComputation(size_t totalKmers, size_t hashStartRange, size_t
writePos = assignGroup<Parameters::DBTYPE_AMINO_ACIDS, T>(hashSeqPair, totalKmers, par.includeOnlyExtendable, par.covMode, par.covThr, sequenceWeights, par.weightThr);
}

delete sequenceWeights;

// sort by rep. sequence (stored in kmer) and sequence id
Debug(Debug::INFO) << "Sort by rep. sequence ";
timer.reset();
Expand Down

0 comments on commit b36070a

Please sign in to comment.