bowtie2 {Rbowtie2} | R Documentation

## Interface to bowtie2 of bowtie2-2.2.3

### Description

This function can be use to call wrapped `bowtie2` binary.

### Usage

    bowtie2(
      bt2Index,
      samOutput,
      seq1,
      ...,
      seq2 = NULL,
      interleaved = FALSE,
      overwrite = FALSE
    )

### Arguments

`bt2Index` | `Character` scalar. bowtie2 index files prefix: 'dir/basename' (minus trailing '.*.bt2' of 'dir/basename.*.bt2').
`samOutput` | `Character` scalar. A path to a SAM file used for the alignment output.
`seq1` | `Character` vector. For single-end sequencing, it contains sequence file paths. For paired-end sequencing, it can be file paths with #1 mates paired with file paths in seq2. And it can also be interleaved file paths when argument interleaved=`TRUE`
`...` | Additional arguments to be passed on to the binaries. See below for details.
`seq2` | `Character` vector. It contains file paths with #2 mates paired with file paths in seq1. For single-end sequencing files and interleaved paired-end sequencing files(argument interleaved=`TRUE`), it must be `NULL`.
`interleaved` | `Logical`. Set `TRUE` when files are interleaved paired-end sequencing data.
`overwrite` | `Logical`. Force overwriting of existing files if setting `TRUE`.

### Details

All additional arguments in ... are interpreted as additional parameters to be passed on to bowtie2. All of them should be `Character` or `Numeric` scalar. You can put all aditional arguments in one `Character`(e.g. "–threads 8 –no-mixed") with white space splited just like command line, or put them in different `Character` (e.g. "–threads","8","–no-mixed"). Note that some arguments("-x","–interleaved","-U","-1","-2","-S") to the bowtie2 are invalid if they are already handled as explicit function arguments. See the output of `bowtie2_usage()` for details about available parameters.

### Value

An invisible `Integer` of call status. The value is 0 when there is not any mistakes Otherwise the value is non-zero.

### Author(s)

Zheng Wei

### References

Langmead, B., & Salzberg, S. L. (2012). Fast gapped-read alignment with Bowtie 2. Nature methods, 9(4), 357-359.

### Examples

    td <- tempdir()
    ## Building a bowtie2 index
    refs <- dir(system.file(package="Rbowtie2", "extdata", "bt2","refs"),
    full=TRUE)
    bowtie2_build(references=refs, bt2Index=file.path(td, "lambda_virus"),
    "--threads 4 --quiet",overwrite=TRUE)
    ## Alignments
    reads_1 <- system.file(package="Rbowtie2", "extdata", "bt2", "reads",
    "reads_1.fastq")
    reads_2 <- system.file(package="Rbowtie2", "extdata", "bt2", "reads",
    "reads_2.fastq")
    if(file.exists(file.path(td, "lambda_virus.1.bt2"))){
        cmdout<-bowtie2(bt2Index = file.path(td, "lambda_virus"),
           samOutput = file.path(td, "result.sam"),
           seq1=reads_1,seq2=reads_2,overwrite=TRUE,"--threads 3");cmdout
        head(readLines(file.path(td, "result.sam")))
    }

[Package Rbowtie2 version 2.0.0 Index]