Skip to content

Latest commit

 

History

History
88 lines (69 loc) · 4.56 KB

File metadata and controls

88 lines (69 loc) · 4.56 KB

f5c

An optimised re-implementation of the call-methylation module in Nanopolish. Given a set of basecalled Nanopore reads and the raw signals, f5c detects the methylated cytosine bases. f5c can optionally utilise NVIDIA graphics cards for acceleration.

First the reads have to be indexed using f5c index (or nanopolish index - f5c index is the same code as nanopolish index). Then invoke f5c call-methylation to detect methylated cytosine bases. The result is almost the same as from nanopolish except a few differences due to floating point approximations.

Build Status

Quick start

If you are a Linux user and want to quickly try out download the compiled binaries from the latest release. For example:

VERSION=v0.1-beta
wget "https://github.com/hasindu2008/f5c/releases/download/$VERSION/f5c-$VERSION-binaries.tar.gz" && tar xvf f5c-$VERSION-binaries.tar.gz && cd f5c-$VERSION/
./f5c_x86_64_linux        # CPU version
./f5c_x86_64_linux_cuda   # cuda supported version

Binaries should work on most Linux distributions and the only dependency is zlib which is available by default on most distros.

Building

Users are recommended to build from the latest release tar ball. You need a compiler that supports C++11. Quick example for Ubuntu :

sudo apt-get install libhdf5-dev zlib1g-dev   #install HDF5 and zlib development libraries
VERSION=v0.1-beta
wget "https://github.com/hasindu2008/f5c/releases/download/$VERSION/f5c-$VERSION-release.tar.gz" && tar xvf f5c-$VERSION-release.tar.gz && cd f5c-$VERSION/
scripts/install-hts.sh  # download and compile the htslib
./configure             
make                    # make cuda=1 to enable CUDA support

The commands to install hdf5 (and zlib) development libraries on some popular distributions :

On Debian/Ubuntu : sudo apt-get install libhdf5-dev zlib1g-dev
On Fedora/CentOS : sudo dnf/yum install hdf5-devel zlib-devel
On Arch Linux: sudo pacman -S hdf5
On OS X : brew install hdf5

If you skip scripts/install-hts.sh and ./configure hdf5 will be compiled locally. It is a good option if you cannot install hdf5 library system wide. However, building hdf5 takes ages.

Building from the Github repository additionally requires autoreconf which can be installed on Ubuntu using sudo apt-get install autoconf automake.

Other building options are detailed here. Instruction to build a docker image is detailed here.

NVIDIA CUDA support

To build for the GPU, you need to have the CUDA toolkit installed. Make nvcc (NVIDIA C Compiler) is in your PATH.

The building instructions are the same as above except that you should call make as :

make cuda=1

Optionally you can provide the CUDA architecture as :

make cuda=1 CUDA_ARCH=-arch=sm_xy

If your CUDA library is not in the default location /usr/local/cuda/lib64, point to the correct location as:

make cuda=1 CUDA_LIB=/path/to/cuda/library/

Visit here for troubleshooting CUDA related problems.

Usage

f5c index -d [fast5_folder] [read.fastq|fasta]
f5c call-methylation -b [reads.sorted.bam] -g [ref.fa] -r [reads.fastq|fasta]

Visit the man page for all the commands and options.

Example

Follow the same steps as in Nanopolish tutorial while replacing nanopolish with f5c. If you only want to perform a quick test of f5c :

#download and extract the dataset including sorted alignments
wget -O f5c_na12878_test.tgz "http://genome.cse.unsw.edu.au/tmp/f5c_na12878_test.tgz"
tar xf f5c_na12878_test.tgz

#index and call methylation
f5c index -d chr22_meth_example/fast5_files chr22_meth_example/reads.fastq
f5c call-methylation -b chr22_meth_example/reads.sorted.bam -g chr22_meth_example/humangenome.fa -r chr22_meth_example/reads.fastq > chr22_meth_example/result.tsv

Acknowledgement

This reuses code and methods from Nanopolish. The event detection code is from Oxford Nanopore's Scrappie basecaller. Some code snippets have been taken from Minimap2 and Samtools.