Learn R Programming

microseq (version 2.1.6)

reverseComplement: Reverse-complementation of DNA

Description

The standard reverse-complement of nucleotide sequences.

Usage

reverseComplement(nuc.sequences, reverse = TRUE)

Value

A character vector of reverse-complemented sequences.

Arguments

nuc.sequences

Character vector containing the nucleotide sequences.

reverse

Logical indicating if complement should be reversed.

Author

Lars Snipen and Kristian Hovde Liland.

Details

With reverse = FALSE the DNA sequence is only complemented, not reversed.

This function will handle the IUPAC ambiguity symbols, i.e. R is reverse-complemented to Y etc.

See Also

iupac2regex, regex2iupac.

Examples

Run this code
fa.file <- file.path(file.path(path.package("microseq"),"extdata"),"small.ffn")
fa <- readFasta(fa.file)
reverseComplement(fa$Sequence)

#' # Or, make use of dplyr to manipulate tables
readFasta(fa.file) %>%
  mutate(RevComp = reverseComplement(Sequence)) -> fa.tbl

Run the code above in your browser using DataLab