]> git.donarmstrong.com Git - ape.git/blob - man/write.nexus.data.Rd
new code for reading FASTA files
[ape.git] / man / write.nexus.data.Rd
1 \name{write.nexus.data}
2 \alias{write.nexus.data}
3 \title{
4   Write Character Data In NEXUS Format
5 }
6 \description{
7   This function writes in a file a list of sequences in the NEXUS
8   format.The names of the vectors of the list are used as taxon names.
9 }
10 \usage{
11 write.nexus.data(x, file, format = "dna", datablock = TRUE,
12                  interleaved = TRUE, charsperline = NULL,
13                  gap = NULL, missing = NULL)
14 }
15 \arguments{
16   \item{x}{a list of sequences each made of a single vector of mode
17     character where each element is a character state (e.g. \dQuote{A},
18     \dQuote{C}, ...).}
19   \item{file}{a file name specified by either a variable of mode
20     character, or a double-quoted string.}
21   \item{format}{a character string specifying the format of the
22     sequences. Two choices are possible: \code{dna}, or \code{protein},
23     or any unambiguous abbreviation of these. Default is
24     \dQuote{\code{dna}}.}
25   \item{datablock}{a logical, if \code{TRUE} the data are written in a
26     single DATA block. If \code{FALSE} data is written in TAXA and
27     CHARACTER blocks. Default is \code{TRUE}.}
28   \item{interleaved}{a logical, if \code{TRUE} the data is written in
29     interleaved format with number of characters per line as specified
30     with \code{charsperline = numerical_value}. If \code{FALSE}, data is
31     written in sequential format. Default is \code{TRUE}.}
32   \item{charsperline}{a numeric specifying the number of characters per
33     line when used with \code{interleaved = TRUE}. Default is
34     \code{80}.}
35   \item{gap}{a character specifying the symbol for gap. Default is
36     \dQuote{\code{-}}.}
37   \item{missing}{a character specifying the symbol for missing
38     data. Default is \dQuote{\code{?}}.}
39 }
40 \details{
41   If the sequences have no names, then they are given \dQuote{1},
42   \dQuote{2}, ..., as names in the file.
43
44   Sequences must be all of the same length (i.e., aligned).
45
46   Default symbols for missing data and gaps can be changed by using the
47   \code{missing} and \code{gap} commands.
48
49   Please see files \file{data.nex} and \file{taxacharacters.nex} for
50   examples of output formats.
51 }
52 \value{
53   None (invisible \sQuote{NULL}).
54 }
55 \references{
56   Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an
57   extensible file format for systematic information. \emph{Systematic
58     Biology}, \bold{46}, 590--621.
59 }
60 \note{...}
61
62 \author{Johan Nylander \email{nylander@scs.fsu.edu}}
63 \seealso{
64   \code{\link{read.nexus}},\code{\link{write.nexus}},
65   \code{\link{read.nexus.data}}
66 }
67 \examples{
68 \dontrun{\dontshow{library(ape)}}
69 ## Write interleaved DNA data with 100 characters per line in a DATA block
70 \dontrun{data("woodmouse")}
71 \dontrun{write.nexus.data(woodmouse, file= "woodmouse.example.nex", interleaved = TRUE, charsperline = 100)}
72 ## Write sequential DNA data in TAXA and CHARACTERS blocks
73 \dontrun{data("cynipids")}
74 \dontrun{write.nexus.data(cynipids, file= "cynipids.example.nex", format = "protein", datablock = FALSE, interleaved = FALSE)}
75 \dontrun{\dontshow{unlink(c("woodmouse.example.nex", "cynipids.example.nex"))}}
76 }
77 \keyword{file}