write.fas {ips} | R Documentation |
Write DNA Sequences to File
Description
Write DNA sequences and morphological data to FASTA, PHYLIP, or NEXUS formatted files.
Usage
write.fas(x, file, block.width = FALSE,
truncate = FALSE, append = FALSE)
write.phy(x, file, block.width = FALSE,
strict = FALSE)
write.nex(x, file, block.width = 60,
taxblock = FALSE)
Arguments
x |
an object of class |
file |
a character string giving the filename; a special case is |
block.width |
an integer, giving the number of characters per line. |
truncate |
truncation of taxon names to the number of characters given as a integer, otherwise (default) taxon names will not be changed. |
append |
logical, if |
strict |
logical, if |
taxblock |
logical, if |
Details
write.nex
can handle multiple DNA sequence alignments, which are handed over as a list of objects of class DNAbin
. Correct matching of the rows in the alignments is cared for automatically, hence the individual alignments can contain different numbers of samples and samples need not be in the same order.
Value
None, except when called with file
left unspecified, which causes the file content to be returned as a vector of mode "character"
. This is particularly useful for constructing special types of input files, e.g. for MrBayes (mrbayes
).
Author(s)
Christoph Heibl
References
Maddison, D.R., D.L. Swofford, and W.P. Maddison. 1997. NEXUS: an extensible file format for systematic information. Syst. Biol. 46: 590-621.
See Also
read.fas
, read.phy
, and read.nex
for reading of DNA sequence files.
Examples
data(ips.cox1)
data(ips.28S)
## Examples for FASTA files
## ------------------------
write.fas(ips.cox1[1:5, 1:120], block.width = 60)
## Examples for PHYLIP files
## ------------------------
write.phy(ips.cox1[1:5, 1:20], block.width = 40)
## Examples for NEXUS files
## ------------------------
x <- list(cox1 = ips.cox1[1:5, 1:10],
rna28S = ips.28S[1:5, 1:30])
write.nex(x, block.width = 20)
# Truncation of taxonnames:
# -------------------------
rownames(ips.cox1)[1] <- "AVeeeeeeeeeeeeeeeeeryLongName"
write.fas(ips.cox1, truncate = 10)
# If truncation leads to identical taxonnames,
# a warning will be issued:
# -------------------------
rownames(ips.cox1)[1:2] <- "AVeeeeeeeeeeeeeeeeeryLongName"
write.fas(ips.cox1, truncate = 10)