Comparing the results of different mappers using bedtools

Often you want to compare the results of variant calling on different samples or using different pipelines. Bedtools is a suite of utility programs that work on a variety of file formats, one of which is conveniently VCF format. It provides many ways of slicing, dicing, and comparing the information in VCF files. For example, we can use it to find out what predictions are the same and which are different from the variant calling on reads mapped with different programs if you generated VCF files for each one. Set up a new output directory and copy the respective VCF files to it, renaming them so that we know where they came from:

mkdir comparison
 
#direcoties need renaming or copying from below####
cp -i samtools_bowtie2/SRR030257.vcf comparison/bowtie2.vcf
cp -i samtools_bwa/SRR030257.vcf comparison/bwa.vcf
cp -i samtools_bowtie/SRR030257.vcf comparison/bowtie.vcf
cd comparison

Use the subcommands bedtools intersect and bedtools subtract we can find equal and different predictions between mappers. Try to figure out how to to do this on your own first. Hint: Remember that adding > output.vcf to the end of a command will pipe the output that is to the terminal into a file, so that you can save it.

module load bedtools
bedtools intersect -a bowtie2.vcf -b bwa.vcf > common_bowtie2_bwa.vcf
bedtools subtract -a bowtie2.vcf -b common_bowtie2_bwa.vcf > unique_bowtie2.vcf
bedtools subtract -a bwa.vcf -b common_bowtie2_bwa.vcf > unique_bwa.vcf

 

 

#### may need to be added to the top

If you do not have the output from the Mapping tutorial, run these commands to copy over the output that would have been produced. Then, you can immediately start this tutorial! This will be used for the optional bedtools tutorial as well.

cds
mkdir mapping
cd mapping
cp -r $BI/gva_course/mapping/bowtie .
cp -r $BI/gva_course/mapping/bwa . 
cp -r $BI/gva_course/mapping/bowtie2 .