From 67392b892147cff4bfb8718a819bab86d577b4e3 Mon Sep 17 00:00:00 2001 From: Heng Li Date: Sun, 12 Jul 2009 17:42:43 +0000 Subject: [PATCH] * samtools-0.1.5-2 (r391) * do not show a blank screen when no reads mapped --- bam_tview.c | 11 +++++++++-- bamtk.c | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bam_tview.c b/bam_tview.c index be2579c..39793ad 100644 --- a/bam_tview.c +++ b/bam_tview.c @@ -50,11 +50,11 @@ int tv_pl_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pl, void // print referece rb = (tv->ref && pos - tv->left_pos < tv->l_ref)? tv->ref[pos - tv->left_pos] : 'N'; for (i = tv->last_pos + 1; i < pos; ++i) { - if (i%10 == 0) mvprintw(0, tv->ccol, "%-d", i+1); + if (i%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", i+1); c = tv->ref? tv->ref[i - tv->left_pos] : 'N'; mvaddch(1, tv->ccol++, c); } - if (pos%10 == 0) mvprintw(0, tv->ccol, "%-d", pos+1); + if (pos%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", pos+1); // print consensus call = bam_maqcns_call(n, pl, tv->bmc); attr = A_UNDERLINE; @@ -240,6 +240,13 @@ int tv_draw_aln(tview_t *tv, int tid, int pos) bam_lplbuf_reset(tv->lplbuf); bam_fetch(tv->fp, tv->idx, tv->curr_tid, tv->left_pos, tv->left_pos + tv->mcol, tv, tv_fetch_func); bam_lplbuf_push(0, tv->lplbuf); + + while (tv->ccol < tv->mcol) { + int pos = tv->last_pos + 1; + if (pos%10 == 0 && tv->mcol - tv->ccol >= 10) mvprintw(0, tv->ccol, "%-d", pos+1); + mvaddch(1, tv->ccol++, (tv->ref && pos < tv->l_ref)? tv->ref[pos - tv->left_pos] : 'N'); + ++tv->last_pos; + } return 0; } diff --git a/bamtk.c b/bamtk.c index f253852..6b4db51 100644 --- a/bamtk.c +++ b/bamtk.c @@ -4,7 +4,7 @@ #include "bam.h" #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "0.1.5-1 (r390)" +#define PACKAGE_VERSION "0.1.5-2 (r391)" #endif int bam_taf2baf(int argc, char *argv[]); -- 2.39.5