Biowulf at the NIH
RSS Feed
Freebayes on Biowulf

FreeBayes is a high-performance, flexible, and open-source Bayesian genetic variant detector. It operates on BAM alignment files, which are produced by most contemporary short-read aligners.

In addition to substantial performance improvements over its predecessors (PolyBayes, GigaBayes, and BamBayes), it expands the scope of SNP and small-indel variant calling to populations of individuals with heterogeneous copy number.

Freebayes is developed by Erik Garrison and Gabor Marth.

 

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

Note, the following module command automatic add 'ogap' program path as well.

$ module avail freebayes
---------------------- /usr/local/Modules/3.2.9/modulefiles --------------------------------
freebayes/0.9.4          freebayes/0.9.6          freebayes/0.9.8(default)


$ module load freebayes

$ module list
Currently Loaded Modulefiles:
1) freebayes/0.9.8 $ module unload freebayes $ module load freebayes/0.9.6 $ module list Currently Loaded Modulefiles: 1) freebayes/0.9.6 $ module show freebayes ------------------------------------------------------------------- /usr/local/Modules/3.2.9/modulefiles/freebayes/0.9.8: module-whatis Sets up freebayes 0.9.8 prepend-path PATH /usr/local/apps/freebayes/0.9.8/bin prepend-path PATH /usr/local/apps/ogap/current -------------------------------------------------------------------

 

Submitting a single batch job

This example is modified based on the file: /usr/local/apps/freebayes/current/examples/pipeline.sh

1. Create a script file alone the following lines.

#!/bin/bash
# This file is YourOwnFileName
#
#PBS -N yourownfilename
#PBS -m be
#PBS -k oe

module load freebayes
freebayes \
	 --min-alternate-count 2 \
    --min-alternate-qsum 40 \
    --pvar 0.0001 \
    --use-mapping-quality \
    --posterior-integration-limits 1,3 \
    --genotype-variant-threshold 4 \
    --site-selection-max-iterations 3 \
    --genotyping-max-iterations 25 \
    --max-complex-gap 3 \
    --cnv-map YourCnvMapFile \
    --stdin \
    --region YourRegion \
    -f YourReferenceFile \
	| gzip > YourOutDir/YourRegion.vcf.gz
  

2. Submit the script using the 'qsub' command on Biowulf.

$ qsub -l nodes=1 /data/$USER/theScriptFileAbove

This will send this job to the first available node. If you want to specify specific node, for example, node with 8gb of memory, then do this instead:

$ qsub -l nodes=1:g8 /data/$USER/the ScriptFileAbove

Use 'freen' to see availability of nodes and node types.

Submitting a swarm of jobs

Using the 'swarm' utility, one can submit many jobs to the cluster to run concurrently.

1. Set up a swarm command file (eg /data/$USER/cmdfile). Here is a sample file:

freebayes -f [REFERENCE] [OPTIONS] [BAM FILES] >[OUTPUT1]
freebayes -f [REFERENCE] [OPTIONS] [BAM FILES] >[OUTPUT2]
freebayes -f [REFERENCE] [OPTIONS] [BAM FILES] >[OUTPUT2]
[......]

2. Submit the swarm file.

-f: the swarm command file name above (required)
-g: GB of memory needed for each line of the commands in the swarm file above.(optional)
--module: setup environmental variables needed by freebayes

By default, each line of the commands above will be executed on '1' processor core of a node and uses 1GB of memory. If this is not what you want, you will need to '-g' flag when you submit the job on biowulf.

Say if each line of the commands above also will need to use 10gb of memory instead of the default 1gb of memory, make sure swarm understands this by including '-g 10' flag:

$ swarm -g 10 --module freebayes/0.9.8 -f cmdfile

For more information regarding running swarm, see swarm.html

Running an interactive job

Users may need to run jobs interactively sometimes. Such jobs should not be run on the Biowulf login node. Instead allocate an interactive node as described below, and run the interactive job there.

[user@biowulf] $ qsub -I -l nodes=1
qsub: waiting for job 2236960.biobos to start
      qsub: job 2236960.biobos ready 
      
[user@p4]$ cd /data/$USER/myruns
[user@p4]$ module load freebayes
[user@p4]$ freebayes \
	--min-alternate-count 2 \
    --min-alternate-qsum 40 \
    --pvar 0.0001 \
    --use-mapping-quality \
    --posterior-integration-limits 1,3 \
    --genotype-variant-threshold 4 \
    --site-selection-max-iterations 3 \
    --genotyping-max-iterations 25 \
    --max-complex-gap 3 \
    --cnv-map YourCnvMapFile \
    --stdin \
    --region YourRegion \
    -f YourReferenceFile \
	| gzip > YourOutDir/YourRegion.vcf.gz
[user@p4] exit
qsub: job 2236960.biobos completed
[user@biowulf]$ 

Users may add property of node in the qsub command to request specific interactive node. For example, if you need a node with 24gb of memory to run job interactively, do this:

[user@biowulf]$ qsub -I -l nodes=1:g24:c16

 

Documentation

https://github.com/ekg/freebayes