]> git.donarmstrong.com Git - samtools.git/commitdiff
fixed a minor bug in idxstats
authorHeng Li <lh3@live.co.uk>
Fri, 2 Jul 2010 23:32:24 +0000 (23:32 +0000)
committerHeng Li <lh3@live.co.uk>
Fri, 2 Jul 2010 23:32:24 +0000 (23:32 +0000)
bam.h
bam_index.c
misc/Makefile

diff --git a/bam.h b/bam.h
index fb71a49b46dafea0512a99e157735104cd3832a3..8e26ea69d3b7c6b008aba6112052310a4072b08a 100644 (file)
--- a/bam.h
+++ b/bam.h
@@ -329,6 +329,7 @@ extern "C" {
          be destroyed in the first place.
         */
        int sam_header_parse(bam_header_t *h);
+       int32_t bam_get_tid(const bam_header_t *header, const char *seq_name);
 
        /*!
          @abstract       Parse @RG lines a update a header struct
index 7a53d7f9a7636b9bc6146313a9ca2e134e0591b6..4152f2022f3178ef4fd0ee6b6001effae8f2ce3c 100644 (file)
@@ -504,7 +504,7 @@ int bam_idxstats(int argc, char *argv[])
        bam_index_t *idx;
        bam_header_t *header;
        bamFile fp;
-       int i, no_stats = 0;
+       int i;
        if (argc < 2) {
                fprintf(stderr, "Usage: samtools idxstats <in.bam>\n");
                return 1;
@@ -522,12 +522,10 @@ int bam_idxstats(int argc, char *argv[])
                k = kh_get(i, h, BAM_MAX_BIN);
                if (k != kh_end(h))
                        printf("\t%llu\t%llu", (long long)kh_val(h, k).list[1].u, (long long)kh_val(h, k).list[1].v);
-               else no_stats = 1;
+               else printf("\t0\t0");
                putchar('\n');
        }
-       printf("*\t0");
-       if (!no_stats) printf("\t0\t%llu", (long long)idx->n_no_coor);
-       putchar('\n');
+       printf("*\t0\t0\t%llu\n", (long long)idx->n_no_coor);
        bam_header_destroy(header);
        bam_index_destroy(idx);
        return 0;
index 2c400f806392fce11f9133f41323ed5396ab179f..2f1578b3f720c65d8b2d3bc9bb6086768e819cac 100644 (file)
@@ -1,10 +1,10 @@
 CC=                    gcc
 CXX=           g++
-CFLAGS=                -g -Wall -O2 -m64 #-arch ppc
+CFLAGS=                -g -Wall #-O2 #-m64 #-arch ppc
 CXXFLAGS=      $(CFLAGS)
 DFLAGS=                -D_FILE_OFFSET_BITS=64
 OBJS=          
-PROG=          md5sum-lite md5fa maq2sam-short maq2sam-long wgsim
+PROG=          md5sum-lite md5fa maq2sam-short maq2sam-long wgsim afs2
 INCLUDES=      -I..
 SUBDIRS=       .
 
@@ -27,6 +27,9 @@ lib-recur all-recur clean-recur cleanlocal-recur install-recur:
 
 lib:
 
+afs2:afs2.o
+               $(CC) $(CFLAGS) -o $@ afs2.o -lm -lz -L.. -lbam
+
 wgsim:wgsim.o
                $(CC) $(CFLAGS) -o $@ wgsim.o -lm
 
@@ -48,6 +51,9 @@ maq2sam-long:maq2sam.c
 md5fa.o:md5.h md5fa.c
                $(CC) $(CFLAGS) -c -I.. -o $@ md5fa.c
 
+afs2.o:afs2.c ../bam.h
+               $(CC) $(CFLAGS) -c -I.. -o $@ afs2.c
+
 cleanlocal:
                rm -fr gmon.out *.o a.out *.exe *.dSYM $(PROG) *~ *.a