Main Content

bowtie2build

Create Bowtie 2 index files from reference sequences

Description

example

bowtie2build(referenceFileNames,indexBaseName) builds Bowtie2 index files from the reference sequence information saved in the FASTA files specified by referenceFileNames.

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

example

bowtie2build(___,buildOptions) uses the additional options specified by buildOptions. Specify these options after all other input arguments.

example

flag = bowtie2build(___) returns an exit flag of the function using any of the input arguments in the previous syntaxes.

Examples

collapse all

Build a set of index files for the Drosophila genome. An error message appears if you do not have the Bowtie 2 Support Package for Bioinformatics Toolbox installed when you run the function. Click the provided link to download the package from the Add-on menu.

For this example, the reference sequence Dmel_chr4.fa is already provided with the toolbox.

status = bowtie2build('Dmel_chr4.fa', 'Dmel_chr4_index');

If the index build is successful, the function returns 0 and creates the index files (*.bt2) in the current folder. The files have the prefix 'Dmel_chr4_index'.

You can specify different options by using a Bowtie2BuildOptions object or by passing in a Bowtie 2 syntax string. For instance, you can specify whether to force the creation of a large index even if the reference is less than four billion nucleotides long as follows.

buildOpt = Bowtie2BuildOptions;

Set the ForceLargeIndex option to true.

buildOpt.ForceLargeIndex = true;

Build the index files using the specified option.

bowtie2build('Dmel_chr4.fa', 'Dmel_chr4_index_large',buildOpt);

Alternatively, you can pass in a Bowtie 2 syntax string.

flag = bowtie2build('Dmel_chr4.fa', 'Dmel_chr4_index_large2','--large-index');

Input Arguments

collapse all

Names of files with reference sequence information, specified as a string, character vector, string array, or cell array of character vectors.

Example: 'Dmel_chr4.fa'

Data Types: char | string | cell

Base name (prefix) of the reference index files, specified as a character vector or string. The index files are in the BT2 or BT21 format.

Example: 'Dmel_chr4'

Data Types: char | string

Options to build index files, specified as a character vector, string, or Bowtie2BuildOptions object. The character vector or string must be in the Bowtie 2 option syntax (prefixed by one or two dashes) [1].

For a Bowtie2BuildOptions object, only the modified properties are used to run the function.

Example: '--trim5 10 -s 5'

Output Arguments

collapse all

Exit status of the function, returned as an integer. flag is 0 if the function runs without errors or warning. Otherwise, it is nonzero.

References

[1] Langmead, B., and S. Salzberg. "Fast gapped-read alignment with Bowtie 2." Nature Methods. 9, 2012, 357–359.

Version History

Introduced in R2018a