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

View source: R/read.nexus.partitions.R

read.nexus.partitionsR Documentation

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", ...)

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.

Value

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

Author(s)

Klaus Schliep klaus.schliep@gmail.com

See Also

read.nexus.data, read.phyDat

Examples

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)

KlausVigo/phangorn documentation built on Nov. 5, 2024, 11 a.m.