powered by
This function returns the IUPAC symbol for a nucleotide sequence, for instance c("c", "c", "g") is coded by "s".
c("c", "c", "g")
"s"
bma(nucl, warn.non.IUPAC = TRUE, type = c("DNA", "RNA"))
A single IUPAC symbol in lower case, or NA when this is not possible.
a nucleotide sequence as a vector of single chars
if TRUE warns when no IUPAC symbol is possible
whether this is a DNA or a RNA sequence
J.R. Lobry
The sequence is forced in lower case letters and ambiguous bases are expanded before trying to find an IUPAC symbol.
The nomenclature for incompletely specified bases in nucleic acid sequences at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC341218/
citation("seqinr")
See amb for the reverse operation. Use toupper to change lower case letters into upper case letters.
amb
toupper
stopifnot(bma(s2c("atatattttata")) == "w") stopifnot(bma(s2c("gcggcgcgcggc")) == "s") stopifnot(bma(s2c("ACGT")) == "n") stopifnot(is.na(bma(s2c("atatttt---tatat")))) # a warning is issued
Run the code above in your browser using DataLab