Galaxy | Tool Preview

BWA-MEM2 (version 2.2.1+galaxy1)
Built-ins were indexed using default options. See `Indexes` section of help below
Select genome from the list
Select between paired and single end data
Specify dataset with forward reads
Specify dataset with reverse reads
-I; This parameter is only used for paired reads. Only mean is required while sd, max, and min will be inferred. Examples: both "250" and "250,25" will work while "250,,10" will not. See below for details.
Specifying read group information can greatly simplify your downstream analyses by allowing combining multiple datasets.
The 'Not sorted' option can extend the run time of the tool significantly (cause it requires running on only a single thread).

What is does BWA-MEM2 is the new version of the bwa-mem algorithm in bwa. It produces alignment identical to bwa and is ~1.3-3.1x faster depending on the use-case, dataset and the running machine. The algorithm is robust to sequencing errors and applicable to a wide range of sequence lengths from 70bp to a few megabases.

The Galaxy implementation takes fastq files as input and produces output in BAM format, which can be further processed using various BAM utilities exiting in Galaxy (BAMTools, SAMTools, Picard).


Indices: Selecting reference genomes for BWA

Galaxy wrapper for BWA allows you select between precomputed and user-defined indices for reference genomes using Will you select a reference genome from your history or use a built-in index? flag. This flag has two options:

  1. Use a built-in genome index - when selected (this is default), Galaxy provides the user with Select reference genome index dropdown. Genomes listed in this dropdown have been pre-indexed with bwa index utility and are ready to be mapped against.
  2. Use a genome from the history and build index - when selected, Galaxy provides the user with Select reference genome sequence dropdown. This dropdown is populated by all FASTA formatted files listed in your current history. If your genome of interest is uploaded into history it will be shown there. Selecting a genome from this dropdown will cause Galaxy to first transparently index it using bwa index command, and then run mapping with bwa mem.

If your genome of interest is not listed here you have two choices:

  1. Contact galaxy team using Help->Support link at the top of the interface and let us know that an index needs to be added
  2. Upload your genome of interest as a FASTA file to Galaxy history and selected Use a genome from the history and build index option.

Galaxy-specific option

Galaxy allows four levels of control over bwa-mem options provided by Select analysis mode menu option. These are:

  1. Simple Illumina mode: The simplest possible bwa mem application in which it alignes single or paired-end data to reference using default parameters. It is equivalent to the following command: bwa mem <reference index> <fastq dataset1> [fastq dataset2]
  2. PacBio mode: The mode adjusted specifically for mapping of long PacBio subreads. Equivalent to the following command: bwa mem -k17 -W40 -r10 -A1 -B1 -O1 -E1 -L0 <reference index> <PacBio dataset in fastq format>
  3. Full list of options: Allows access to all options through Galaxy interface.

Bam sorting mode

The generated bam files can be sorted according to three criteria: coordinates, names and input order.

In coordinate sorted mode the reads are sorted by coordinates. It means that the reads from the beginning of the first chromosome are first in the file.

When sorted by read name, the file is sorted by the reference ID (i.e., the QNAME field).

Finally, the No sorted (sorted as input) option yield a BAM file in which the records are sorted in an order corresponding to the order of the reads in the original input file. This option requires using a single thread to perform the conversion from SAM to BAM format, so the runtime is extended.


Read Groups are Important!

One of the recommended best practices in NGS analysis is adding read group information to BAM files. You can do this directly in BWA interface using the Specify read group information? widget. If you are not familiar with read groups you shold know that this is effectively a way to tag reads with an additional ID. This allows you to combine BAM files from, for example, multiple BWA runs into a single dataset. This significantly simplifies downstream processing as instead of dealing with multiple datasets you only have to handle only one. This is possible because the read group information allows you to identify data from different experiments even if they are combined in one file. Many downstream analysis tools such as variant callers (e.g., FreeBayes or Naive Variant Caller present in Galaxy) are aware of read groups and will automatically generate calls for each individual sample even if they are combined within a single file.

Description of read groups fields

(from GATK FAQ webpage):

Tag Importance Definition Meaning
ID Required Read group identifier. Each @RG line must have a unique ID. The value of ID is used in the RG tags of alignment records. Must be unique among all read groups in header section. Read group IDs may be modified when merging SAM files in order to handle collisions. Ideally, this should be a globally unique identify across all sequencing data in the world, such as the Illumina flowcell + lane name and number. Will be referenced by each read with the RG:Z field, allowing tools to determine the read group information associated with each read, including the sample from which the read came. Also, a read group is effectively treated as a separate run of the NGS instrument in tools like base quality score recalibration (a GATK component) -- all reads within a read group are assumed to come from the same instrument run and to therefore share the same error model.
SM Sample. Use pool name where a pool is being sequenced. Required. As important as ID. The name of the sample sequenced in this read group. GATK tools treat all read groups with the same SM value as containing sequencing data for the same sample. Therefore it's critical that the SM field be correctly specified, especially when using multi-sample tools like the Unified Genotyper (a GATK component).
PL Platform/technology used to produce the read. Valid values: ILLUMINA, SOLID, LS454, HELICOS and PACBIO. Important. Not currently used in the GATK, but was in the past, and may return. The only way to known the sequencing technology used to generate the sequencing data It's a good idea to use this field.
LB DNA preparation library identify Essential for MarkDuplicates MarkDuplicates uses the LB field to determine which read groups might contain molecular duplicates, in case the same DNA library was sequenced on multiple lanes.

Example of Read Group usage

Suppose we have a trio of samples: MOM, DAD, and KID. Each has two DNA libraries prepared, one with 400 bp inserts and another with 200 bp inserts. Each of these libraries is run on two lanes of an illumina hiseq, requiring 3 x 2 x 2 = 12 lanes of data. When the data come off the sequencer, we would create 12 BAM files, with the following @RG fields in the header:

Dad's data:
@RG     ID:FLOWCELL1.LANE1      PL:illumina     LB:LIB-DAD-1 SM:DAD      PI:200
@RG     ID:FLOWCELL1.LANE2      PL:illumina     LB:LIB-DAD-1 SM:DAD      PI:200
@RG     ID:FLOWCELL1.LANE3      PL:illumina     LB:LIB-DAD-2 SM:DAD      PI:400
@RG     ID:FLOWCELL1.LANE4      PL:illumina     LB:LIB-DAD-2 SM:DAD      PI:400

Mom's data:
@RG     ID:FLOWCELL1.LANE5      PL:illumina     LB:LIB-MOM-1 SM:MOM      PI:200
@RG     ID:FLOWCELL1.LANE6      PL:illumina     LB:LIB-MOM-1 SM:MOM      PI:200
@RG     ID:FLOWCELL1.LANE7      PL:illumina     LB:LIB-MOM-2 SM:MOM      PI:400
@RG     ID:FLOWCELL1.LANE8      PL:illumina     LB:LIB-MOM-2 SM:MOM      PI:400

Kid's data:
@RG     ID:FLOWCELL2.LANE1      PL:illumina     LB:LIB-KID-1 SM:KID      PI:200
@RG     ID:FLOWCELL2.LANE2      PL:illumina     LB:LIB-KID-1 SM:KID      PI:200
@RG     ID:FLOWCELL2.LANE3      PL:illumina     LB:LIB-KID-2 SM:KID      PI:400
@RG     ID:FLOWCELL2.LANE4      PL:illumina     LB:LIB-KID-2 SM:KID      PI:400

Note the hierarchical relationship between read groups (unique for each lane) to libraries (sequenced on two lanes) and samples (across four lanes, two lanes for each library).


More info

To obtain more information about BWA and ask questions use these resources:

  1. https://biostar.usegalaxy.org/
  2. https://www.biostars.org/
  3. https://github.com/bwa-mem2/bwa-mem2
  4. http://bio-bwa.sourceforge.net/