Skip to content

Commit

Permalink
r721: merge overlapping hits by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lh3 committed Apr 15, 2014
1 parent 45f24b4 commit 00a07f6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
10 changes: 2 additions & 8 deletions bwamem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion bwamem.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions bwamem_pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 3 additions & 5 deletions fastmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[]);
Expand Down

0 comments on commit 00a07f6

Please sign in to comment.