Variant calling with FreeBayes
In this recipe, we will see how to use an alignment file to call variants, or alterations in a genome. We will look at FreeBayes (https://github.com/freebayes/freebayes), which is a popular variant caller.In variant calling, we look at the pile-up of reads in the alignment and try to determine whether there are any variations from the reference sequence.Let’s take a look at an example:

Getting started
First, we will install FreeBayes using the following code. You may want to add it to your PATH:
! brew install freebayes
The code for this chapter can be found in Ch05/Ch05-4-variant-calling.ipynb
.
How to do it...
Here are the steps to try this recipe:
- First, we will import our libraries:
import subprocess
import os
- Next, we define our
run_command()
function:
def run_command(cmd):
print(f"Running:...