Make bam files with BWA and SAMTOOLS

!! Please use an updated version 2 here !!

Before start: Please enable SIMD in your web brower [see Help below].

This tool is for paired end fastq files (for example, xxx_R1_001.fastq.gz and xxx_R2_001.fastq.gz).
Please run the 3 steps below to get the indexed bams from a list of fastq files.

Recommend using private browser windows to avoid troubles caused by cookies and caches (open from the menu at the topright corner)

No spaces are allowed in input file names!

Provide the suffix of your fastq files:

I. Choose reference file (a fasta file)

II. Choose demultiplexed fastq(.gz) files

III. Map reads and create bam files

After loading the template fasta file and all the fastq files, now we will use bwa and samtools to create indexed bam files for viewing in the software IGV.


This tool is a WebAssembly implementation of BWA, SAMTOOLS and subread exactSNP. It runs commands like this:

## map reads to the templates with bwa
bwa index <your-references.fa>
bwa mem <your-references.fa> <R1.fastq.gz> <R2.fastq.gz> > out.sam
## make sorted bam files with samtools
samtools sort out.sam > out.bam
samtools index out.bam
## call variants with subread exactSNP (it has bug calling from bam, so we call SNPs from sam)
exactSNP -i out.sam -g your-reference.fa -o calledSNPs.vcf

bwa mem can only detect small indels. For indels > 15 bp, please try subread or my web app Make bams and indel calls with Subread.

Visit the GitHub page for more details:

Enable SIMD for your browser

BWA needs SIMD for vector calculation. Please enable it in your web brower first (just need to do once).

  • chromium based browsers (Google Chrome and new Microsoft Edge): go to URL chrome://flags/, search WebAssembly SIMD support, and select “Enabled”; seems enabled by default since 2021.

  • Firefox: go to URL about:config, search javascript.options.wasm_simd, then choose true;

  • Other browers do not seem to support this yet.


  • 2022-05-08: add editcall to call indels and inversions from bwa mem sam file.


  • Thank the authors of bwa, samtools and Subread.
  • Thank Robert Aboukhalil for his development of aioli and biowasm. I successfully compiled bwa, samtools and Subread by learning the patch and compiling scripts from biowasm.