]> git.donarmstrong.com Git - samtools.git/blobdiff - bam_lite.c
* samtools-0.1.5-5 (r395)
[samtools.git] / bam_lite.c
index 12c719cccde34ce67916530e7dc299454d7591c5..93af6c4a8d96e226f2998c80ab929b93f61a4843 100644 (file)
@@ -552,6 +552,22 @@ int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf)
        return 0;
 }
 
+int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data)
+{
+       bam_plbuf_t *buf;
+       int ret;
+       bam1_t *b;
+       b = bam_init1();
+       buf = bam_plbuf_init(func, func_data);
+       bam_plbuf_set_mask(buf, mask);
+       while ((ret = bam_read1(fp, b)) >= 0)
+               bam_plbuf_push(b, buf);
+       bam_plbuf_push(0, buf);
+       bam_plbuf_destroy(buf);
+       bam_destroy1(b);
+       return 0;
+}
+
 /**********************
  *** from bam_aux.c ***
  **********************/