Skip to content

Commit

Permalink
Release 1.2.1: patch release over 1.2, reinstating hts_file_type()
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarshall committed Feb 3, 2015
2 parents bff5efb + 7ebc5ae commit 26229a3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ lib-shared: libhts.so
endif


PACKAGE_VERSION = 1.2
PACKAGE_VERSION = 1.2.1
LIBHTS_SOVERSION = 1


Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Noteworthy changes in release 1.2.1 (3 February 2015)

* Reinstated hts_file_type() and FT_* macros, which were available until 1.1
but briefly removed in 1.2. This function is deprecated and will be removed
in a future release -- you should use hts_detect_format() etc instead


Noteworthy changes in release 1.2 (2 February 2015)

* HTSlib now has a configure script which checks your build environment
Expand Down
23 changes: 23 additions & 0 deletions hts.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,29 @@ char **hts_readlines(const char *fn, int *_n)
return s;
}

// DEPRECATED: To be removed in a future HTSlib release
int hts_file_type(const char *fname)
{
int len = strlen(fname);
if ( !strcasecmp(".vcf.gz",fname+len-7) ) return FT_VCF_GZ;
if ( !strcasecmp(".vcf",fname+len-4) ) return FT_VCF;
if ( !strcasecmp(".bcf",fname+len-4) ) return FT_BCF_GZ;
if ( !strcmp("-",fname) ) return FT_STDIN;

hFILE *f = hopen(fname, "r");
if (f == NULL) return 0;

htsFormat fmt;
if (hts_detect_format(f, &fmt) < 0) { hclose_abruptly(f); return 0; }
if (hclose(f) < 0) return 0;

switch (fmt.format) {
case vcf: return (fmt.compression == no_compression)? FT_VCF : FT_VCF_GZ;
case bcf: return (fmt.compression == no_compression)? FT_BCF : FT_BCF_GZ;
default: return 0;
}
}

/****************
*** Indexing ***
****************/
Expand Down
2 changes: 1 addition & 1 deletion htsfile.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH htsfile 1 "2 February 2015" "htslib-1.2" "Bioinformatics tools"
.TH htsfile 1 "3 February 2015" "htslib-1.2.1" "Bioinformatics tools"
.SH NAME
htsfile \- identify high-throughput sequencing data files
.\"
Expand Down
15 changes: 15 additions & 0 deletions htslib/hts.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,21 @@ extern "C" {
int hts_itr_next(BGZF *fp, hts_itr_t *iter, void *r, void *data);
const char **hts_idx_seqnames(const hts_idx_t *idx, int *n, hts_id2name_f getid, void *hdr); // free only the array, not the values

/**
* hts_file_type() - Convenience function to determine file type
* DEPRECATED: This function has been replaced by hts_detect_format().
* It and these FT_* macros will be removed in a future HTSlib release.
*/
#define FT_UNKN 0
#define FT_GZ 1
#define FT_VCF 2
#define FT_VCF_GZ (FT_GZ|FT_VCF)
#define FT_BCF (1<<2)
#define FT_BCF_GZ (FT_GZ|FT_BCF)
#define FT_STDIN (1<<3)
int hts_file_type(const char *fname);


#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion tabix.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH tabix 1 "2 February 2015" "htslib-1.2" "Bioinformatics tools"
.TH tabix 1 "3 February 2015" "htslib-1.2.1" "Bioinformatics tools"
.SH NAME
.PP
bgzip \- Block compression/decompression utility
Expand Down

0 comments on commit 26229a3

Please sign in to comment.