Skip to contents

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

# 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)

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

Value

The functions return an object of class phyDat.

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.aa, read.nexus.data and the chapter 1 in the vignette("phangorn-specials", package="phangorn") and the example of pmlMix for the use of allSitePattern

Author

Klaus Schliep klaus.schliep@gmail.com

Examples


data(Laurasiatherian)
class(Laurasiatherian)
#> [1] "phyDat"
Laurasiatherian
#> 47 sequences with 3179 character and 1605 different site patterns.
#> The states are a c g t 
# transform as characters
LauraChar <- as.character(Laurasiatherian)
# and back
Laura <- phyDat(LauraChar)
all.equal(Laurasiatherian, Laura)
#> [1] TRUE
LauraDNAbin <- as.DNAbin(Laurasiatherian)
all.equal(Laurasiatherian, as.phyDat(LauraDNAbin))
#> [1] TRUE