Skip to content

Commit

Permalink
Merge pull request #53 from jaebeom-kim/master
Browse files Browse the repository at this point in the history
new parameter: --tie-ratio
  • Loading branch information
jaebeom-kim authored Jan 23, 2024
2 parents 0b60d81 + f2c33e8 commit cdff8d4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/commons/LocalParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ LocalParameters::LocalParameters() :
typeid(int),
(void *) &minSSMatch,
"^[0-9]+$"),
TIE_RATIO(TIE_RATIO_ID,
"--tie-ratio",
"Best * --tie-ratio is considered as a tie",
"Best * --tie-ratio is considered as a tie",
typeid(float),
(void *) &tieRatio,
"^0(\\.[0-9]+)?|1(\\.0+)?$"),
LIBRARY_PATH(LIBRARY_PATH_ID,
"--library-path",
"Path to library where the FASTA files are stored",
Expand Down Expand Up @@ -314,6 +321,7 @@ LocalParameters::LocalParameters() :
classify.push_back(&RAM_USAGE);
classify.push_back(&MATCH_PER_KMER);
classify.push_back(&ACCESSION_LEVEL);
classify.push_back(&TIE_RATIO);
// classify.push_back(&MIN_SS_MATCH);

// filter
Expand Down
2 changes: 2 additions & 0 deletions src/commons/LocalParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class LocalParameters : public Parameters {
PARAMETER(MIN_CONS_CNT_EUK)
PARAMETER(MATCH_PER_KMER)
PARAMETER(MIN_SS_MATCH)
PARAMETER(TIE_RATIO)

// DB build parameters
PARAMETER(LIBRARY_PATH)
Expand Down Expand Up @@ -104,6 +105,7 @@ class LocalParameters : public Parameters {
int minConsCntEuk;
int matchPerKmer;
int minSSMatch;
float tieRatio;

// Database creation
std::string tinfoPath;
Expand Down
5 changes: 3 additions & 2 deletions src/commons/Taxonomer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Taxonomer::Taxonomer(const LocalParameters &par, NcbiTaxonomy *taxonomy) : taxon
minConsCnt = par.minConsCnt;
minConsCntEuk = par.minConsCntEuk;
eukaryotaTaxId = par.eukaryotaTaxId;
tieRatio = par.tieRatio;

if (par.seqMode == 1 || par.seqMode == 2) {
denominator = 100;
Expand Down Expand Up @@ -300,7 +301,7 @@ TaxonScore Taxonomer::getBestSpeciesMatches(vector<Match> & speciesMatches,

vector<TaxID> maxSpecies;
for (auto & spScore : species2score) {
if (spScore.second > bestSpScore * 0.95) {
if (spScore.second >= bestSpScore * tieRatio) {
maxSpecies.push_back(spScore.first);
}
}
Expand Down Expand Up @@ -397,7 +398,7 @@ TaxonScore Taxonomer::getBestSpeciesMatches(vector<Match> & speciesMatches,
}
vector<TaxID> maxSpecies;
for (auto & spScore : species2score) {
if (spScore.second > bestSpScore * 0.95) {
if (spScore.second >= bestSpScore * tieRatio) {
maxSpecies.push_back(spScore.first);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/commons/Taxonomer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Taxonomer {
int minConsCnt;
int minConsCntEuk;
int eukaryotaTaxId;
float tieRatio;

// Internal
int denominator;
Expand Down
1 change: 1 addition & 0 deletions src/workflow/classify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void setClassifyDefaults(LocalParameters & par){
par.maskProb = 0.9;
par.matchPerKmer = 4;
par.accessionLevel = 0;
par.tieRatio = 0.95;
}

int classify(int argc, const char **argv, const Command& command)
Expand Down

0 comments on commit cdff8d4

Please sign in to comment.