1. Home
  2. Docs
  3. Introduction to NGS analysis
  4. Mapping reads
  5. Mapping reads using bwa

Mapping reads using bwa

In the same way that bowtie requires an indexed genome to run, we must first prepare an index in the format bwa requires.  We will reuse the chromosome 17 fasta file we copied previously.

module load BWA/0.7.15

At the time of writing, the BWA modules aren’t quite configured correctly on Raven, so we need to manually add the bwa command to our path:

export PATH=/software/genomics/BWA/0.7.15/gnu-4.4.7/bin/:$PATH

bwa index -a bwtsw chr17.fa

This step will take just over a minute and create the following files:


Map your reads using the bwa-mem algorithm

Having done this we can then map our reads in fastq format and pipe the sam output into a file.

bwa mem chr17.fa Brca1Reads_1.1.fastq Brca1Reads_1.2.fastq > bwa.sam

Files created:


Convert SAM to BAM

samtools view -bS bwa.sam > bwa.bam

Sort the BAM file

samtools sort bwa.bam bwa.sorted

Index the BAM file

samtools index bwa.sorted.bam