From 858213d513a9279364b8b6cfc87f233f6a888b85 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Thu, 12 Oct 2017 23:02:18 -0400 Subject: [PATCH] r511: fixed wrong primary sam record --- main.c | 2 +- map.c | 2 +- pe.c | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index d1619b7..316c9ce 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ #include "mmpriv.h" #include "getopt.h" -#define MM_VERSION "2.2-r510-dirty" +#define MM_VERSION "2.2-r511-dirty" #ifdef __linux__ #include diff --git a/map.c b/map.c index 27c5818..fb291b6 100644 --- a/map.c +++ b/map.c @@ -306,7 +306,7 @@ void mm_map_frag(const mm_idx_t *mi, int n_segs, const int *qlens, const char ** a = mm_chain_dp(max_chain_gap_ref, max_chain_gap_qry, opt->bw, opt->max_chain_skip, opt->min_cnt, opt->min_chain_score, is_splice, n_segs, n_a, a, &n_regs0, &u, b->km); - if ((opt->flag & MM_F_SR) && rep_len > 0) { + if (opt->max_occ > opt->mid_occ && rep_len > 0) { int rechain = 0; if (n_regs0 > 0) { // test if the best chain has all the segments int n_chained_segs = 1, max = 0, max_i = -1, max_off = -1, off = 0; diff --git a/pe.c b/pe.c index 70affcc..a1f9fda 100644 --- a/pe.c +++ b/pe.c @@ -117,13 +117,18 @@ void mm_pair(void *km, int max_gap_ref, int pe_bonus, int sub_diff, int match_sc r[0] = a[max_idx[0]].r, r[1] = a[max_idx[1]].r; r[0]->proper_frag = r[1]->proper_frag = 1; for (s = 0; s < 2; ++s) { - if (r[s]->id != r[s]->parent) { + if (r[s]->id != r[s]->parent) { // then lift to primary and update parent mm_reg1_t *p = ®s[s][r[s]->parent]; for (i = 0; i < n_regs[s]; ++i) if (regs[s][i].parent == p->id) regs[s][i].parent = r[s]->id; p->mapq = 0; } + if (!r[s]->sam_pri) { // then sync sam_pri + for (i = 0; i < n_regs[s]; ++i) + regs[s][i].sam_pri = 0; + r[s]->sam_pri = 1; + } } mapq_pe = r[0]->mapq > r[1]->mapq? r[0]->mapq : r[1]->mapq; for (i = 0; i < sc.n; ++i) @@ -144,8 +149,6 @@ void mm_pair(void *km, int max_gap_ref, int pe_bonus, int sub_diff, int match_sc if (r[1]->mapq < 1) r[1]->mapq = 1; } } - mm_set_sam_pri(n_regs[0], regs[0]); - mm_set_sam_pri(n_regs[1], regs[1]); kfree(km, a); kfree(km, sc.a);