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. The 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 verbose=TRUE
(default), the function prints a warning if a problematic character is
found. At the same time, regardless of the verbose
argument,
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.