complementSeq {Biostrings}R Documentation

Complementary sequence.

Description

WARNING: complementSeq is now defunct and will be removed soon together with this man page. See the examples at the bottom of the man page for how to use complement instead.

Function to obtain the complementary sequence.

Usage

complementSeq(seq, start=1, stop=0)

Arguments

seq Character vector consisting of the letters A, C, G and T.
start Numeric scalar: the sequence position at which to start complementing. If 1, start from the beginning.
stop Numeric scalar: the sequence position at which to stop complementing. If 0, go until the end.

Details

The complemented sequence for each element of the input is computed and returned. The complement is given by the mapping: A -> T, C -> G, G -> C, T -> A.

An important special case is start=13, stop=13: If seq is a vector of 25mer sequences on an Affymetrix GeneChip, complementSeq(seq, start=13, stop=13) calculates the so-called mismatch sequences.

The function deals only with sequences that represent DNA. These can consist only of the letters A, C, T or G. Upper, lower or mixed case is allowed and honored.

Value

A character vector of the same length as seq is returned. Each component represents the transformed sequence for the input value.

Author(s)

R. Gentleman, W. Huber

See Also

alphabetFrequency, reverseComplement

Examples

  ## ---------------------------------------------------------------------
  ## EXAMPLE 1
  ## ---------------------------------------------------------------------
  seq <- c("AAACT", "GGGTT")

  ## You can't do this anymore (defunct):
  if (interactive()) {
    complementSeq(seq)  # was inefficient on large vectors
  }
  ## But you can do this instead:
  complement(DNAStringSet(seq))

  ## ---------------------------------------------------------------------
  ## EXAMPLE 2
  ## ---------------------------------------------------------------------
  seq <- c("CGACTGAGACCAAGACCTACAACAG", "CCCGCATCATCTTTCCTGTGCTCTT")

  ## You can't do this anymore (defunct):
  if (interactive()) {
    complementSeq(seq, start=13, stop=13)
  }
  ## But you can do this instead:
  pm2mm <- function(probes)
  {
      probes <- DNAStringSet(probes)
      subseq(probes, start=13, end=13) <- complement(subseq(probes, start=13, end=13))
      probes
  }
  pm2mm(seq) 

[Package Biostrings version 2.20.1 Index]