Learn R Programming

phangorn (version 0.0-5)

phyDat: Conversion amoung 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=FALSE, ...) 
## S3 method for class 'DNAbin':
as.phyDat(x, ...)
## S3 method for class 'phyDat':
as.character(x, ...)
## S3 method for class 'phyDat':
as.data.frame(x, ...)
allSitePattern(n, levels=c("a","c","g","t"), names=NULL)

Arguments

data
An object containing sequences.
x
An object containing sequences.
type
Type of sequences ("DNA", "AA" or "USER").
levels
Level atttributes.
return.index
If TRUE returns a index of the site patterns.
n
Number of sequences.
names
Names of sequences.
...
further arguments passed to or from other methods.

Value

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. allSitePattern returns all possible site patternsis and can be usefull in simulation studies.

See Also

as.DNAbin, read.dna and read.nexus.data and the example of pmlMix for the use of allSitePattern

Examples

Run this code
data(Laurasiatherian)
class(Laurasiatherian)
Laurasiatherian
# transform into old ape format
LauraChar <- as.character(Laurasiatherian)
# and back 
Laura <- phyDat(LauraChar, return.index=TRUE)
all.equal(Laurasiatherian, Laura)
allSitePattern(5)

Run the code above in your browser using DataLab