remove_adapters {Rbowtie2} | R Documentation

## Interface to bowtie2 of adapterremoval-2.2.1a

### Description

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

### Usage

    remove_adapters(
      file1,
      ...,
      adapter1 = NULL,
      output1 = NULL,
      file2 = NULL,
      adapter2 = NULL,
      output2 = NULL,
      basename = NULL,
      interleaved = FALSE,
      overwrite = FALSE
    )

### Arguments

`file1` | `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 file2 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.
`adapter1` | `Character`. It is an adapter sequence for file1. Default: AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNATCTCGTATGCCGTCTTCTGCTTG
`output1` | `Character`. The trimmed mate1 reads output file path for file1. Defualt: basename.pair1.truncated (paired-end), basename.truncated (single-end), or basename.paired.truncated (interleaved)
`file2` | `Character` vector. It contains file paths with #2 mates paired with file paths in file1. For single-end sequencing files and interleaved paired-end sequencing files(argument interleaved=`TRUE`), it must be `NULL`.
`adapter2` | `Character`. It is an adapter sequence for file2. Defualt: AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT
`output2` | `Character`. The trimmed mate2 reads output file path for file2. Default: BASENAME.pair2.truncated (only used in PE mode, but not if –interleaved-output is enabled)
`basename` | `Character`. The outputfile path prefix. Default: your_output
`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 remove_adapters. All of them should be `Character` or `Numeric` scalar. You can put all aditional arguments in one `Character`(e.g. "–threads 8") with white space splited just like command line, or put them in different `Character`(e.g. "–threads","8"). Note that some arguments( "–file1","–file2","–adapter1","–adapter2","–output1","–output2", "–basename","–interleaved") to the identify_adapters are invalid if they are already handled as explicit function arguments. See the output of `adapterremoval_usage()` for details about available parameters.

### Value

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

### Author(s)

Zheng Wei

### References

Schubert, Lindgreen, and Orlando (2016). AdapterRemoval v2: rapid adapter trimming, identification, and read merging. BMC Research Notes, 12;9(1):88.

### Examples

    td <- tempdir()

    # Identify adapters
    reads_1 <- system.file(package="Rbowtie2", "extdata", "adrm", "reads_1.fq")
    reads_2 <- system.file(package="Rbowtie2", "extdata", "adrm", "reads_2.fq")
    adapters <- identify_adapters(file1=reads_1,file2=reads_2,
    basename=file.path(td,"reads"), "--threads 3",overwrite=TRUE)

    # Remove adapters
    cmdout<-remove_adapters(file1=reads_1,file2=reads_2,adapter1 = adapters[1],
    adapter2 = adapters[2],
    output1=file.path(td,"reads_1.trimmed.fq"),
    output2=file.path(td,"reads_2.trimmed.fq"),
    basename=file.path(td,"reads.base"),overwrite=TRUE,"--threads 3");cmdout

[Package Rbowtie2 version 2.0.0 Index]