Skip to content

Commit

Permalink
Merge pull request #14 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
sync master with develop (release 0.9 prep)
  • Loading branch information
dozy authored Aug 9, 2016
2 parents 9219630 + be636bb commit cfef8aa
Show file tree
Hide file tree
Showing 255 changed files with 7,294 additions and 157 deletions.
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Control file for continuous integration testing at http://travis-ci.org/

language: c

addons:
apt:
packages:
- liblzma-dev

matrix:
include:
- os: linux
compiler: clang
- os: linux
compiler: gcc
# An unoptimised C99 build, for detecting non-static inline functions
- os: linux
compiler: gcc
env: CFLAGS="-std=gnu99 -O0"
- os: osx
compiler: gcc

env:
global:
- HTSLIB=`pwd`/htslib
- HTSDIR=$HTSLIB/b
- SAMTOOLSDIR=samtools
- PATH=$SAMTOOLSDIR:$PATH

install:
- .travis/clone ${HTSREPO:-git://github.com/samtools/htslib.git} $HTSLIB master
- .travis/clone ${HTSREPO:-git://github.com/samtools/samtools.git} $SAMTOOLSDIR master

before_script:
- (cd $HTSLIB && autoreconf && mkdir b && ./configure --prefix=$HTSDIR && make && make install)
- (cd $SAMTOOLSDIR && autoconf && make)

script: autoreconf -i && ./configure -V && ./configure --with-htslib=$HTSDIR && make -e && make -e check
14 changes: 14 additions & 0 deletions .travis/clone
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Usage: .travis/clone REPOSITORY [DIR] [BRANCH]
#
# Creates a shallow clone, checking out the specified branch. If BRANCH is
# omitted or if there is no branch with that name, checks out origin/HEAD.

repository=$1
localdir=$2
branch=$3

[ -n "$branch" ] && ref=$(git ls-remote --heads $repository $branch)

set -x
git clone --depth=1 ${ref:+--branch=$branch} $repository $localdir
129 changes: 0 additions & 129 deletions Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ACLOCAL_AMFLAGS= -I m4
TESTS = test/posfile/t_posfile test/filterfile/t_filterfile test/bclfile/t_bclfile test/decode/t_decode test/i2b/t_i2b
SUBDIRS = src test/posfile test/bclfile test/filterfile test/decode test/i2b
dist_doc_DATA = README.md LICENSE
AM_COLOR_TESTS=always
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# bambi
A set of programs to manipulate SAM/BAM/CRAM files, using HTSLIB

to install:


clone into a local directory (eg 'bambi')

cd bambi
autoreconf -i
configure --prefix=<place to install> --with-htslib=<directory containing a htslib release>

(eg configure --prefix=/usr/local/bambi --with-htslib=/usr/local/htslib/1.3)

make

make check (to run tests)



4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
# configure, the main Makefile contains suitable conservative defaults.


HTSDIR = /software/solexa/pkg/htslib/htslib-1.3
### include $(HTSDIR)/src/htslib.mk
HTSDIR = ../htslib
include $(HTSDIR)/htslib.mk
HTSLIB = $(HTSDIR)/libhts.a
HTSLIB_LIB = $(HTSLIB)
BGZIP = $(HTSDIR)/bin/bgzip
Expand Down
33 changes: 33 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
AC_INIT([bambi], m4_esyscmd_s([git describe --dirty --always --tags]), [[email protected]])
AC_ARG_VAR(HTSDIR,Directory to look for hts)
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_PROG_CC

LT_INIT

AC_CONFIG_MACRO_DIR([m4])

AX_WITH_HTSLIB

AC_CONFIG_HEADERS([config.h])

saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
CPPFLAGS="$HTSLIB_CPPFLAGS"
LDFLAGS="$HTSLIB_LDFLAGS"
AC_CHECK_HEADERS([cram/sam_header.h])
AC_CHECK_LIB([hts], [bam_aux_update_str], [AC_DEFINE([HAVE_BAM_AUX_UPDATE_STR],[1],[Does htslib contain bam_aux_update_str()?])])
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"

AC_CONFIG_FILES([
Makefile
src/Makefile
test/posfile/Makefile
test/bclfile/Makefile
test/filterfile/Makefile
test/decode/Makefile
test/i2b/Makefile
])
AC_OUTPUT

117 changes: 117 additions & 0 deletions m4/ax_with_htslib.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#
# SYNOPSIS
#
# AX_WITH_HTSLIB()
#
# DESCRIPTION
#
# This macro searches for the header files and libraries of a htslib
# (https://github.com/samtools/htslib) installation. If --with-htslib is specified
# without argument, or as --with-htslib=yes, a packaged (.deb or
# .rpm) installation is assumed and the default system paths will be
# searched. If --with-htslib=DIR is specified, a run-in-place htslib
# installation will be searched for in DIR.
#
# The system header and library paths will be used for run-in-place
# iRODS installation dependencies, in preference to the those
# dependencies provided by iRODS in its 'externals' directory
# because the latter cannot be determined reliably.
#
# The macro defines the symbol HAVE_HTSLIB if the library is found
# and the following output variables are set with AC_SUBST:
#
# HTSLIB_CPPFLAGS
# HTSLIB_LDFLAGS
# HTSLIB_LIBS
#
# You can use them like this in Makefile.am:
#
# AM_CPPFLAGS = $(HTSLIB_CPPFLAGS)
# AM_LDFLAGS = $(HTSLIB_LDFLAGS)
# library_la_LIBADD = $(HTSLIB_LIBS)
# program_LDADD = $(HTSLIB_LIBS)
#
# LICENSE
#
# Copyright (C) 2016, Genome Research Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

AC_DEFUN([AX_WITH_HTSLIB], [
HTSLIB_HOME=
HTSLIB_CPPFLAGS=
HTSLIB_LDFLAGS=
HTSLIB_LIBS=
saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
saved_LIBS="$LIBS"
AC_ARG_WITH([htslib],
[AS_HELP_STRING([--with-htslib[[=DIR]]], [select htslib directory])], [
AS_IF([test "x$with_htslib" != "xno"], [
AS_IF([test "x$with_htslib" = "xyes"], [
AC_MSG_CHECKING([for packaged htslib])
CPPFLAGS="-I/usr/include/htslib $CPPFLAGS"
LDFLAGS="-L/usr/lib/htslib/externals $LDFLAGS"
], [
HTSLIB_HOME="$with_htslib"
CPPFLAGS="-I$HTSLIB_HOME/include $CPPFLAGS"
LDFLAGS="-L$HTSLIB_HOME/lib $LDFLAGS"
])
LIBS="$HTSLIB_HOME/lib/libhts.a -lz -ldl -lbz2 -llzma -lpthread"
AC_MSG_CHECKING([checking htslib version])
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include "htslib/hts.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
], [
char *v=strdup(hts_version());
char *s = strtok(v,".-");
int n = atoi(s) * 100000;
s = strtok(NULL,".-");
if (s) n += atoi(s) * 1000;
s = strtok(NULL,".-");
if (s) n += atoi(s) * 10;
printf(" n=%d ",n);
if(n>=103010) return 0;
else exit(-1);
])
], [AC_MSG_RESULT([Ok])],
[AC_MSG_ERROR([htslib version must be 1.3.1 or greater])]
)
HTSLIB_CPPFLAGS="$CPPFLAGS"
HTSLIB_LDFLAGS="$LDFLAGS"
HTSLIB_LIBS="$LIBS"
CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS"
LIBS="$saved_LIBS"
unset saved_CPPFLAGS
unset saved_LDFLAGS
unset saved_LIBS
AC_SUBST([HTSLIB_HOME])
AC_SUBST([HTSLIB_CPPFLAGS])
AC_SUBST([HTSLIB_LDFLAGS])
AC_SUBST([HTSLIB_LIBS])
])
])
])
7 changes: 7 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AM_CPPFLAGS = $(HTSLIB_CPPFLAGS)
AM_LDFLAGS = -rdynamic $(HTSLIB_LDFLAGS)

bin_PROGRAMS = bambi
bambi_SOURCES = bambi.c bclfile.c decode.c filterfile.c hts_addendum.c i2b.c posfile.c
bambi_CFLAGS = -I/usr/include/libxml2
bambi_LDADD = $(HTSLIB_HOME)/lib/libhts.a -ldl -lxml2 -lz -llzma -lbz2 -lpthread
Loading

0 comments on commit cfef8aa

Please sign in to comment.