X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_plcmd.c;h=f0e63ce62cd91cc6cada955eaa19c9b2493e1872;hb=6ee6fd65332260af63fbfbf0a625ea3847371eda;hp=cf98f69565ee6d52176df5ca5c9d14a44d2ef3e6;hpb=253dbf083d8a84721ae6ac63af786c8dcf566ecb;p=samtools.git diff --git a/bam_plcmd.c b/bam_plcmd.c index cf98f69..f0e63ce 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -175,32 +175,33 @@ static int glt3_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pu, return 0; } -static void pileup_seq(const bam_pileup1_t *p, int pos, int ref_len, const char *ref) +static inline void pileup_seq(const bam_pileup1_t *p, int pos, int ref_len, const char *ref) { + int j; if (p->is_head) { putchar('^'); putchar(p->b->core.qual > 93? 126 : p->b->core.qual + 33); } if (!p->is_del) { - int j, rb, c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; + int rb, c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; rb = (ref && pos < ref_len)? ref[pos] : 'N'; if (c == '=' || toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.'; else c = bam1_strand(p->b)? tolower(c) : toupper(c); putchar(c); - if (p->indel > 0) { - putchar('+'); printw(p->indel, stdout); - for (j = 1; j <= p->indel; ++j) { - c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos + j)]; - putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); - } - } else if (p->indel < 0) { - printw(p->indel, stdout); - for (j = 1; j <= -p->indel; ++j) { - c = (ref && (int)pos+j < ref_len)? ref[pos+j] : 'N'; - putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); - } - } } else putchar(p->is_refskip? (bam1_strand(p->b)? '<' : '>') : '*'); + if (p->indel > 0) { + putchar('+'); printw(p->indel, stdout); + for (j = 1; j <= p->indel; ++j) { + int c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos + j)]; + putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); + } + } else if (p->indel < 0) { + printw(p->indel, stdout); + for (j = 1; j <= -p->indel; ++j) { + int c = (ref && (int)pos+j < ref_len)? ref[pos+j] : 'N'; + putchar(bam1_strand(p->b)? tolower(c) : toupper(c)); + } + } if (p->is_tail) putchar('$'); }