Freebayes¶
FreeBayes is a genetic variant detector designed to find small polymorphisms (SNPs, indels, MNPs and complex events).
FreeBayes is haplotype-based, in the sense that it calls variants based on the literal sequences of reads aligned to a particular target, not their precise alignment. This model is a straightforward generalization of previous ones (e.g. PolyBayes, samtools, GATK) which detect or report variants based on alignments. This method avoids one of the core problems with alignment-based variant detection, that identical sequences may have multiple possible alignments.
FreeBayes uses short-read alignments (BAM files) for any number of individuals from a population and a reference genome to determine the most-likely combination of genotypes for the population at each position in the reference. It reports positions which it finds putatively polymorphic in variant call file (VCF) format. It can also use an input set of variants (VCF) as a source of prior information, and a copy number variant map (BED) to define non-uniform ploidy variation across the samples under analysis.
License¶
Free to use and open source under MIT License.
Available¶
- Roihu-CPU: 1.3.6, via the
bio-appsmodule.
Usage¶
FreeBayes is part of the bio-apps collection on Roihu. Load the bio-apps module tree and then the FreeBayes module:
After this you can launch FreeBayes. For example:
Note that FreeBayes requires a BAM file that is indexed. A BAM file can be indexed with the samtools index command (load the samtools module first):
Running FreeBayes in parallel¶
FreeBayes itself uses one core. freebayes-parallel splits the genome into regions,
runs FreeBayes on several regions at a time and merges the results into one VCF
file. Make a list of regions from the reference index (samtools faidx reference.fa
makes the index), here in 100 kb pieces, and give the number of parallel runs
after the regions file:
fasta_generate_regions.py reference.fa.fai 100000 > regions.txt
freebayes-parallel regions.txt 16 -f reference.fa input.bam > results.vcf
Example batch script¶
FreeBayes analysis jobs can be computationally heavy and should be run as batch jobs on Roihu. Below is a sample batch job script:
#!/bin/bash
#SBATCH --job-name=freebayes
#SBATCH --account=<project>
#SBATCH --output=output_%j.txt
#SBATCH --error=errors_%j.txt
#SBATCH --time=24:00:00
#SBATCH --partition=small
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=16
#SBATCH --mem=64G
module load bio-apps/v202603
module load freebayes/1.3.6
fasta_generate_regions.py reference.fa.fai 100000 > regions.txt
freebayes-parallel regions.txt $SLURM_CPUS_PER_TASK -f reference.fa input.bam > results.vcf
Replace <project> with your CSC project (for example project_2001234).
You can submit the batch job file to the batch job system with the command:
See creating a batch job script for Roihu for more information about running batch jobs.