Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bma

Computing an IUPAC nucleotide symbol


Description

This function returns the IUPAC symbol for a nucleotide sequence, for instance c("c", "c", "g") is coded by "s".

Usage

bma(nucl, warn.non.IUPAC = TRUE, type = c("DNA", "RNA"))

Arguments

nucl

a nucleotide sequence as a vector of single chars

warn.non.IUPAC

if TRUE warns when no IUPAC symbol is possible

type

whether this is a DNA or a RNA sequence

Details

The sequence is forced in lower case letters and ambiguous bases are expanded before trying to find an IUPAC symbol.

Value

A single IUPAC symbol in lower case, or NA when this is not possible.

Author(s)

J.R. Lobry

References

The nomenclature for incompletely specified bases in nucleic acid sequences at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC341218/

citation("seqinr")

See Also

See amb for the reverse operation. Use toupper to change lower case letters into upper case letters.

Examples

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

seqinr

Biological Sequences Retrieval and Analysis

v4.2-16
GPL (>= 2)
Authors
Delphine Charif [aut], Olivier Clerc [ctb], Carolin Frank [ctb], Jean R. Lobry [aut, cph], Anamaria Necşulea [ctb], Leonor Palmeira [ctb], Simon Penel [cre], Guy Perrière [ctb]
Initial release
2022-05-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.