r511: fixed wrong primary sam record

This commit is contained in:
Heng Li 2017-10-12 23:02:18 -04:00
parent dea3b60918
commit 858213d513
3 changed files with 8 additions and 5 deletions

2
main.c
View File

@ -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 <sys/resource.h>

2
map.c
View File

@ -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;

9
pe.c
View File

@ -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 = &regs[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);