Skip to content

Commit

Permalink
Merge branch 'master' into candidate-scoring-gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
vellamike authored Sep 20, 2018
2 parents 585302a + f1de746 commit 0cec8f9
Show file tree
Hide file tree
Showing 15 changed files with 1,389 additions and 96 deletions.
41 changes: 38 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
# travis.yml for github.com/jts/nanopolish

language: cpp
dist: trusty
sudo: false
language: generic
cache: apt
git:
depth: 1

matrix:
include:
# Set env for both nanoplish and the dependency hdf5.
- env:
- CC=gcc-4.8
- CXX=g++-4.8
- AR=gcc-ar-4.8
- NM=gcc-nm-4.8
- RANLIB=gcc-ranlib-4.8
- env:
- CC=gcc-8
- CXX=g++-8
- AR=gcc-ar-8
- NM=gcc-nm-8
- RANLIB=gcc-ranlib-8

# Install and export newer gcc
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -qq g++-4.8
- |
if [[ "${CC}" =~ ^gcc- ]]; then
echo "Installing ${CC}."
sudo apt-get install -qq "${CC}"
fi
- |
if [[ "${CXX}" =~ ^g\+\+- ]]; then
echo "Installing ${CXX}."
sudo apt-get install -qq "${CXX}"
fi
script: make CXX=g++-4.8 nanopolish && make CXX=g++-4.8 test
script:
# Suppress all compiler warnings for hdf5 Makefile
# to display the log without downloading the raw log on Travis log page.
# Travis finishs with error when exceeding the limit of 4 MB of log length.
- export H5_CFLAGS="-w"
- make nanopolish && make test
63 changes: 36 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ SUBDIRS := src src/hmm src/thirdparty src/thirdparty/scrappie src/common src/ali
#

#Basic flags every build needs
LIBS=-lz
CXXFLAGS ?= -O3
LIBS = -lz
CXXFLAGS ?= -g -O3
CXXFLAGS += -std=c++11 -fopenmp -fsigned-char
CFLAGS ?= -std=c99 -O3
CXX ?= g++
Expand All @@ -19,9 +19,9 @@ NVCCFLAGS ?= -std=c++11 -I. -I/usr/local/cuda-9.0include -O3 -use_fast_math --de
CURTFLAGS ?= -L/usr/local/cuda-9.0/lib64 -lcudart

# Change the value of HDF5, EIGEN, or HTS below to any value to disable compilation of bundled code
HDF5?=install
EIGEN?=install
HTS?=install
HDF5 ?= install
EIGEN ?= install
HTS ?= install

# Check operating system, OSX doesn't have -lrt
UNAME_S := $(shell uname -s)
Expand All @@ -31,53 +31,54 @@ endif

# Default to automatically installing hdf5
ifeq ($(HDF5), install)
H5_LIB=./lib/libhdf5.a
H5_INCLUDE=-I./include
H5_LIB = ./lib/libhdf5.a
H5_INCLUDE = -I./include
LIBS += -ldl
else
# Use system-wide hdf5
H5_LIB=
H5_INCLUDE=
H5_LIB =
H5_INCLUDE =
LIBS += -lhdf5
endif

# Default to automatically installing EIGEN
ifeq ($(EIGEN), install)
EIGEN_CHECK=eigen/INSTALL
EIGEN_CHECK = eigen/INSTALL
else
# Use system-wide eigen
EIGEN_CHECK=
EIGEN_CHECK =
endif

# Default to build and link the libhts submodule
ifeq ($(HTS), install)
HTS_LIB=./htslib/libhts.a
HTS_INCLUDE=-I./htslib
HTS_LIB = ./htslib/libhts.a
HTS_INCLUDE = -I./htslib
else
# Use system-wide htslib
HTS_LIB=
HTS_INCLUDE=
HTS_LIB =
HTS_INCLUDE =
LIBS += -lhts
endif

# Include the header-only fast5 library
FAST5_INCLUDE=-I./fast5/include
FAST5_INCLUDE = -I./fast5/include

# Include the header-only eigen library
EIGEN_INCLUDE=-I./eigen/
EIGEN_INCLUDE = -I./eigen/

# Include the src subdirectories
NP_INCLUDE=$(addprefix -I./, $(SUBDIRS))
NP_INCLUDE = $(addprefix -I./, $(SUBDIRS))

CUDA_INCLUDE=-I/usr/local/cuda-9.0/include

# Add include flags
CPPFLAGS += $(H5_INCLUDE) $(HTS_INCLUDE) $(FAST5_INCLUDE) $(NP_INCLUDE) $(EIGEN_INCLUDE) $(CUDA_INCLUDE)

# Main programs to build
PROGRAM=nanopolish
TEST_PROGRAM=nanopolish_test
PROGRAM = nanopolish
TEST_PROGRAM = nanopolish_test

.PHONY: all
all: $(PROGRAM) $(TEST_PROGRAM)

#
Expand All @@ -90,15 +91,20 @@ htslib/libhts.a:
# If this library is a dependency the user wants HDF5 to be downloaded and built.
#
lib/libhdf5.a:
if [ ! -e hdf5-1.8.14.tar.gz ]; then wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.14/src/hdf5-1.8.14.tar.gz; fi
if [ ! -e hdf5-1.8.14.tar.gz ]; then \
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.14/src/hdf5-1.8.14.tar.gz; \
fi
tar -xzf hdf5-1.8.14.tar.gz || exit 255
cd hdf5-1.8.14 && ./configure --enable-threadsafe --prefix=`pwd`/.. && make && make install

cd hdf5-1.8.14 && \
./configure --enable-threadsafe --prefix=`pwd`/.. && \
make && make install

# Download and install eigen if not already downloaded
eigen/INSTALL:
if [ ! -e 3.2.5.tar.bz2 ]; then wget http://bitbucket.org/eigen/eigen/get/3.2.5.tar.bz2; fi
tar -xjvf 3.2.5.tar.bz2 || exit 255
if [ ! -e 3.2.5.tar.bz2 ]; then \
wget http://bitbucket.org/eigen/eigen/get/3.2.5.tar.bz2; \
fi
tar -xjf 3.2.5.tar.bz2 || exit 255
mv eigen-eigen-bdd17ee3b1b3 eigen || exit 255

#
Expand All @@ -109,7 +115,7 @@ eigen/INSTALL:
CPP_SRC := $(foreach dir, $(SUBDIRS), $(wildcard $(dir)/*.cpp))
CU_SRC := $(foreach dir, $(SUBDIRS), $(wildcard $(dir)/*.cu))
C_SRC := $(foreach dir, $(SUBDIRS), $(wildcard $(dir)/*.c))
EXE_SRC=src/main/nanopolish.cpp src/test/nanopolish_test.cpp
EXE_SRC = src/main/nanopolish.cpp src/test/nanopolish_test.cpp

# Automatically generated object names
CPP_OBJ=$(CPP_SRC:.cpp=.o)
Expand All @@ -119,7 +125,7 @@ CU_OBJ=$(CU_SRC:.cu=.o)
.SUFFIXES: .cu

# Generate dependencies
PHONY=depend
.PHONY: depend
depend: .depend

.depend: $(CPP_SRC) $(C_SRC) $(CU_SRC) $(EXE_SRC) $(H5_LIB) $(EIGEN_CHECK)
Expand All @@ -146,8 +152,11 @@ $(PROGRAM): src/main/nanopolish.o $(CU_OBJ) $(CPP_OBJ) $(C_OBJ) $(HTS_LIB) $(H5_
$(TEST_PROGRAM): src/test/nanopolish_test.o $(CPP_OBJ) $(CU_OBJ) $(C_OBJ) $(HTS_LIB) $(H5_LIB)
$(CXX) -o $@ $(CXXFLAGS) $(CPPFLAGS) -fPIC $< $(CPP_OBJ) $(CU_OBJ) $(C_OBJ) $(HTS_LIB) $(H5_LIB) $(LIBS) $(LDFLAGS) $(CURTFLAGS)

.PHONY: test
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)

.PHONY: clean
clean:
rm -f $(PROGRAM) $(TEST_PROGRAM) $(CPP_OBJ) $(CU_OBJ) $(C_OBJ) src/main/nanopolish.o src/test/nanopolish_test.o
src/main/nanopolish.o src/test/nanopolish_test.o
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Software package for signal-level analysis of Oxford Nanopore sequencing data. N

## Release notes

* 0.10.2: added new program `nanopolish polya` to estimate the length of poly-A tails on direct RNA reads (by @paultsw)

* 0.10.1: `nanopolish variants --consensus` now only outputs a VCF file instead of a fasta sequence. The VCF file describes the changes that need to be made to turn the draft sequence into the polished assembly. A new program, `nanopolish vcf2fasta`, is provided to generate the polished genome (this replaces `nanopolish_merge.py`, see usage instructions below). This change is to avoid issues when merging segments that end on repeat boundaries (reported by Michael Wykes and Chris Wright).

## Dependencies
Expand Down
15 changes: 13 additions & 2 deletions docs/source/quickstart_consensus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,24 @@ First, we align the original reads (``reads.fasta``) to the draft assembly (``dr
Then we run the consensus algorithm. For larger datasets we use ``nanopolish_makerange.py`` to split the draft genome assembly into 50kb segments, so that we can run the consensus algorithm on each segment in parallel. The output would be the polished segments in ``fasta`` format.
Since our dataset is only covering a 2kb region, we skip this step and use the following command: ::

nanopolish variants --consensus polished.fa \
nanopolish variants --consensus -o polished.vcf \
-w "tig00000001:200000-202000" \
-r reads.fasta \
-b reads.sorted.bam \
-g draft.fa

We are left with our desired output: ``polished.fa``.
We are left with: ``polished.vcf``.

**Note**: As of v0.10.1, ``nanopolish variants --consensus`` only outputs a VCF file instead of a fasta sequence.

To generate the polished genome in fasta format: ::

nanopolish vcf2fasta --skip-checks -g draft.fa polished.vcf > polished_genome.fa

We only polished a 2kb region, so let's pull that out: ::

samtools faidx polished_genome.fa
samtools faidx polished_genome.fa "tig00000001:200000-202000" > polished.fa

Evaluate the assembly
---------------------------------
Expand Down
Loading

0 comments on commit 0cec8f9

Please sign in to comment.