Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous trivia and minor fixes #1705

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ INSTALL_PROGRAM = $(INSTALL)
plugindir =

BUILT_PROGRAMS = \
annot-tsv \
bgzip \
htsfile \
tabix \
annot-tsv
tabix

BUILT_TEST_PROGRAMS = \
test/hts_endian \
Expand Down Expand Up @@ -153,10 +153,6 @@ LIBHTS_SOVERSION = 3
MACH_O_COMPATIBILITY_VERSION = 3.1.18
MACH_O_CURRENT_VERSION = 3.1.18

# $(NUMERIC_VERSION) is for items that must have a numeric X.Y.Z string
# even if this is a dirty or untagged Git working tree.
NUMERIC_VERSION := $(shell $(srcdir)/version.sh numeric)

# Force version.h to be remade if $(PACKAGE_VERSION) has changed.
version.h: $(if $(wildcard version.h),$(if $(findstring "$(PACKAGE_VERSION)",$(shell cat version.h)),,force))

Expand All @@ -168,7 +164,6 @@ print-version:

show-version:
@echo PACKAGE_VERSION = $(PACKAGE_VERSION)
@echo NUMERIC_VERSION = $(NUMERIC_VERSION)

config_vars.h: override escape=$(subst ',\x27,$(subst ",\",$(subst \,\\,$(1))))
config_vars.h: override hts_cc_escaped=$(call escape,$(CC))
Expand Down Expand Up @@ -352,7 +347,6 @@ print-config:
@echo HTS_CFLAGS_AVX2 = $(HTS_CFLAGS_AVX2)
@echo HTS_CFLAGS_AVX512 = $(HTS_CFLAGS_AVX512)
@echo HTS_CFLAGS_SSE4 = $(HTS_CFLAGS_SSE4)
@echo HTS_HAVE_NEON = $(HTS_HAVE_NEON)
@echo LDFLAGS = $(LDFLAGS)
@echo LIBHTS_OBJS = $(LIBHTS_OBJS)
@echo LIBS = $(LIBS)
Expand Down Expand Up @@ -506,6 +500,9 @@ htscodecs/htscodecs/rANS_static32x16pr_avx2.o htscodecs/htscodecs/rANS_static32x
htscodecs/htscodecs/rANS_static32x16pr_avx512.o htscodecs/htscodecs/rANS_static32x16pr_avx512.pico: TARGET_CFLAGS = $(HTS_CFLAGS_AVX512)
htscodecs/htscodecs/rANS_static32x16pr_sse4.o htscodecs/htscodecs/rANS_static32x16pr_sse4.pico: TARGET_CFLAGS = $(HTS_CFLAGS_SSE4)

annot-tsv: annot-tsv.o libhts.a
$(CC) $(LDFLAGS) -o $@ annot-tsv.o libhts.a $(LIBS) -lpthread

bgzip: bgzip.o libhts.a
$(CC) $(LDFLAGS) -o $@ bgzip.o libhts.a $(LIBS) -lpthread

Expand All @@ -515,13 +512,10 @@ htsfile: htsfile.o libhts.a
tabix: tabix.o libhts.a
$(CC) $(LDFLAGS) -o $@ tabix.o libhts.a $(LIBS) -lpthread

annot-tsv: annot-tsv.o libhts.a
$(CC) $(LDFLAGS) -o $@ annot-tsv.o libhts.a $(LIBS) -lpthread

annot-tsv.o: annot-tsv.c config.h $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_regidx_h)
bgzip.o: bgzip.c config.h $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_hfile_h)
htsfile.o: htsfile.c config.h $(htslib_hfile_h) $(htslib_hts_h) $(htslib_sam_h) $(htslib_vcf_h)
tabix.o: tabix.c config.h $(htslib_tbx_h) $(htslib_sam_h) $(htslib_vcf_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_hts_h) $(htslib_regidx_h) $(htslib_hts_defs_h) $(htslib_hts_log_h)
annot-tsv.o: annot-tsv.c config.h $(htslib_hts_h) $(htslib_hts_defs_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_kseq_h) $(htslib_bgzf_h) $(htslib_regidx_h)

# Runes to check that the htscodecs submodule is present
ifdef HTSCODECS_SOURCES
Expand Down Expand Up @@ -868,7 +862,7 @@ install: libhts.a $(BUILT_PROGRAMS) $(BUILT_PLUGINS) installdirs install-$(SHLIB
if test -n "$(BUILT_PLUGINS)"; then $(INSTALL_PROGRAM) $(BUILT_PLUGINS) $(DESTDIR)$(plugindir); fi
$(INSTALL_DATA) $(SRC)htslib/*.h $(DESTDIR)$(includedir)/htslib
$(INSTALL_DATA) libhts.a $(DESTDIR)$(libdir)/libhts.a
$(INSTALL_MAN) $(SRC)bgzip.1 $(SRC)htsfile.1 $(SRC)tabix.1 $(DESTDIR)$(man1dir)
$(INSTALL_MAN) $(SRC)annot-tsv.1 $(SRC)bgzip.1 $(SRC)htsfile.1 $(SRC)tabix.1 $(DESTDIR)$(man1dir)
$(INSTALL_MAN) $(SRC)faidx.5 $(SRC)sam.5 $(SRC)vcf.5 $(DESTDIR)$(man5dir)
$(INSTALL_MAN) $(SRC)htslib-s3-plugin.7 $(DESTDIR)$(man7dir)

Expand Down
1 change: 0 additions & 1 deletion config.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,3 @@ endif
HTS_CFLAGS_AVX2 = @hts_cflags_avx2@
HTS_CFLAGS_AVX512 = @hts_cflags_avx512@
HTS_CFLAGS_SSE4 = @hts_cflags_sse4@
HTS_HAVE_NEON = @hts_have_neon@
7 changes: 4 additions & 3 deletions cram/cram_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,11 @@ int cram_index_container(cram_fd *fd,
int ret;

spos = htell(fd->fp);
if (spos - cpos - c->offset != c->landmark[j]) {
if (spos - cpos - (off_t) c->offset != c->landmark[j]) {
hts_log_error("CRAM slice offset %"PRId64" does not match"
" landmark %d in container header (%d)",
spos - cpos - c->offset, j, c->landmark[j]);
" landmark %d in container header (%"PRId32")",
(int64_t) (spos - cpos - (off_t) c->offset),
j, c->landmark[j]);
return -1;
}

Expand Down
12 changes: 7 additions & 5 deletions htslib/sam.h
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ int sam_prob_realn(bam1_t *b, const char *ref, hts_pos_t ref_len, int flag);
@field canonical_base The canonical base referred to in the MM tag.
One of A, C, G, T or N. Note this may not be the
explicit base recorded in the SEQ column (esp. if N).
@field stran 0 or 1, indicating + or - strand from MM tag.
@field strand 0 or 1, indicating + or - strand from MM tag.
@field qual Quality code (256*probability), or -1 if unknown

@discussion
Expand All @@ -2230,10 +2230,10 @@ typedef struct hts_base_mod {
int qual;
} hts_base_mod;

#define HTS_MOD_UNKNOWN -1 // In MM but no ML
#define HTS_MOD_UNKNOWN -1 // In MM but not ML
#define HTS_MOD_UNCHECKED -2 // Not in MM and in explicit mode

// Flags for hts_parse_basemod2
// Flags for bam_parse_basemod2
#define HTS_MOD_REPORT_UNCHECKED 1

/// Allocates an hts_base_mode_state.
Expand All @@ -2259,7 +2259,7 @@ hts_base_mod_state *hts_base_mod_state_alloc(void);
HTSLIB_EXPORT
void hts_base_mod_state_free(hts_base_mod_state *state);

/// Parses the Mm and Ml tags out of a bam record.
/// Parses the MM and ML tags out of a bam record.
/**
* @param b BAM alignment record
* @param state The base modification state pointer.
Expand All @@ -2268,11 +2268,12 @@ void hts_base_mod_state_free(hts_base_mod_state *state);
*
* This fills out the contents of the modification state, resetting the
* iterator location to the first sequence base.
* (Parses the draft Mm/Ml tags instead if MM and/or ML are not present.)
*/
HTSLIB_EXPORT
int bam_parse_basemod(const bam1_t *b, hts_base_mod_state *state);

/// Parses the Mm and Ml tags out of a bam record.
/// Parses the MM and ML tags out of a bam record.
/**
* @param b BAM alignment record
* @param state The base modification state pointer.
Expand All @@ -2283,6 +2284,7 @@ int bam_parse_basemod(const bam1_t *b, hts_base_mod_state *state);
*
* This fills out the contents of the modification state, resetting the
* iterator location to the first sequence base.
* (Parses the draft Mm/Ml tags instead if MM and/or ML are not present.)
*/
HTSLIB_EXPORT
int bam_parse_basemod2(const bam1_t *b, hts_base_mod_state *state,
Expand Down