From: Heng Li Date: Fri, 2 Jul 2010 23:32:24 +0000 (+0000) Subject: fixed a minor bug in idxstats X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a5adc91ac9fb9f3c88b80a77b1eecfe8d5fb0551;p=samtools.git fixed a minor bug in idxstats --- diff --git a/bam.h b/bam.h index fb71a49..8e26ea6 100644 --- 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 diff --git a/bam_index.c b/bam_index.c index 7a53d7f..4152f20 100644 --- a/bam_index.c +++ b/bam_index.c @@ -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 \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; diff --git a/misc/Makefile b/misc/Makefile index 2c400f8..2f1578b 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -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