Learn R Programming

TreeSearch (version 0.1.2)

ReadCharacters: Read characters from Nexus file

Description

Parses Nexus file, reading character states and names

Usage

ReadCharacters(filepath, character_num = NULL, session = NULL)

ReadTntCharacters(filepath, character_num = NULL, session = NULL)

ReadAsPhyDat(filepath)

ReadTntAsPhyDat(filepath)

PhyDat(dataset)

Arguments

filepath

character string specifying location of file

character_num

Index of character(s) to return. `NULL`, the default, returns all characters.

session

(optionally) a Shiny session with a numericInput named character_num whose maximum should be updated.

dataset

list of taxa and characters, in the format produced by [read.nexus.data].

Value

A matrix whose row names correspond to tip labels, and column names correspond to character labels, with the attribute `state.labels` listing the state labels for each character; or a character string explaining why the character cannot be returned.

Functions

  • ReadTntCharacters: Read characters from TNT file

  • ReadAsPhyDat: Read nexus characters as phyDat object

  • ReadTntAsPhyDat: Read TNT characters as phyDat object

  • PhyDat: A convenient wrapper for phangorn's phyDat, which converts a list of morphological characters into a phyDat object.

Details

Tested with nexus files downloaded from MorphoBank with the "no notes" option, but should also work more generally.

Do [report](https://github.org/ms609/TreeSearch/issues "New GitHub Issue") incorrectly parsed files.

References

Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an extensible file format for systematic information. Systematic Biology, 46, 590-621.