Main Content


Inspect Bowtie 2 index files



bowtie2inspect(indexBaseName,outputFileName) inspects Bowtie2 index files with the prefix indexBaseName, checks the original reference sequences used to build the index, and saves the reference sequences in an output file outputFileName.

bowtie2inspect 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.


bowtie2inspect(___,inspectOptions) uses the additional options specified by inspectOptions. Specify the options after all other input arguments.


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


collapse all

Get information about the reference sequence used to build the corresponding index files by using bowtie2inspect. 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.

bowtie2inspect('Dmel_chr4', 'Dmel_chr4_retrieved.fa');

By default, the output file Dmel_chr4_retrieved.fa contains the actual sequence of the reference used to build the index.

You can also get summary information about the reference name and lengths instead of the actual sequence.

Create an options object.

inspectOpt = Bowtie2InspectOptions;

Set the Summary property to true.

inspectOpt.Summary = true;

Run the function again using the specified option.

flag = bowtie2inspect('Dmel_chr4', 'Dmel_chr4_summary.fa',inspectOpt);

If the index inspection is successful, the function returns 0, and the output file now contains summary information of the reference sequence.

Alternatively, you can pass in a Bowtie 2 syntax string instead of using the option object.

flag = bowtie2inspect('Dmel_chr4', 'Dmel_chr4_summary2.fa','-s');

Input Arguments

collapse all

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

Name of an output file, specified as a string or character vector. By default, the output file contains the reference sequences that are used to build the index files.

Example: 'refSeq.fa'

Data Types: char | string

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

For a Bowtie2InspectOptions 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.


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

Version History

Introduced in R2018a