]> git.donarmstrong.com Git - samtools.git/blobdiff - sam.c
* samtools-0.1.3-12 (r259)
[samtools.git] / sam.c
diff --git a/sam.c b/sam.c
index a13327482614940078982ba3ec3ed2fd0d342647..85343398a8d5356a7ce1343970653adb5204a652 100644 (file)
--- a/sam.c
+++ b/sam.c
@@ -138,3 +138,19 @@ int samwrite(samfile_t *fp, const bam1_t *b)
                return l + 1;
        }
 }
+
+int sampileup(samfile_t *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 = samread(fp, b)) >= 0)
+               bam_plbuf_push(b, buf);
+       bam_plbuf_push(0, buf);
+       bam_plbuf_destroy(buf);
+       bam_destroy1(b);
+       return 0;
+}