write.fas: Write DNA Sequences to File

Description Usage Arguments Value Author(s) References See Also Examples

Description

These functions write DNA sequences to FASTA, PHYLIP, or NEXUS formatted files.

Usage

1
2
3
4
5
6
	
write.fas(x, file = "", interleave = FALSE, truncate = FALSE, append = FALSE)

write.phy(x, file = "", interleave = FALSE, strict = FALSE)

write.nex(x, file = "", interleave = 60, taxblock = FALSE)

Arguments

x

a list or matrix of DNA sequences.

file

a character string giving the filename; if file = "", the file is written on the standard output connection (i.e. the console).

interleave

an integer, giving the number of bases 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 TRUE the sequences will be appended to file (if it exists).

strict

logical, if TRUE the names of the sequences will be truncated to 10 strings.

taxblock

logical, if TRUE, a tax block will be added to the NEXUS file.

Value

None.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Example data:
# -----------------------------
data(woodmouse)
woodmouse <- woodmouse[, 1:120]

## Examples for FASTA files
## ------------------------
write.fas(woodmouse, interleave = 60)

## Examples for PHYLIP files
## ------------------------
write.phy(woodmouse, interleave = 40)

## Examples for NEXUS files
## ------------------------
# write nexus file with taxon block
write.nex(woodmouse, taxblock = TRUE)
# write non-interleaved nexus file without taxon block
write.nex(woodmouse, interleave = FALSE)

# Truncation of taxonnames:
# -------------------------
rownames(woodmouse)[15] <- "AVeeeeeeeeeeeeeeeeeryLongName"
write.fas(woodmouse, truncate = 10)

# If truncation leads to identical taxonnames,
# a warning will be issued:
# -------------------------
rownames(woodmouse)[14:15] <- "AVeeeeeeeeeeeeeeeeeryLongName"
write.fas(woodmouse, truncate = 10)

fmichonneau/phyloch documentation built on May 16, 2019, 1:45 p.m.