This function checks and fixed sequence names of multiple
alignment objects if they contain characters
that might lead to LaTeX problems when using
an object of class
a character string specifying with which character(s) potentially problematic characters should be replaced.
The Biostrings package does not impose any restrictions on
the names of sequences. Consequently, msa also allows all
possible ASCII strings as sequence (row) names in multiple alignments.
As soon as
msaPrettyPrint is used for pretty-printing
multiple sequence alignments, however, the sequence names are
interpreted as plain LaTeX source code. Consequently, LaTeX errors
may arise because of characters or words in the sequence names that LaTeX
does not or cannot interpret as plain text correctly. This
particularly includes appearances of special characters and backslash
characters in the sequence names.
msaCheckNames function takes a multiple alignment object
and checks sequence names for possibly problematic characters, which
are all characters but letters (upper and lower case), digits,
spaces, commas, colons, semicolons, periods, question and exclamation
marks, dashes, braces, single quotes, and double quotes.
All other characters are
considered problematic. The function allows for both checking and
fixing the sequence names. If called with
(default), the function prints a warning if a problematic character is
found. At the same time, regardless of the
the function invisibly returns a copy of
x in whose sequence
names all problematic characters have been replaced by the string
that is supplied via the
replacement argument (the default is
a single space).
In any case, the best solution is to check sequence names carefully and to avoid problematic sequence names from the beginning.
The function invisibly returns a copy of the argument
(therefore, an object of the same class as
with modified sequence/row names (see details above).
Ulrich Bodenhofer <firstname.lastname@example.org>
U. Bodenhofer, E. Bonatesta, C. Horejs-Kainrath, and S. Hochreiter (2015). msa: an R package for multiple sequence alignment. Bioinformatics 31(24):3997-3999. DOI: 10.1093/bioinformatics/btv494.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
## create toy example mySeqs <- DNAStringSet(c("ACGATCGATC", "ACGACGATC", "ACGATCCCCC")) names(mySeqs) <- c("Seq. #1", "Seq. \2", "Seq. ~3") ## perform multiple alignment myAlignment <- msa(mySeqs) myAlignment ## check names msaCheckNames(myAlignment) ## fix names myAlignment <- msaCheckNames(myAlignment, replacement="", verbose=FALSE) myAlignment