These functions transform several DNA formats into the phyDat
format.
allSitePattern
generates an alignment of all possible site patterns.
phyDat(data, type = "DNA", levels = NULL, return.index = TRUE, ...)dna2codon(x)
codon2dna(x)
as.phyDat(x, ...)
# S3 method for factor
as.phyDat(x, ...)
# S3 method for DNAbin
as.phyDat(x, ...)
# S3 method for alignment
as.phyDat(x, type = "DNA", ...)
phyDat2alignment(x)
# S3 method for MultipleAlignment
as.phyDat(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, ...)
write.phyDat(x, file, format = "phylip", colsep = "", nbcol = -1, ...)
read.phyDat(file, format = "phylip", type = "DNA", ...)
baseFreq(obj, freq = FALSE, all = FALSE, drop.unused.levels = FALSE)
# S3 method for phyDat
subset(x, subset, select, site.pattern = TRUE, ...)
# S3 method for phyDat
unique(x, incomparables = FALSE, identical = TRUE, ...)
allSitePattern(n, levels = c("a", "c", "g", "t"), names = NULL)
genlight2phyDat(x, ambiguity = NA)
# S3 method for phyDat
image(x, ...)
An object containing sequences.
Type of sequences ("DNA", "AA", "CODON" or "USER").
Level attributes.
If TRUE returns a index of the site patterns.
further arguments passed to or from other methods.
An object containing sequences.
return original data.
A file name.
File format of the sequence alignment (see details). Several popular formats are supported: "phylip", "interleaved", "sequential", "clustal", "fasta" or "nexus", or any unambiguous abbreviation of these.
a character used to separate the columns (a single space by default).
a numeric specifying the number of columns per row (-1 by default); may be negative implying that the nucleotides are printed on a single line.
as object of class phyDat
logical, if 'TRUE', frequencies or counts are returned otherwise proportions
all a logical; if all = TRUE, all counts of bases, ambiguous codes, missing data, and alignment gaps are returned as defined in the contrast.
logical, drop unused levels
a subset of taxa.
a subset of characters.
select site pattern or sites.
for compatibility with unique.
if TRUE (default) sequences have to be identical, if FALSE sequences are considered duplicates if distance between sequences is zero (happens frequently with ambiguous sites).
Number of sequences.
Names of sequences.
character for ambiguous character and no contrast is provided.
The functions return an object of class phyDat
.
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".
allSitePattern
returns all possible site patterns and can be useful
in simulation studies. For further details see the vignette
phangorn-specials.
write.phyDat
calls the function write.dna or write.nexus.data and
read.phyDat
calls the function read.dna
, read.aa
or
read.nexus.data
see for more details over there.
You may import data directly with read.dna
or
read.nexus.data
and convert the data to class phyDat.
The generic function c
can be used to to combine sequences and
unique
to get all unique sequences or unique haplotypes.
acgt2ry
converts a phyDat
object of nucleotides into an binary
ry-coded dataset.
DNAbin
, as.DNAbin
,
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
# NOT RUN {
data(Laurasiatherian)
class(Laurasiatherian)
Laurasiatherian
baseFreq(Laurasiatherian)
baseFreq(Laurasiatherian, all=TRUE)
subset(Laurasiatherian, subset=1:5)
# transform into old ape format
LauraChar <- as.character(Laurasiatherian)
# and back
Laura <- phyDat(LauraChar)
all.equal(Laurasiatherian, Laura)
allSitePattern(5)
# }
Run the code above in your browser using DataLab