Learn R Programming

phangorn (version 2.12.1)

read.nexus.partitions: Function to import partitioned data from nexus files

Description

read.nexus.partitions reads in sequences in NEXUS format and splits the data according to the charsets given in the SETS block.

Usage

read.nexus.partitions(file, return = "list", ...)

Value

a list where each element is a 'phyDat' object or an object of class 'multiphyDat'.

Arguments

file

a file name.

return

either returns a list where each element is a 'phyDat' object or an object of class 'multiphyDat'

...

Further arguments passed to or from other methods.

Author

Klaus Schliep klaus.schliep@gmail.com

See Also

read.nexus.data, read.phyDat

Examples

Run this code
tree <- rtree(10)
dat <- simSeq(tree, l=24)
fcat <- function(..., file = zz) cat(..., file=file, sep="", append=TRUE)
zz <- tempfile(pattern="file", tmpdir=tempdir(), fileext=".nex")
write.phyDat(dat, file=zz, format="nexus")
fcat("BEGIN SETS;\n")
fcat("  Charset codon1 = 1-12/3;\n")
fcat("  Charset codon2 = 2-12/3;\n")
fcat("  Charset codon3 = 3-12/3;\n")
fcat("  Charset range = 16-18;\n")
fcat("  Charset range2 = 13-15 19-21;\n")
fcat("  Charset singles = 22 23 24;\n")
fcat("END;\n")

tmp <- read.nexus.partitions(zz)
tmp
unlink(zz)

Run the code above in your browser using DataLab