Main Content

run

Map sequence reads to reference sequence using Bowtie 2

Description

example

run(object,indexBaseName,reads1,reads2,outputFileName) maps the sequencing reads from reads1 and reads2 against the reference sequence and writes the results to the output file outputFileName. The input indexBaseName represents the base name (prefix) of the reference index files. object is a Bowtie2AlignOptions object.

run 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

run(___,'IncludeAll',TF) specifies whether to use all object properties and their corresponding values when running bowtie2. Specify this option after all other input arguments. By default, only the modified properties are used to run bowtie2.

example

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

Examples

collapse all

First build a set of index files for the Drosophila genome. An error message appears if you do not have the Bioinformatics Toolbox Interface for Bowtie Aligner support package 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'.

Once the index is ready, map the read sequences to the reference. The pair-end read files (SRR6008575_10k_1.fq and SRR6008575_10k_2.fq) are already provided with the toolbox.

Create an options object.

 alignOpt = Bowtie2AlignOptions;

Trim four residues from the 3' end before aligning.

 alignOpt.Trim3 = 4;

Map reads to the reference using the specified alignment option.

flag = run(alignOpt,'Dmel_chr4','SRR6008575_10k_1.fq','SRR6008575_10k_2.fq','SRR6008575_10k_chr4_trimmed.sam');

The output is a SAM-formatted file that contains the mapping results.

Input Arguments

collapse all

Alignment options, specified as a Bowtie2AlignOptions object.

Example: 'alignOpt'

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

Names of files with the first mate reads or single-end reads, specified as a string array or cell array of character vectors.

For paired-end data, sequences in reads1 must correspond file-for-file and read-for-read to sequences in reads2.

Example: 'SRR6008575_10k_1.fq'

Data Types: char | string

Names of files with the second mate reads, specified as a string array or cell array of character vectors.

Specify reads2 as an empty character vector or string ('' or "") if the data consists of single-end reads only.

Example: 'SRR6008575_10k_2.fq'

Data Types: char | string

Output file name, specified as a character vector or string. This file contains the mapping results.

Example: 'SRR6008575_10k_chr4.sam'

Data Types: char | string

Flag to use all object properties and their corresponding values when you run the function, specified as true or false. By default, only the modified properties are used.

Example: true

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