Skip to content

Commit

Permalink
Fixed a bug in detection of clustering mode. Fixed a numerical-underf…
Browse files Browse the repository at this point in the history
…low (and numerical-overflow) error.
  • Loading branch information
zhaoxiaofei committed Jun 18, 2018
1 parent 65df81d commit b2d318c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/bindash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ int cmddist_filter(double &mutdist, double &pvalue,
pvalue = 1.0;
}
if (pvalue > args2.pthres) { return 2; }
// fprintf(stderr, "bhmath_pbinom_tail(%u, %u, %.4e) == %.4e\n", intersize, args1.sketchsize64 * NBITS(uint64_t), p, pvalue);

return 0;
}
Expand Down Expand Up @@ -509,7 +508,7 @@ int main(int argc, char **argv) {
cmddist<false, false>(entities1, entities2, args1, args);
}
#else
cmddist(tCLUSTER, tNNEIGHBORS, entities1, entities1, args1, args);
cmddist(tCLUSTER, tNNEIGHBORS, entities1, (tCLUSTER ? entities1 : entities2), args1, args);
#endif
} else {
std::cerr << "Unrecognized command: " << argv[1] << "\n";
Expand Down
7 changes: 6 additions & 1 deletion src/genome.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void print_entity(const Entity &entity) {
for (auto u : entity.usigs) {
std::cerr << "\t" << u;
}

std::cerr << "\t" << entity.matchprob << "\n";
}

Expand All @@ -96,7 +97,11 @@ void Entity::write(std::ofstream &binfile, std::ofstream &txtfile) {
// std::cerr << "\t" << std::hex << usig; if (i % 4 == 0) {std::cerr << std::endl;}; i++;
binfile.write((char*)&usig, sizeof(uint64_t));
}
txtfile << name << "\t" << std::scientific << matchprob << "\t";
double matchprob2 = matchprob;
if (matchprob2 < DBL_EPSILON) { matchprob2 = DBL_EPSILON; }
if (matchprob2 > 1.0 - DBL_EPSILON) { matchprob2 = 1.0 - DBL_EPSILON; }

txtfile << name << "\t" << std::scientific << matchprob2 << "\t";
txtfile << usigs.size() << "\n";
}

Expand Down

0 comments on commit b2d318c

Please sign in to comment.