X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_plcmd.c;h=b1ffdf900cfa7212937b54ead357bbd3bb8579a0;hb=63e4e54189bc9e7f43852edf865f95e713b93dc4;hp=b85fb866a140f2e3f8e2b83af5cfbb942cb43a1b;hpb=c311a7ff8c8f704ff8bdcba9f61967148201c008;p=samtools.git diff --git a/bam_plcmd.c b/bam_plcmd.c index b85fb86..b1ffdf9 100644 --- a/bam_plcmd.c +++ b/bam_plcmd.c @@ -195,7 +195,7 @@ static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *p if (p->is_head) printf("^%c", p->b->core.qual > 93? 126 : p->b->core.qual + 33); if (!p->is_del) { int c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)]; - if (toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.'; + 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) { @@ -238,7 +238,7 @@ static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *p printf("%d\t%d\t", max_mapq, n); printf("%s\t%s\t", r->s[0], r->s[1]); //printf("%d\t%d\t", r->gl[0], r->gl[1]); - printf("%d\t%d\t%d\t%d\n", r->cnt1, r->cnt2, r->cnt_ambi, r->cnt_anti); + printf("%d\t%d\t%d\n", r->cnt1, r->cnt2, r->cnt_anti); bam_maqindel_ret_destroy(r); } return 0; @@ -280,7 +280,7 @@ int bam_pileup(int argc, char *argv[]) fprintf(stderr, " -l FILE list of sites at which pileup is output\n"); fprintf(stderr, " -f FILE reference sequence in the FASTA format\n\n"); fprintf(stderr, " -c output the maq consensus sequence\n"); - fprintf(stderr, " -g output in the extended GLT format (suppressing -c/-i/-s)\n"); + fprintf(stderr, " -g output in the GLFv3 format (suppressing -c/-i/-s)\n"); fprintf(stderr, " -T FLOAT theta in maq consensus calling model (for -c/-g) [%f]\n", d->c->theta); fprintf(stderr, " -N INT number of haplotypes in the sample (for -c/-g) [%d]\n", d->c->n_hap); fprintf(stderr, " -r FLOAT prior of a difference between two haplotypes (for -c/-g) [%f]\n", d->c->het_rate); @@ -292,7 +292,7 @@ int bam_pileup(int argc, char *argv[]) } if (fn_fa) d->fai = fai_load(fn_fa); free(fn_fa); - bam_maqcns_prepare(d->c); + if (d->format & (BAM_PLF_CNS|BAM_PLF_GLF)) bam_maqcns_prepare(d->c); if (d->format & BAM_PLF_GLF) { glf3_header_t *h; h = glf3_header_init(); @@ -300,7 +300,7 @@ int bam_pileup(int argc, char *argv[]) glf3_header_write(d->fp, h); glf3_header_destroy(h); } - if (d->fai == 0) + if (d->fai == 0 && (d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY))) fprintf(stderr, "[bam_pileup] indels will not be called when -f is absent.\n"); if (fn_list) { // the input is SAM tamFile fp; @@ -322,6 +322,10 @@ int bam_pileup(int argc, char *argv[]) bamFile fp; fp = (strcmp(argv[optind], "-") == 0)? bam_dopen(fileno(stdin), "r") : bam_open(argv[optind], "r"); d->h = bam_header_read(fp); + if (d->h == 0) { + fprintf(stderr, "[bam_pileup] fail to read the BAM header. Abort!\n"); + return 1; + } if (fn_pos) d->hash = load_pos(fn_pos, d->h); bam_pileup_file(fp, d->mask, pileup_func, d); bam_close(fp);