Main Content

BWAIndexOptions

Option set for bwaindex

Description

A BWAIndexOptions object contains options for the bwaindex function, which creates indices from a reference sequence [1][2].

Creation

Description

example

bwaindexOpt = BWAIndexOptions creates a BWAIndexOptions object with the default property values.

BWAIndexOptions requires the BWA Support Package for Bioinformatics Toolbox™. If the support package is not installed, then the function provides a download link. For details, see Bioinformatics Toolbox Software Support Packages.

Note

BWAIndexOptions is supported on the Mac and UNIX® platforms only.

example

bwaindexOpt = BWAIndexOptions(Name,Value) sets the object properties using one or more name-value pair arguments. Enclose each property name in quotes. For example, bwaindexOpt = BWAIndexOptions('Prefix','dmel_chr4') specifies the prefix for the index files.

bwaindexOpt = BWAIndexOptions(S) specifies optional parameters using a string or character vector S.

Input Arguments

expand all

bwa index options, specified as a character vector or string. S must be in the bwa index native syntax (prefixed by a dash).

Example: '-a bwtsw -b 5000000'

Properties

expand all

Algorithm to construct the BWT (Burrows-Wheeler transform) index, specified as a character vector or string. Options are:

  • 'is' — Linear-time algorithm. The memory requirement for using this option is 5.37 times the size of the database. You cannot use this option if your database is larger than 2 GB.

  • 'bwtsw' — BWT-SW algorithm.

The default algorithm is chosen automatically based on the size of the reference genome.

Data Types: char | string

Number of bases processed per batch in the bwtsw algorithm, specified as a positive scalar.

Data Types: double

Additional commands, specified as a character vector or string.

The commands must be in the native syntax (prefixed by one or two dashes). Use this option to apply undocumented flags and flags without corresponding MATLAB® properties.

When the software converts the original flags to MATLAB properties, it stores any unrecognized flags in this property.

Example: '-6'

Data Types: char | string

Flag to include all available options with the corresponding default values during conversion to the original options syntax, specified as true or false.

The original (native) syntax is prefixed by one or two dashes. By default, the function converts only the specified options. If the value is true, the software converts all available options, with default values for unspecified options, to the original syntax.

Note

If you set IncludeAll to true, the software translates all available properties, with default values for unspecified properties. The only exception is that when the default value of a property is NaN, Inf, [], '', or "", then the software does not translate the corresponding property.

Data Types: logical

Prefix for the output index files, specified as a character vector or string. You can specify only the prefix or a file path and prefix. The default value is the same as the input FASTA file name.

Example: 'D:/ngs/GRCh38_p12'

Data Types: char | string

This property is read-only.

Supported version of the original bwa software, returned as a string.

Example: "0.7.17"

Data Types: string

Object Functions

getCommandTranslate object properties to original options syntax
getOptionsTableReturn table with all properties and equivalent options in original syntax

Examples

collapse all

This example requires the BWA Support Package for Bioinformatics Toolbox™. If the support package is not installed, the software provides a download link. For details, see Bioinformatics Toolbox Software Support Packages.

Build a set of index files for the Drosophila genome. This example uses the reference sequence Dmel_chr4.fa, provided with the toolbox. The 'Prefix' argument lets you define the prefix of the output index files. You can also include the file path information. For this example, define the prefix as Dmel_chr4 and save the index files in the current directory.

bwaindex('Dmel_chr4.fa','Prefix','./Dmel_chr4');

As an alternative to specifying name-value pair arguments, you can use the BWAIndexOptions object to specify the indexing options.

indexOpt = BWAIndexOptions;
indexOpt.Prefix = './Dmel_chr4';
indexOpt.Algorithm = 'bwtsw';
bwaindex('Dmel_chr4.fa',indexOpt);

Once the index files are ready, map the read sequences to the reference using bwamem. Two pair-end read input files are already provided with the toolbox. Using name-value pair arguments, you can specify different alignment options, such as the number of parallel threads to use.

bwamem('Dmel_chr4','SRR6008575_10k_1.fq','SRR6008575_10k_2.fq','SRR6008575_10k_chr4.sam','NumThreads',4);

Alternatively, you can use BWAMEMoptions to specify the alignment options.

alignOpt = BWAMEMOptions;
alignOpt.NumThreads = 4;
bwamem('Dmel_chr4','SRR6008575_10k_1.fq','SRR6008575_10k_2.fq','SRR6008575_10k_chr4.sam',alignOpt)

References

[1] Li, Heng, and Richard Durbin. “Fast and Accurate Short Read Alignment with Burrows-Wheeler Transform.” Bioinformatics 25, no. 14 (July 15, 2009): 1754–60. https://doi.org/10.1093/bioinformatics/btp324.

[2] Li, Heng, and Richard Durbin. “Fast and Accurate Long-Read Alignment with Burrows–Wheeler Transform.” Bioinformatics 26, no. 5 (March 1, 2010): 589–95. https://doi.org/10.1093/bioinformatics/btp698.

Introduced in R2020b