X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=samtools.git;a=blobdiff_plain;f=bam_tview.c;h=bf01e15c3d79b1a55920bd4162c8e347b9f1f0d7;hp=4c121e7cbfa012ac0c3fa61d574f03c893e6d271;hb=ced7709f121a00d5049d99ee8576037994aab1d1;hpb=4a17fa7e1f91b2fe04ad334a63fc2b0d5e859d8a diff --git a/bam_tview.c b/bam_tview.c index 4c121e7..bf01e15 100644 --- a/bam_tview.c +++ b/bam_tview.c @@ -109,7 +109,7 @@ int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void if (tv->is_dot && toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.'; } } - } else c = '*'; + } else c = p->is_refskip? (bam1_strand(p->b)? '<' : '>') : '*'; } else { // padding if (j > p->indel) c = '*'; else { // insertion @@ -183,12 +183,12 @@ tview_t *tv_init(const char *fn, const char *fn_fa) { tview_t *tv = (tview_t*)calloc(1, sizeof(tview_t)); tv->is_dot = 1; - tv->idx = bam_index_load(fn); - if (tv->idx == 0) exit(1); tv->fp = bam_open(fn, "r"); bgzf_set_cache_size(tv->fp, 8 * 1024 *1024); assert(tv->fp); tv->header = bam_header_read(tv->fp); + tv->idx = bam_index_load(fn); + if (tv->idx == 0) exit(1); tv->lplbuf = bam_lplbuf_init(tv_pl_func, tv); if (fn_fa) tv->fai = fai_load(fn_fa); tv->bmc = bam_maqcns_init(); @@ -280,7 +280,7 @@ int tv_draw_aln(tview_t *tv, int tid, int pos) static void tv_win_goto(tview_t *tv, int *tid, int *pos) { - char str[256]; + char str[256], *p; int i, l = 0; wborder(tv->wgoto, '|', '|', '-', '-', '+', '+', '+', '+'); mvwprintw(tv->wgoto, 1, 2, "Goto: "); @@ -291,10 +291,18 @@ static void tv_win_goto(tview_t *tv, int *tid, int *pos) --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) - 1; + 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; @@ -351,6 +359,7 @@ void tv_loop(tview_t *tv) case '?': tv_win_help(tv); break; case '\033': case 'q': goto end_loop; + case '/': 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;