]> git.donarmstrong.com Git - samtools.git/blobdiff - bam_pileup.c
fixed minor things in Makefile
[samtools.git] / bam_pileup.c
index 02bdfd07c63bca1930a44a600263be2c6aa906e5..46906dba429032c49920f61a4149c29ec43eae11 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include "bam.h"
+#include "sam.h"
 
 typedef struct __linkbuf_t {
        bam1_t b;
@@ -161,6 +161,7 @@ void bam_plbuf_destroy(bam_plbuf_t *buf)
 int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf)
 {
        if (b) { // fill buffer
+               if (b->core.tid < 0) return 0;
                if (b->core.flag & buf->flag_mask) return 0;
                bam_copy1(&buf->tail->b, b);
                buf->tail->beg = b->core.pos; buf->tail->end = bam_calend(&b->core, bam1_cigar(b));
@@ -205,19 +206,3 @@ 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 = (bam1_t*)calloc(1, sizeof(bam1_t));
-       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);
-       free(b->data); free(b);
-       return 0;
-}