trimAdapter {girafe} | R Documentation

## Remove 3' adapter contamination

### Description

Function to remove 3' adapter contamination from reads

### Usage

    trimAdapter(fq, adapter, match.score = 1, mismatch.score = -1,
                score.threshold = 2)

### Arguments

`fq` | Object of class `ShortReadQ`; the reads with possible adapter contamination.
`adapter` | object of class `DNAString` or class `character`; the sequence of the 3' adapter which could give rise to the 3' contamination. If of class `character`, it is converted to a `DNAString` inside the function.
`match.score` | numeric; alignment score for matching bases
`mismatch.score` | numeric; alignment score for mismatches
`score.threshold` | numeric; minimum total alignment score required for an overlap match between the 3' end of the read and the 5' end of the adapter sequence.

### Details

Performs an overlap alignment between the ends of the reads and the start of the adapter sequence.

### Value

An object of class `ShortReadQ` containing the reads without the 3' adapter contamination.

### Note

The function `trimLRPatterns` from package `ShortRead` may be a faster alternative to this function.

### Author(s)

J. Toedling

### See Also

`pairwiseAlignment`, `narrow`, `readFastq`, `writeFastq`

### Examples

      exDir <- system.file("extdata", package="girafe")
      ## load reads containing adapter fragments at the end
      ra23.wa  <- readFastq(dirPath=exDir, pattern=
                  "aravinSRNA_23_plus_adapter_excerpt.fastq")
      table(width(ra23.wa))
      # adapter sequence obtained from GEO page
      #  accession number: GSE10364
      #adapter <- DNAString("CTGTAGGCACCATCAAT")
      adapter <- "CTGTAGGCACCATCAAT"

      # trim adapter
      ra23.na  <- trimAdapter(ra23.wa, adapter)
      table(width(ra23.na))

[Package girafe version 1.39.0 Index]