further mapq tuning

This commit is contained in:
Heng Li 2017-09-14 10:46:14 -04:00
parent f4a8766283
commit 47e9d76ca1
2 changed files with 5 additions and 6 deletions

9
hit.c
View File

@ -299,14 +299,13 @@ void mm_set_mapq(int n_regs, mm_reg1_t *regs, int min_chain_sc, int n_rep_mini)
r->mapq = 0;
} else if (r->parent == r->id) {
int mapq, subsc;
float pen_cm = 1.0f;
if (r->cnt < 10)
pen_cm = 0.1f * r->cnt * (r->cnt > n_rep_mini? 1.0f : (1.0f + r->cnt) / (1.0f + n_rep_mini));
float pen_s1 = r->score > 100? 1.0f : 0.01f * r->score;
float pen_cm = r->cnt > 10? 1.0f : 0.1f * r->cnt;
pen_cm = pen_s1 < pen_cm? pen_s1 : pen_cm;
subsc = r->subsc > min_chain_sc? r->subsc : min_chain_sc;
if (r->p && r->p->dp_max2 > 0 && r->p->dp_max > 0) {
float identity = (float)(r->p->blen - r->p->n_diff - r->p->n_ambi) / (r->p->blen - r->p->n_ambi);
float chain_ratio = subsc > r->score? (float)subsc / r->score : 1.0f;
mapq = (int)(identity * pen_cm * q_coef * (1. - (float)chain_ratio * r->p->dp_max2 / r->p->dp_max) * logf(r->score));
mapq = (int)(identity * pen_cm * q_coef * (1. - (float)r->p->dp_max2 * subsc / r->p->dp_max / r->score) * logf(r->score));
} else mapq = (int)(pen_cm * q_coef * (1. - (float)subsc / r->score) * logf(r->score));
mapq -= (int)(4.343 * log(r->n_sub + 1) + .499);
mapq = mapq > 0? mapq : 0;

2
main.c
View File

@ -6,7 +6,7 @@
#include "mmpriv.h"
#include "getopt.h"
#define MM_VERSION "2.1.1-r362-dirty"
#define MM_VERSION "2.1.1-r363-dirty"
#ifdef __linux__
#include <sys/resource.h>