cds2aa: cds2aa

View source: R/cds2aa.R

cds2aaR Documentation

cds2aa

Description

This function translates a DNAStringSet into an AAStringSet.

Usage

cds2aa(
  cds,
  shorten = FALSE,
  frame = 1,
  framelist = NULL,
  genetic.code = NULL,
  return.cds = FALSE
)

Arguments

cds

DNAStringSet [mandatory]

shorten

shorten all sequences to multiple of three [default: FALSE]

frame

indicates the first base of a the first codon [default: 1]

framelist

supply vector of frames for each entry [default: NULL]

genetic.code

The genetic code to use for the translation of codons into Amino Acid letters [default: NULL]

return.cds

return shorten cds instead of aa [default: FALSE]

Value

AAStringSet

Author(s)

Kristian K Ullrich

See Also

XStringSet-class, translate

Examples

## define two cds sequences
cds1 <- Biostrings::DNAString("ATGCAACATTGC")
cds2 <- Biostrings::DNAString("ATG---CATTGC")
cds1.cds2.aln <- c(Biostrings::DNAStringSet(cds1),
    Biostrings::DNAStringSet(cds2))
#cds2aa(cds1.cds2.aln)
cds1.cds2.aln |> cds2aa()
## alternative genetic code
data(woodmouse, package="ape")
#cds2aa(dnabin2dnastring(woodmouse), shorten=TRUE)
woodmouse |> dnabin2dnastring() |> cds2aa(shorten=TRUE)
#cds2aa(dnabin2dnastring(woodmouse), shorten=TRUE,
#genetic.code=Biostrings::getGeneticCode("2"))
woodmouse |> dnabin2dnastring() |> cds2aa(shorten=TRUE,
genetic.code=Biostrings::getGeneticCode("2"))
woodmouse |> dnabin2dnastring() |> cds2aa(shorten=TRUE, return.cds=TRUE) |>
cds2aa(genetic.code=Biostrings::getGeneticCode("2"))

kullrich/MSA2dist documentation built on Nov. 14, 2024, 5:39 p.m.