X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=examples%2FcalDepth.c;fp=examples%2FcalDepth.c;h=7a3239c0380de1cbc67641f05dfd561f3815103a;hb=0b57d1b361fd43fbf21923faf2e62a375a30a1df;hp=6a4be14c070c4a1a4b76f2d93eadc61cece0a61a;hpb=f35ebaef9ed8e8e545280df1e92928987135dcca;p=samtools.git diff --git a/examples/calDepth.c b/examples/calDepth.c index 6a4be14..7a3239c 100644 --- a/examples/calDepth.c +++ b/examples/calDepth.c @@ -35,25 +35,25 @@ int main(int argc, char *argv[]) fprintf(stderr, "Fail to open BAM file %s\n", argv[1]); return 1; } - if (argc == 2) { + if (argc == 2) { // if a region is not specified sampileup(tmp.in, -1, pileup_func, &tmp); } else { int ref; bam_index_t *idx; bam_plbuf_t *buf; - idx = bam_index_load(argv[1]); + idx = bam_index_load(argv[1]); // load BAM index if (idx == 0) { fprintf(stderr, "BAM indexing file is not available.\n"); return 1; } - bam_parse_region(tmp.in->header, argv[2], &ref, &tmp.beg, &tmp.end); + bam_parse_region(tmp.in->header, argv[2], &ref, &tmp.beg, &tmp.end); // parse the region if (ref < 0) { fprintf(stderr, "Invalid region %s\n", argv[2]); return 1; } - buf = bam_plbuf_init(pileup_func, &tmp); + buf = bam_plbuf_init(pileup_func, &tmp); // initialize pileup bam_fetch(tmp.in->x.bam, idx, ref, tmp.beg, tmp.end, buf, fetch_func); - bam_plbuf_push(0, buf); + bam_plbuf_push(0, buf); // finalize pileup bam_index_destroy(idx); bam_plbuf_destroy(buf); }