Skip to content
covtobed | Convert the coverage track from a BAM file into a BED file
C++ TeX Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Docker
binaries
example_data
img
paper
test
.gitignore Small improvements Jan 7, 2020
.travis.yml
Dockerfile
LICENSE
OptionParser.cpp
OptionParser.h
README.md
base.cpp
interval.h

README.md

covtobed

License install with bioconda TravisCI Build Status Docker build Singularity 10.5281/zenodo.1063493

a tool to generate BED coverage tracks from BAM files

Read one (or more) alignment files (sorted BAM) and prints a BED with the coverage. It will join consecutive bases with the same coverage, and can be used to only print a BED file with the regions having a specific coverage range.

covtobed example

Usage

📖 The complete documentation is available in the GitHub wiki.

Synopsis:

Usage: covtobed [options] [BAM]...

Computes coverage from alignments

Options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --physical-coverage   compute physical coverage (needs paired alignments in input)
  -q MINQ, --min-mapq=MINQ
                        skip alignments whose mapping quality is less than MINQ
                        (default: 0)
  -m MINCOV, --min-cov=MINCOV
                        print BED feature only if the coverage is bigger than
                        (or equal to) MINCOV (default: 0)
  -x MAXCOV, --max-cov=MAXCOV
                        print BED feature only if the coverage is lower than
                        MAXCOV (default: 100000)
  -l MINLEN, --min-len=MINLEN
                        print BED feature only if its length is bigger (or equal
                        to) than MINLELN (default: 1)
  -v                    prints program version
  --output-strands      outputs coverage and stats separately for each strand
  --format=CHOICE       output format

Example

Command:

covtobed -m 0 -x 5 test/demo.bam

Output:

NC_001416.1	1112	1120	4
NC_001416.1	1120	1999	0
NC_001416.1	2653	2674	4
NC_001416.1	2674	2686	3
NC_001416.1	2686	2762	2
NC_001416.1	2762	2771	1
NC_001416.1	2771	2800	0

Install

  • To install with Miniconda:
conda install -c bioconda covtobed
  • Both covtobed, and the legacy program coverage are available as a single Docker container available from Docker Hub Docker build :
sudo docker pull andreatelatin/covtobed
sudo docker run --rm -ti andreatelatin/covtobed coverage -h
  • Download Singularity image by singularity pull docker://andreatelatin/covtobed, then:
singularity exec covtobed.simg coverage -h

Requirements and compiling

This tool requires libbamtools and zlib.

To manually compile:

c++ -std=c++11 *.cpp -I/path/to/bamtools/ -L${HOME}/path/to/lib/ -lbamtools -o covtobed

Acknowledgements

This tools uses libbamtools by Derek Barnett, Erik Garrison, Gabor Marth and Michael Stromberg, and cpp-optparse by Johannes Weißl. Both tools and this program are released with MIT license.

Authors

Giovanni Birolo (@gbirolo), University of Turin, and Andrea Telatin (@telatin), Quadram Institute Bioscience.

This program was finalized with a Flexible Talent Mobility Award funded by BBSRC through the Quadram Institute.

You can’t perform that action at this time.