[med-svn] [Git][med-team/libtabixpp][master] 4 commits: New upstream version 1.1.1
Andreas Tille (@tille)
gitlab at salsa.debian.org
Mon May 2 13:07:03 BST 2022
Andreas Tille pushed to branch master at Debian Med / libtabixpp
Commits:
4197795a by Andreas Tille at 2022-04-29T12:04:20+02:00
New upstream version 1.1.1
- - - - -
0a219cd5 by Andreas Tille at 2022-04-29T12:04:20+02:00
routine-update: New upstream version
- - - - -
543ed149 by Andreas Tille at 2022-04-29T12:04:20+02:00
Update upstream source from tag 'upstream/1.1.1'
Update to upstream version '1.1.1'
with Debian dir 1dc8247c5ed579b5e3c39f0a3c6b577aeb622d67
- - - - -
6b19de25 by Andreas Tille at 2022-05-02T14:06:05+02:00
Proper filename for upstream tarball
- - - - -
12 changed files:
- .gitignore
- Makefile
- README.md
- debian/changelog
- debian/watch
- + guix.scm
- main.cpp
- tabix.cpp
- + tabix.hpp
- + test/vcf_file.vcf.gz
- + test/vcf_file.vcf.gz.gzi
- + test/vcf_file.vcf.gz.tbi
Changes:
=====================================
.gitignore
=====================================
@@ -1,5 +1,6 @@
*.a
*.o
+libtabix.so*
tabix
tabix++
bgzip
=====================================
Makefile
=====================================
@@ -1,26 +1,40 @@
-# Use ?= to allow override from the env or command-line.
-
-CC?= gcc
-CXX?= g++
-CXXFLAGS?= -g -Wall -O2 -fPIC #-m64 #-arch ppc
-INCLUDES?= -Ihtslib
-HTS_HEADERS?= htslib/htslib/bgzf.h htslib/htslib/tbx.h
-HTS_LIB?= htslib/libhts.a
-LIBPATH?= -L. -Lhtslib
-LIBS?= -lhts -lpthread -lm -lbz2 -llzma -lz
-DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE
-PROG= tabix++
-SUBDIRS=.
-
-ifeq ($(OS),Windows_NT)
- LIBS += -lws2_32
-endif
+# Use ?= to allow overriding from the env or command-line, e.g.
+#
+# make CXXFLAGS="-O3 -fPIC" install
+#
+# Package managers will override many of these variables automatically, so
+# this is aimed at making it easy to create packages (Debian packages,
+# FreeBSD ports, MacPorts, pkgsrc, etc.)
+
+CC ?= cc
+CXX ?= c++
+CXXFLAGS ?= -g -Wall -O2 #-m64 #-arch ppc
+CXXFLAGS += -fPIC
+INCLUDES ?= -Ihtslib
+HTS_HEADERS ?= htslib/htslib/bgzf.h htslib/htslib/tbx.h
+HTS_LIB ?= htslib/libhts.a
+LIBPATH ?= -L. -Lhtslib
+
+DESTDIR ?= stage
+PREFIX ?= /usr/local
+STRIP ?= strip
+INSTALL ?= install -c
+MKDIR ?= mkdir -p
+AR ?= ar
+
+DFLAGS = -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE
+BIN = tabix++
+LIB = libtabix.a
+SOVERSION = 1
+SLIB = libtabix.so.$(SOVERSION)
+OBJS = tabix.o
+SUBDIRS = .
.SUFFIXES:.c .o
.c.o:
- $(CC) $(CPPFLAGS) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+ $(CC) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
all-recur lib-recur clean-recur cleanlocal-recur install-recur:
@target=`echo $@ | sed s/-recur//`; \
@@ -33,20 +47,42 @@ all-recur lib-recur clean-recur cleanlocal-recur install-recur:
cd $$wdir; \
done;
-all: $(PROG)
+all: $(BIN) $(LIB) $(SLIB)
tabix.o: $(HTS_HEADERS) tabix.cpp tabix.hpp
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
+ $(CXX) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
htslib/libhts.a:
cd htslib && $(MAKE) lib-static
-tabix++: tabix.o main.cpp $(HTS_LIB)
- $(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) $(LIBS)
+$(LIB): $(OBJS)
+ $(AR) rs $(LIB) $(OBJS)
+
+$(SLIB): $(OBJS)
+ $(CXX) -shared -Wl,-soname,$(SLIB) -o $(SLIB) $(OBJS)
+
+tabix++: $(OBJS) main.cpp $(HTS_LIB)
+ $(CXX) $(CXXFLAGS) -o $@ main.cpp $(OBJS) $(INCLUDES) $(LIBPATH) \
+ -lhts -lpthread -lm -lz -lcurl -llzma -lbz2
+
+test: all
+ ./tabix++ test/vcf_file.vcf.gz
+
+install: all
+ $(MKDIR) $(DESTDIR)$(PREFIX)/bin
+ $(MKDIR) $(DESTDIR)$(PREFIX)/include
+ $(MKDIR) $(DESTDIR)$(PREFIX)/lib
+ $(INSTALL) $(BIN) $(DESTDIR)$(PREFIX)/bin
+ $(INSTALL) *.hpp $(DESTDIR)$(PREFIX)/include
+ $(INSTALL) $(LIB) $(SLIB) $(DESTDIR)$(PREFIX)/lib
+
+install-strip: install
+ $(STRIP) $(DESTDIR)$(PREFIX)/bin/$(BIN) $(DESTDIR)$(PREFIX)/lib/$(SLIB)
cleanlocal:
- rm -fr gmon.out *.o a.out *.dSYM $(PROG) *~ *.a tabix.aux tabix.log \
- tabix.pdf *.class libtabix.*.dylib libtabix.so*
+ rm -rf $(BIN) $(LIB) $(SLIB) $(OBJS) $(DESTDIR)
+ rm -fr gmon.out *.o a.out *.dSYM $(BIN) *~ *.a tabix.aux tabix.log \
+ tabix.pdf *.class libtabix.*.dylib
cd htslib && $(MAKE) clean
-clean:cleanlocal-recur
+clean: cleanlocal-recur
=====================================
README.md
=====================================
@@ -1,5 +1,26 @@
-This is a C++ wrapper around [tabix
-project](http://samtools.sourceforge.net/tabix.shtml) which abstracts some
-of the details of opening and jumping in tabix-indexed files.
+This is a C++ wrapper around [tabix project](http://samtools.sourceforge.net/tabix.shtml) which abstracts some of the details of opening and jumping in tabix-indexed files.
+
+# Build
+
+```sh
+git submodule update --init --recursive
+make CC=gcc -j 16
+make test
+```
+
+See also [guix.scm](./guix.scm) for the build environment we test with.
+
+# Dependencies
+
+tabixpp has htslib as a dependency. If you want to build from the included submodule make sure that the following dependencies are available:
+
+```
+libcurl libcurl - Library to transfer files with ftp, http, etc.
+zlib zlib - zlib compression library
+liblzma liblzma - General purpose data compression library
+```
+
+It is also possible to disable these inside htslib/config.h --- generated after the first build.
+
Author: Erik Garrison <erik.garrison at gmail.com>
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libtabixpp (1.1.1-1) UNRELEASED; urgency=medium
+
+ * New upstream version
+ * Proper filename for upstream tarball
+
+ -- Andreas Tille <tille at debian.org> Fri, 29 Apr 2022 12:04:20 +0200
+
libtabixpp (1.1.0-6) unstable; urgency=medium
[ Matthias Klose ]
=====================================
debian/watch
=====================================
@@ -1,2 +1,4 @@
version=4
-https://github.com/ekg/tabixpp/tags .*/v?(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
+
+opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE at -$1.tar.gz%" \
+ https://github.com/ekg/tabixpp/tags .*/v?(\d.*)\.(?:tgz|tbz2|txz|tar\.(?:gz|bz2|xz))
=====================================
guix.scm
=====================================
@@ -0,0 +1,75 @@
+;; To use this file to build HEAD of tabixpp:
+;;
+;; guix build -f guix.scm
+;;
+;; To get a development container (emacs shell will work)
+;;
+;; guix shell -C -D -f guix.scm
+;;
+;; For the tests you need /usr/bin/env. In a container create it with
+;;
+;; mkdir -p /usr/bin ; ln -s $GUIX_ENVIRONMENT/bin/env /usr/bin/env
+;;
+;; or in one go
+;;
+;; guix shell -C -D -f guix.scm -- bash --init-file <(echo "mkdir -p /usr/bin && ln -s \$GUIX_ENVIRONMENT/bin/env /usr/bin/env")
+;;
+;; make CC=gcc -j 16
+
+(use-modules
+ ((guix licenses) #:prefix license:)
+ (guix gexp)
+ (guix packages)
+ (guix git-download)
+ (guix build-system cmake)
+ (gnu packages algebra)
+ (gnu packages base)
+ (gnu packages compression)
+ (gnu packages bioinformatics)
+ (gnu packages build-tools)
+ (gnu packages curl)
+ (gnu packages gcc)
+ (gnu packages gdb)
+ (gnu packages haskell-xyz) ; pandoc for help files
+ (gnu packages llvm)
+ (gnu packages parallel)
+ (gnu packages perl)
+ (gnu packages perl6)
+ (gnu packages pkg-config)
+ (gnu packages python)
+ (gnu packages python-xyz) ; for pybind11
+ (gnu packages ruby)
+ (gnu packages version-control)
+ (srfi srfi-1)
+ (ice-9 popen)
+ (ice-9 rdelim))
+
+(define %source-dir (dirname (current-filename)))
+
+(define %git-commit
+ (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ)))
+
+(define-public tabixpp-git
+ (package
+ (name "tabixpp-git")
+ (version (git-version "1.0.0" "HEAD" %git-commit))
+ (source (local-file %source-dir #:recursive? #t))
+ (build-system cmake-build-system)
+ (inputs
+ `(("curl" ,curl)
+ ("gcc" ,gcc-11) ;; test
+ ("gdb" ,gdb)
+ ;; ("htslib" ,htslib)
+ ;; ("tabixpp" ,tabixpp)
+ ("xz" ,xz)
+ ("zlib" ,zlib)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)
+ ("git" ,git)))
+ (home-page "https://github.com/tabixpp/tabixpp/")
+ (synopsis "C++ wrapper library for tabix")
+ (description "
+C++ wrapper around tabix project which abstracts some of the details of opening and jumping in tabix-indexed files.")
+ (license license:expat)))
+
+tabixpp-git
=====================================
main.cpp
=====================================
@@ -3,13 +3,16 @@
using namespace std;
+const string VERSION = "1.1.1";
+
int main(int argc, char** argv) {
if (argc < 2) {
- cerr << argv[0] << " [file] [ [region] ... ]" << endl
+ cout << argv[0] << " [file] [ [region] ... ]" << endl
<< "Writes out regions from bgzf-compressed, tabix-indexed file." << endl
<< "Supply 'header' to print out the header, and no regions to" << endl
- << "print the contents of the entire file." << endl;
+ << "print the contents of the entire file." << endl << endl
+ << "Version " << VERSION << endl;
return 1;
}
@@ -22,7 +25,7 @@ int main(int argc, char** argv) {
Tabix file(filename);
if (!regions.empty()) {
- for (vector<string>::iterator r = regions.begin(); r != regions.end(); ++r) {
+ for (vector<string>::iterator r = regions.begin(); r != regions.end(); ++r) {
string& region = *r;
if (region == "header") {
string header;
=====================================
tabix.cpp
=====================================
@@ -12,18 +12,32 @@ Tabix::Tabix(string& file) {
struct stat stat_tbi,stat_vcf;
char *fnidx = (char*) calloc(strlen(cfilename) + 5, 1);
strcat(strcpy(fnidx, cfilename), ".tbi");
- if ( bgzf_is_bgzf(cfilename)!=1 )
+
+ hFILE *fp;
+ if (!(fp = hopen(cfilename, "r"))) {
+ cerr << "can't open " << cfilename;
+ return;
+ }
+
+ htsFormat fmt;
+ if ( hts_detect_format(fp,&fmt) < 0 )
{
cerr << "[tabix++] was bgzip used to compress this file? " << file << endl;
free(fnidx);
exit(1);
}
+ if (hclose(fp) != 0) {
+ cerr << "can't close " << cfilename;
+ return;
+ }
+
// Common source of errors: new VCF is used with an old index
stat(fnidx, &stat_tbi);
stat(cfilename, &stat_vcf);
if ( stat_vcf.st_mtime > stat_tbi.st_mtime )
{
cerr << "[tabix++] the index file is older than the vcf file. Please use '-f' to overwrite or reindex." << endl;
+
free(fnidx);
exit(1);
}
@@ -117,11 +131,11 @@ bool Tabix::getNextLine(string& line) {
bool Tabix::getNextLineKS() {
if (has_jumped) {
- if (iter &&
+ if (iter &&
tbx_itr_next(fn, tbx, iter, &str) >= 0) {
//line = &str;
return true;
- } else
+ } else
return false;
} else { // step through all sequences in the file
// we've never jumped, so read everything
=====================================
tabix.hpp
=====================================
@@ -0,0 +1,41 @@
+#include <string>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include "htslib/bgzf.h"
+#include "htslib/tbx.h"
+#include "htslib/kseq.h"
+#include "htslib/hfile.h"
+#include <iostream>
+#include <cstring>
+#include <vector>
+
+
+using namespace std;
+
+class Tabix {
+
+ htsFile* fn;
+ tbx_t* tbx;
+ kstring_t str;
+ hts_itr_t* iter;
+ const tbx_conf_t *idxconf;
+ int tid, beg, end;
+ string firstline;
+ bool has_jumped;
+ vector<string>::iterator current_chrom;
+
+public:
+ string filename;
+ vector<string> chroms;
+
+ Tabix(void);
+ Tabix(string& file);
+ ~Tabix(void);
+
+ const kstring_t * getKstringPtr();
+ void getHeader(string& header);
+ bool setRegion(string& region);
+ bool getNextLine(string& line);
+ bool getNextLineKS();
+
+};
=====================================
test/vcf_file.vcf.gz
=====================================
Binary files /dev/null and b/test/vcf_file.vcf.gz differ
=====================================
test/vcf_file.vcf.gz.gzi
=====================================
Binary files /dev/null and b/test/vcf_file.vcf.gz.gzi differ
=====================================
test/vcf_file.vcf.gz.tbi
=====================================
Binary files /dev/null and b/test/vcf_file.vcf.gz.tbi differ
View it on GitLab: https://salsa.debian.org/med-team/libtabixpp/-/compare/2d1a315d79fbd9d7fcd8879f070278dfe9be0947...6b19de25df96620f12092651016ab7aba73d55c3
--
View it on GitLab: https://salsa.debian.org/med-team/libtabixpp/-/compare/2d1a315d79fbd9d7fcd8879f070278dfe9be0947...6b19de25df96620f12092651016ab7aba73d55c3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220502/02386a46/attachment-0001.htm>
More information about the debian-med-commit
mailing list