* a temporary remedy for an issue in indel calling
bam_maqindel_opt_t *mi = (bam_maqindel_opt_t*)calloc(1, sizeof(bam_maqindel_opt_t));
mi->q_indel = 40;
mi->r_indel = 0.00015;
bam_maqindel_opt_t *mi = (bam_maqindel_opt_t*)calloc(1, sizeof(bam_maqindel_opt_t));
mi->q_indel = 40;
mi->r_indel = 0.00015;
//
mi->mm_penalty = 3;
mi->indel_err = 4;
//
mi->mm_penalty = 3;
mi->indel_err = 4;
}
{ // the core part
char *ref2, *rs, *inscns = 0;
}
{ // the core part
char *ref2, *rs, *inscns = 0;
- int k, l, *score, *pscore, max_ins = types[n_types-1];
+ int qr_snp, k, l, *score, *pscore, max_ins = types[n_types-1];
+ qr_snp = (int)(-4.343 * log(mi->r_snp) + .499);
if (max_ins > 0) { // get the consensus of inserted sequences
int *inscns_aux = (int*)calloc(4 * n_types * max_ins, sizeof(int));
// count occurrences
if (max_ins > 0) { // get the consensus of inserted sequences
int *inscns_aux = (int*)calloc(4 * n_types * max_ins, sizeof(int));
// count occurrences
if (op == BAM_CMATCH) {
int k;
for (k = 0; k < len; ++k)
if (op == BAM_CMATCH) {
int k;
for (k = 0; k < len; ++k)
- if (ref2[x+k] != rs[y+k] && ref2[x+k] < 4) ps += bam1_qual(p->b)[y+k];
+ if (ref2[x+k] != rs[y+k] && ref2[x+k] < 4)
+ ps += bam1_qual(p->b)[y+k] < qr_snp? bam1_qual(p->b)[y+k] : qr_snp;
x += len; y += len;
} else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) {
if (op == BAM_CINS && l > 0 && l < n_acigar - 1) ps += mi->q_indel * len;
x += len; y += len;
} else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) {
if (op == BAM_CINS && l > 0 && l < n_acigar - 1) ps += mi->q_indel * len;
} bam_maqcns_t;
typedef struct {
} bam_maqcns_t;
typedef struct {
- int q_indel;
- float r_indel;
+ int q_indel; // indel sequencing error, phred scaled
+ float r_indel; // indel prior
+ float r_snp; // snp prior
// hidden parameters, unchangeable from command line
int mm_penalty, indel_err, ambi_thres;
} bam_maqindel_opt_t;
// hidden parameters, unchangeable from command line
int mm_penalty, indel_err, ambi_thres;
} bam_maqindel_opt_t;
case 'f': fn_fa = strdup(optarg); break;
case 'T': d->c->theta = atof(optarg); break;
case 'N': d->c->n_hap = atoi(optarg); break;
case 'f': fn_fa = strdup(optarg); break;
case 'T': d->c->theta = atof(optarg); break;
case 'N': d->c->n_hap = atoi(optarg); break;
- case 'r': d->c->het_rate = atof(optarg); break;
+ case 'r': d->c->het_rate = atof(optarg); d->ido->r_snp = d->c->het_rate; break;
case 'M': d->c->cap_mapQ = atoi(optarg); break;
case 'd': d->max_depth = atoi(optarg); break;
case 'c': d->format |= BAM_PLF_CNS; break;
case 'M': d->c->cap_mapQ = atoi(optarg); break;
case 'd': d->max_depth = atoi(optarg); break;
case 'c': d->format |= BAM_PLF_CNS; break;
static void tv_win_goto(tview_t *tv, int *tid, int *pos)
{
static void tv_win_goto(tview_t *tv, int *tid, int *pos)
{
int i, l = 0;
wborder(tv->wgoto, '|', '|', '-', '-', '+', '+', '+', '+');
mvwprintw(tv->wgoto, 1, 2, "Goto: ");
int i, l = 0;
wborder(tv->wgoto, '|', '|', '-', '-', '+', '+', '+', '+');
mvwprintw(tv->wgoto, 1, 2, "Goto: ");
--l;
} else if (c == KEY_ENTER || c == '\012' || c == '\015') {
int _tid = -1, _beg, _end;
--l;
} else if (c == KEY_ENTER || c == '\012' || c == '\015') {
int _tid = -1, _beg, _end;
- bam_parse_region(tv->header, str, &_tid, &_beg, &_end);
- if (_tid >= 0) {
- *tid = _tid; *pos = _beg;
- return;
+ if (str[0] == '=') {
+ _beg = strtol(str+1, &p, 10);
+ if (_beg > 0) {
+ *pos = _beg;
+ return;
+ }
+ } else {
+ bam_parse_region(tv->header, str, &_tid, &_beg, &_end);
+ if (_tid >= 0) {
+ *tid = _tid; *pos = _beg;
+ return;
+ }
}
} else if (isgraph(c)) {
if (l < TV_MAX_GOTO) str[l++] = c;
}
} else if (isgraph(c)) {
if (l < TV_MAX_GOTO) str[l++] = c;
case '?': tv_win_help(tv); break;
case '\033':
case 'q': goto end_loop;
case '?': tv_win_help(tv); break;
case '\033':
case 'q': goto end_loop;
case 'g': tv_win_goto(tv, &tid, &pos); break;
case 'm': tv->color_for = TV_COLOR_MAPQ; break;
case 'b': tv->color_for = TV_COLOR_BASEQ; break;
case 'g': tv_win_goto(tv, &tid, &pos); break;
case 'm': tv->color_for = TV_COLOR_MAPQ; break;
case 'b': tv->color_for = TV_COLOR_BASEQ; break;