rc: Reverse-Complement of DNA sequences

View source: R/rc.R

rcR Documentation

Reverse-Complement of DNA sequences

Description

Reverse, complement or reverse-complement of DNA sequences.

Usage

rc(seqs, i, complement = TRUE, reverse = TRUE, delete.gaps = FALSE)

Arguments

seqs

An object of class DNAbin.

i

Logical or numeric index to indicate a subset of sequences to manipulate. If not given the entire set of sequences will be manipulated.

complement

Logical, indicating if sequences will be turned into their complement.

reverse

Logical, indication if sequences will be reversed.

delete.gaps

Logical, indicating if gap character will be removed prior to sequence manipulation.

Value

An object of the same class and dimension as seqs.

Examples

## A minimal sequence alignment:
x <- list(
  seqA = c("a", "a", "c", "c", "g", "t"),
  seqB = c("n", "-", "r", "y", "g", "t"))
x <- as.DNAbin(x)

## Three choices of manipulation:
as.character(x)
as.character(rc(x))                      ## reverse-complement
as.character(rc(x, complement = FALSE))  ## only reverse
as.character(rc(x, reverse = FALSE))     ## only complement

## You can remove gaps:
as.character(rc(x, delete.gaps = TRUE))  ## gaps/indels removed


ips documentation built on May 29, 2024, 4:39 a.m.