read.nexus.data(file)Please see files data.nex and taxacharacters.nex for examples of formats that will work.
Some noticeable exceptions from the NEXUS standard (non-exhaustive list):
[Comment] --- OK
Taxon ACGTACG [Comment] --- OK
[Comment line 1 Comment line 2] --- NOT OK!
Tax[Comment]on ACG[Comment]T --- NOT OK!
name ACGT --- OK
name AC GT --- NOT OK!
Genus_species --- OK
'Genus_species' --- OK
'Genus species' --- NOT OK!
end that closes the
matrix must be on a separate line. Examples:
taxon AACCGGT end; --- OK
taxon AACCGGT;
end; --- OK
taxon AACCCGT; end; --- NOT OK!
(XY), or as an
actual appearance of multiple states, {XY}. This is
information is not handled by the parser. Examples:
taxon 0011?110 --- OK
taxon 0011{01}110 --- NOT OK!
taxon 0011(01)110 --- NOT OK!
ntax. The same applies to nchar. Examples:
ntax = 12 --- OK
ntax = 12 --- NOT OK!
matrix command, unless it is in
a comment. Examples:
BEGIN CHARACTERS; TITLE 'Data in file "03a-cytochromeB.nex"';
DIMENSIONS NCHAR=382;
FORMAT DATATYPE=Protein GAP=- MISSING=?;
["This is The Matrix"] --- OK
MATRIX
BEGIN CHARACTERS;
TITLE 'Matrix in file "03a-cytochromeB.nex"'; --- NOT OK!
DIMENSIONS NCHAR=382;
FORMAT DATATYPE=Protein GAP=- MISSING=?;
MATRIX
read.nexus, write.nexus,
write.nexus.data
## Use read.nexus.data to read a file in NEXUS format into object x
## Not run: x <- read.nexus.data("file.nex")
Run the code above in your browser using DataLab