From 507d39af15c311f8efcf762a6bc59b5ea1e0d599 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 8 Apr 2021 13:57:53 -0400 Subject: [PATCH] r1013: changed to a more accurate similarity est Based on DOI:10.1101/2021.01.15.426881. One minimap2 reviewer suggested the right formula to me but I thought the difference would be insignificant. I was wrong. --- esterr.c | 2 +- main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esterr.c b/esterr.c index 733c762..7a509da 100644 --- a/esterr.c +++ b/esterr.c @@ -59,6 +59,6 @@ void mm_est_err(const mm_idx_t *mi, int qlen, int n_regs, mm_reg1_t *regs, const n_tot = en - st + 1; if (r->qs > avg_k && r->rs > avg_k) ++n_tot; if (qlen - r->qs > avg_k && l_ref - r->re > avg_k) ++n_tot; - r->div = logf((float)n_tot / n_match) / avg_k; + r->div = n_match >= n_tot? 0.0f : (float)(1.0 - pow((double)n_match / n_tot, 1.0 / avg_k)); } } diff --git a/main.c b/main.c index c727d70..7c9255c 100644 --- a/main.c +++ b/main.c @@ -7,7 +7,7 @@ #include "mmpriv.h" #include "ketopt.h" -#define MM_VERSION "2.17-r1012-dirty" +#define MM_VERSION "2.17-r1013-dirty" #ifdef __linux__ #include