Learn R Programming

phangorn (version 2.12.1)

phyDat: Conversion among Sequence Formats

Description

These functions transform several DNA formats into the phyDat format. allSitePattern generates an alignment of all possible site patterns.

Usage

phyDat(data, type = "DNA", levels = NULL, return.index = TRUE, ...)

as.phyDat(x, ...)

# S3 method for factor as.phyDat(x, ...)

# S3 method for DNAbin as.phyDat(x, ...)

# S3 method for AAbin as.phyDat(x, ...)

# S3 method for alignment as.phyDat(x, type = "DNA", ...)

phyDat2alignment(x)

# S3 method for MultipleAlignment as.phyDat(x, ...)

# S3 method for AAStringSet as.phyDat(x, ...)

# S3 method for DNAStringSet as.phyDat(x, ...)

as.StringSet(x, ...)

# S3 method for phyDat as.StringSet(x, ...)

# S3 method for phyDat as.MultipleAlignment(x, ...)

# S3 method for phyDat as.character(x, allLevels = TRUE, ...)

# S3 method for phyDat as.data.frame(x, ...)

# S3 method for phyDat as.DNAbin(x, ...)

# S3 method for phyDat as.AAbin(x, ...)

genlight2phyDat(x, ambiguity = NA)

acgt2ry(obj)

Value

The functions return an object of class phyDat.

Arguments

data

An object containing sequences.

type

Type of sequences ("DNA", "AA", "CODON" or "USER").

levels

Level attributes.

return.index

If TRUE returns a index of the site patterns.

...

further arguments passed to or from other methods.

x

An object containing sequences.

allLevels

return original data.

ambiguity

character for ambiguous character and no contrast is provided.

obj

as object of class phyDat

Author

Klaus Schliep klaus.schliep@gmail.com

Details

If type "USER" a vector has to be give to levels. For example c("a", "c", "g", "t", "-") would create a data object that can be used in phylogenetic analysis with gaps as fifth state. There is a more detailed example for specifying "USER" defined data formats in the vignette "phangorn-specials".

acgt2ry converts a phyDat object of nucleotides into an binary ry-coded dataset.

See Also

DNAbin, as.DNAbin, baseFreq, glance.phyDat, read.dna, read.nexus.data and the chapter 1 in the vignette("phangorn-specials", package="phangorn") and the example of pmlMix for the use of allSitePattern

Examples

Run this code

data(Laurasiatherian)
class(Laurasiatherian)
Laurasiatherian
# transform as characters
LauraChar <- as.character(Laurasiatherian)
# and back
Laura <- phyDat(LauraChar)
all.equal(Laurasiatherian, Laura)
LauraDNAbin <- as.DNAbin(Laurasiatherian)
all.equal(Laurasiatherian, as.phyDat(LauraDNAbin))

Run the code above in your browser using DataLab