[med-svn] [htslib] 10/10: Replaced the CRAM-specific verbosity flag with the regular log level setting.

Andreas Tille tille at debian.org
Wed Jul 19 19:54:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository htslib.

commit cc55632993313cf4c23be82f8b13f7113d61e675
Author: Anders Kaplan <anders.kaplan at magasin1.se>
Date:   Mon Jul 3 22:45:12 2017 +0200

    Replaced the CRAM-specific verbosity flag with the regular log level setting.
---
 cram/cram_encode.c  | 19 +++++++------------
 cram/cram_io.c      | 21 +++++++--------------
 cram/cram_structs.h |  1 -
 htslib/hts.h        |  2 +-
 4 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/cram/cram_encode.c b/cram/cram_encode.c
index 2d78732..2b06b58 100644
--- a/cram/cram_encode.c
+++ b/cram/cram_encode.c
@@ -499,9 +499,7 @@ cram_block *cram_encode_compression_header(cram_fd *fd, cram_container *c,
     itf8_put_blk(cb, mc);    
     BLOCK_APPEND(cb, BLOCK_DATA(map), BLOCK_SIZE(map));
 
-    if (fd->verbose)
-	hts_log_info("Wrote compression block header in %d bytes",
-		(int)BLOCK_SIZE(cb));
+    hts_log_info("Wrote compression block header in %d bytes", (int)BLOCK_SIZE(cb));
 
     BLOCK_UPLEN(cb);
 
@@ -1405,8 +1403,7 @@ int cram_encode_container(cram_fd *fd, cram_container *c) {
     multi_ref = c->stats[DS_RI]->nvals > 1;
 
     if (multi_ref) {
-	if (fd->verbose)
-	    hts_log_info("Multi-ref container");
+	hts_log_info("Multi-ref container");
 	c->ref_seq_id = -2;
 	c->ref_seq_start = 0;
 	c->ref_seq_span = 0;
@@ -1640,8 +1637,7 @@ int cram_encode_container(cram_fd *fd, cram_container *c) {
 
     /* Encode slices */
     for (i = 0; i < c->curr_slice; i++) {
-	if (fd->verbose)
-	    hts_log_info("Encode slice %d", i);
+	hts_log_info("Encode slice %d", i);
 
 	if (cram_encode_slice(fd, c, h, c->slices[i]) != 0)
 	    return -1;
@@ -2445,10 +2441,9 @@ static cram_container *cram_next_container(cram_fd *fd, bam_seq_t *b) {
     if (c->curr_slice == c->max_slice ||
 	(bam_ref(b) != c->curr_ref && !c->multi_seq)) {
 	c->ref_seq_span = fd->last_base - c->ref_seq_start + 1;
-	if (fd->verbose)
-	    hts_log_info("Flush container %d/%d..%d",
-		    c->ref_seq_id, c->ref_seq_start,
-		    c->ref_seq_start + c->ref_seq_span -1);
+	hts_log_info("Flush container %d/%d..%d",
+		c->ref_seq_id, c->ref_seq_start,
+		c->ref_seq_start + c->ref_seq_span -1);
 
 	/* Encode slices */
 	if (fd->pool) {
@@ -3085,7 +3080,7 @@ int cram_put_bam_seq(cram_fd *fd, bam_seq_t *b) {
 	if (fd->multi_seq == -1 && c->curr_rec < c->max_rec/4+10 &&
 	    fd->last_slice && fd->last_slice < c->max_rec/4+10 &&
 	    !fd->embed_ref) {
-	    if (fd->verbose && !c->multi_seq)
+	    if (!c->multi_seq)
 		hts_log_info("Multi-ref enabled for this container");
 	    multi_seq = 1;
 	}
diff --git a/cram/cram_io.c b/cram/cram_io.c
index bf50130..0a88714 100644
--- a/cram/cram_io.c
+++ b/cram/cram_io.c
@@ -1411,10 +1411,9 @@ int cram_compress_block(cram_fd *fd, cram_block *b, cram_metrics *metrics,
 	b->method = GZIP;
     }
 
-    if (fd->verbose)
-	hts_log_info("Compressed block ID %d from %d to %d by method %s",
-		b->content_id, b->uncomp_size, b->comp_size,
-		cram_block_method2str(b->method));
+    hts_log_info("Compressed block ID %d from %d to %d by method %s",
+	    b->content_id, b->uncomp_size, b->comp_size,
+	    cram_block_method2str(b->method));
 
     if (b->method == RANS1)
 	b->method = RANS0; // Spec just has RANS (not 0/1) with auto-sensing
@@ -2021,8 +2020,7 @@ static int cram_populate_ref(cram_fd *fd, int id, ref_entry *r) {
     mFILE *mf;
     int local_path = 0;
 
-    if (fd->verbose)
-	hts_log_info("Running cram_populate_ref on fd %p, id %d", (void *)fd, id);
+    hts_log_info("Running cram_populate_ref on fd %p, id %d", (void *)fd, id);
 
     cache_root[0] = '\0';
 
@@ -2038,8 +2036,7 @@ static int cram_populate_ref(cram_fd *fd, int id, ref_entry *r) {
 	    snprintf(cache_root, PATH_MAX, "%s%s/hts-ref", base, extra);
 	    snprintf(cache,PATH_MAX, "%s%s/hts-ref/%%2s/%%2s/%%s", base, extra);
 	    local_cache = cache;
-	    if (fd->verbose)
-		hts_log_info("Populating local cache: %s", local_cache);
+	    hts_log_info("Populating local cache: %s", local_cache);
 	}
     }
 
@@ -2052,8 +2049,7 @@ static int cram_populate_ref(cram_fd *fd, int id, ref_entry *r) {
     if (!(tag = sam_hdr_find_key(fd->header, ty, "M5", NULL)))
 	goto no_M5;
 
-    if (fd->verbose)
-	hts_log_info("Querying ref %s", tag->str+3);
+    hts_log_info("Querying ref %s", tag->str+3);
 
     /* Use cache if available */
     if (local_cache && *local_cache) {
@@ -2164,8 +2160,7 @@ static int cram_populate_ref(cram_fd *fd, int id, ref_entry *r) {
         }
 
 	expand_cache_path(path, local_cache, tag->str+3);
-	if (fd->verbose)
-	    hts_log_info("Writing cache file '%s'", path);
+	hts_log_info("Writing cache file '%s'", path);
 	mkdir_prefix(path, 01777);
 
 	do {
@@ -4072,7 +4067,6 @@ cram_fd *cram_dopen(hFILE *fp, const char *filename, const char *mode) {
     fd->ref = NULL;
 
     fd->decode_md = 0;
-    fd->verbose = 0;
     fd->seqs_per_slice = SEQS_PER_SLICE;
     fd->bases_per_slice = BASES_PER_SLICE;
     fd->slices_per_container = SLICE_PER_CNT;
@@ -4340,7 +4334,6 @@ int cram_set_voption(cram_fd *fd, enum hts_fmt_option opt, va_list args) {
 	break;
 
     case CRAM_OPT_VERBOSITY:
-	fd->verbose = va_arg(args, int);
 	break;
 
     case CRAM_OPT_SEQS_PER_SLICE:
diff --git a/cram/cram_structs.h b/cram/cram_structs.h
index eeba679..a50507e 100644
--- a/cram/cram_structs.h
+++ b/cram/cram_structs.h
@@ -706,7 +706,6 @@ typedef struct cram_fd {
 
     // options
     int decode_md; // Whether to export MD and NM tags
-    int verbose;
     int seqs_per_slice;
     int bases_per_slice;
     int slices_per_container;
diff --git a/htslib/hts.h b/htslib/hts.h
index e67a80b..75353f1 100644
--- a/htslib/hts.h
+++ b/htslib/hts.h
@@ -210,7 +210,7 @@ enum hts_fmt_option {
     // CRAM specific
     CRAM_OPT_DECODE_MD,
     CRAM_OPT_PREFIX,
-    CRAM_OPT_VERBOSITY,  // make general
+    CRAM_OPT_VERBOSITY,  // obsolete, use hts_set_log_level() instead
     CRAM_OPT_SEQS_PER_SLICE,
     CRAM_OPT_SLICES_PER_CONTAINER,
     CRAM_OPT_RANGE,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git



More information about the debian-med-commit mailing list