r721: merge overlapping hits by default

This commit is contained in:
Heng Li 2014-04-15 16:16:04 -04:00
parent 45f24b4ae8
commit 00a07f61bf
5 changed files with 8 additions and 17 deletions

View File

@ -358,7 +358,7 @@ KSORT_INIT(mem_ars, mem_alnreg_t, alnreg_slt)
#define alnreg_hlt(a, b) ((a).score > (b).score || ((a).score == (b).score && (a).hash < (b).hash))
KSORT_INIT(mem_ars_hash, mem_alnreg_t, alnreg_hlt)
int mem_sort_and_dedup2(int n, mem_alnreg_t *a, float mask_level_redun, int merge_bw)
int mem_sort_and_dedup(int n, mem_alnreg_t *a, float mask_level_redun, int merge_bw)
{
int m, i, j;
if (n <= 1) return n;
@ -420,11 +420,6 @@ int mem_sort_and_dedup2(int n, mem_alnreg_t *a, float mask_level_redun, int merg
return m;
}
int mem_sort_and_dedup(int n, mem_alnreg_t *a, float mask_level_redun)
{
return mem_sort_and_dedup2(n, a, mask_level_redun, -1);
}
int mem_test_and_remove_exact(const mem_opt_t *opt, int n, mem_alnreg_t *a, int qlen)
{
if (!(opt->flag & MEM_F_SELF_OVLP) || n == 0 || a->truesc != qlen * opt->a) return n;
@ -984,8 +979,7 @@ mem_alnreg_v mem_align1_core(const mem_opt_t *opt, const bwt_t *bwt, const bntse
free(chn.a[i].seeds);
}
free(chn.a);
if (opt->flag & MEM_F_MERGE_REG) regs.n = mem_sort_and_dedup2(regs.n, regs.a, opt->mask_level_redun, opt->w);
else regs.n = mem_sort_and_dedup(regs.n, regs.a, opt->mask_level_redun);
regs.n = mem_sort_and_dedup(regs.n, regs.a, opt->mask_level_redun, opt->w);
if (opt->flag & MEM_F_SELF_OVLP)
regs.n = mem_test_and_remove_exact(opt, regs.n, regs.a, l_seq);
if (bwa_verbose >= 4) {

View File

@ -18,7 +18,6 @@ typedef struct __smem_i smem_i;
#define MEM_F_NO_RESCUE 0x20
#define MEM_F_SELF_OVLP 0x40
#define MEM_F_ALN_REG 0x80
#define MEM_F_MERGE_REG 0x100
typedef struct {
int a, b; // match score and mismatch penalty

View File

@ -109,7 +109,7 @@ void mem_pestat(const mem_opt_t *opt, int64_t l_pac, int n, const mem_alnreg_v *
int mem_matesw(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, const mem_pestat_t pes[4], const mem_alnreg_t *a, int l_ms, const uint8_t *ms, mem_alnreg_v *ma)
{
extern int mem_sort_and_dedup(int n, mem_alnreg_t *a, float mask_level_redun);
extern int mem_sort_and_dedup(int n, mem_alnreg_t *a, float mask_level_redun, int merge_bw);
int64_t l_pac = bns->l_pac;
int i, r, skip[4], n = 0, rid;
for (r = 0; r < 4; ++r)
@ -170,7 +170,7 @@ int mem_matesw(const mem_opt_t *opt, const bntseq_t *bns, const uint8_t *pac, co
}
++n;
}
if (n) ma->n = mem_sort_and_dedup(ma->n, ma->a, opt->mask_level_redun);
if (n) ma->n = mem_sort_and_dedup(ma->n, ma->a, opt->mask_level_redun, -1);
if (rev) free(rev);
free(ref);
}

View File

@ -53,7 +53,7 @@ int main_mem(int argc, char *argv[])
opt = mem_opt_init();
memset(&opt0, 0, sizeof(mem_opt_t));
while ((c = getopt(argc, argv, "epaFMCSPHVk:c:v:s:r:t:R:A:B:O:E:U:w:L:d:T:Q:D:m:I:N:W:x:G:")) >= 0) {
while ((c = getopt(argc, argv, "epaFMCSPHk:c:v:s:r:t:R:A:B:O:E:U:w:L:d:T:Q:D:m:I:N:W:x:G:")) >= 0) {
if (c == 'k') opt->min_seed_len = atoi(optarg), opt0.min_seed_len = 1;
else if (c == 'x') mode = optarg;
else if (c == 'w') opt->w = atoi(optarg), opt0.w = 1;
@ -69,7 +69,6 @@ int main_mem(int argc, char *argv[])
else if (c == 'S') opt->flag |= MEM_F_NO_RESCUE;
else if (c == 'e') opt->flag |= MEM_F_SELF_OVLP;
else if (c == 'F') opt->flag |= MEM_F_ALN_REG;
else if (c == 'V') opt->flag |= MEM_F_MERGE_REG;
else if (c == 'c') opt->max_occ = atoi(optarg), opt0.max_occ = 1;
else if (c == 'd') opt->zdrop = atoi(optarg), opt0.zdrop = 1;
else if (c == 'v') bwa_verbose = atoi(optarg);
@ -148,7 +147,7 @@ int main_mem(int argc, char *argv[])
fprintf(stderr, " -U INT penalty for an unpaired read pair [%d]\n", opt->pen_unpaired);
fprintf(stderr, " -x STR read type. Setting -x changes multiple parameters unless overriden [null]\n");
fprintf(stderr, " pacbio: -k17 -W40 -w200 -c1000 -r10 -A2 -B5 -O2 -E1 -L0\n");
fprintf(stderr, " pbread: -k13 -W40 -w200 -c1000 -r10 -A2 -B5 -O2 -E1 -N25 -FVeaD.001\n");
fprintf(stderr, " pbread: -k13 -W40 -w200 -c1000 -r10 -A2 -B5 -O2 -E1 -N25 -FeaD.001\n");
fprintf(stderr, "\nInput/output options:\n\n");
fprintf(stderr, " -p first query file consists of interleaved paired-end sequences\n");
fprintf(stderr, " -R STR read group header line such as '@RG\\tID:foo\\tSM:bar' [null]\n");
@ -183,12 +182,11 @@ int main_mem(int argc, char *argv[])
if (opt0.split_factor == 0.) opt->split_factor = 10.;
if (!opt0.min_chain_weight) opt->min_chain_weight = 40;
if (strcmp(mode, "pbread1") == 0 || strcmp(mode, "pbread") == 0) {
opt->flag |= MEM_F_ALL | MEM_F_SELF_OVLP | MEM_F_ALN_REG | MEM_F_MERGE_REG;
opt->flag |= MEM_F_ALL | MEM_F_SELF_OVLP | MEM_F_ALN_REG;
if (!opt0.min_seed_len) opt->min_seed_len = 13;
if (!opt0.max_chain_extend) opt->max_chain_extend = 25;
if (opt0.drop_ratio == 0.) opt->drop_ratio = .001;
} else {
opt->flag |= MEM_F_MERGE_REG;
if (!opt0.min_seed_len) opt->min_seed_len = 17;
if (!opt0.pen_clip5) opt->pen_clip5 = 0;
if (!opt0.pen_clip3) opt->pen_clip3 = 0;

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.8-r720-dirty"
#define PACKAGE_VERSION "0.7.8-r721-dirty"
#endif
int bwa_fa2pac(int argc, char *argv[]);