data(thermo)
## count amino acids in a sequence
count.aa("GGSGG")
# warnings are issued for unrecognized characters
suppressWarnings(atest <- count.aa("WhatAmIMadeOf?"))
# there are 3 "A" (alanine, the first amino acid alphabetically)
stopifnot(atest[,1]==3)
## count nucleobases in a sequence
nucleicacids("ACCGGGTTT")
# the DNA complement of that sequence
nucleicacids("ACCGGGTTT", comp="DNA")
# the RNA complement of the DNA complement
n <- nucleicacids("ACCGGGTTT", comp="DNA", comp2="RNA")
# the formula of the RNA complement
(nf <- nucleicacids(n, type="RNA"))
stopifnot(identical(nf, "C40H42N32O11"))
Run the code above in your browser using DataLab