High-Performance Computing at the NIH

RSS Feed

BamTools on Helix

BamTools provides a fast, flexible C++ API & toolkit for reading, writing, and manipulating BAM files.

It was developed by Derek Barnett in the Marth lab at Boston College.

Programs location

/usr/local/bamtools/bin/bamtool

The environment variable(s) need to be set properly first. The easiest way to do this is by using the modules commands, 'module load bamtools' , as in the example below.

Frequently used module commands:

$ module load AppName
$ module load AppName/AppVersion
$ module unload AppName
$ module avail
$ module avail AppName
$ module list
$ module switch AppName AppName/AppVersion
$ module display AppName

If you use this application very often, in addition to use the 'module' command, you can also set the environmental variables in your /home/UserID/.bashrc or /home/userID/.cshrc file so that it will be done automatically when you login and you don't need to set the environmental variable(s) everytime.

For bash users:

$ export PATH=/usr/local/bamtools-2.2.0/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/bamtools-2.2.0/lib/:$LD_LIBRARY_PATH

For tcsh/csh users:

% set path=(/usr/local/bamtools-2.2.0/bin ${path})
% setenv LD_LIBRARY_PATH /usr/local/bamtools-2.2.0/lib:$LD_LIBRARY_PATH

How To Use

usage: bamtools [--help] COMMAND [ARGS]

Available bamtools commands:

convert

Converts between BAM and a number of other formats

count Prints number of alignments in BAM file(s)
coverage Prints coverage statistics from the input BAM file
filter Filters BAM file(s) by user-specified criteria
header Prints BAM header information
index Generates index for BAM file
merge Merge multiple BAM files into single file
random Select random alignments from existing BAM file(s)
sort Sorts the BAM file according to some criteria
split Splits a BAM file on user-specifed property, creating a new BAM output file for each value found
stats Prints some basic statistics from input BAM file(s)

See 'bamtools help COMMAND' for more information on a specific command.

Example:

$ module load bamtools
$ bamtools filter -in data1.bam -in data2.bam -mapQuality ">50" | bamtools count

This will give a count of all alignments in your 2 BAM files with a mapQuality of greater than 50. And any tool writing to stdout can be piped into other utilities.

Documentation

https://github.com/pezmaster31/bamtools