TreeTools (version 0.1.3)

ExtractTaxa: Extract taxa from a matrix block

Description

Reads the character information from a Nexus-formatted matrix into R.

Usage

ExtractTaxa(matrixLines, character_num = NULL, session = NULL)

NexusTokens(tokens, character_num = NULL, session = NULL)

Arguments

matrixLines

lines of a file containing a phylogenetic matrix (see ReadCharacters for expected format).

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.

tokens

Vector of character strings corresponding to phylogenetic tokens.

Value

ExtractTaxa returns a matrix with n rows, each named for the relevant taxon, and c columns, each corresponding to the respective character specified in character_num.

NexusTokens returns a character vector in which each entry corresponds to the states of a phylogenetic character.

Functions

  • NexusTokens: Converts a Nexus string to a vector of character states.

Details

Extracts the names of tips from the matrix block of a Nexus file.

Examples

Run this code
# NOT RUN {
fileName <- paste0(system.file(package='TreeTools'),
                   '/extdata/input/dataset.nex')
matrixLines <- readLines(fileName)[6:11]
ExtractTaxa(matrixLines)

NexusTokens('01[01]-?')
# }

Run the code above in your browser using DataCamp Workspace