3 \title{Write DNA Sequences in a File}
5 write.dna(x, file, format = "interleaved", append = FALSE,
6 nbcol = 6, colsep = " ", colw = 10, indent = NULL,
10 \item{x}{a list or a matrix of DNA sequences.}
11 \item{file}{a file name specified by either a variable of mode character,
12 or a double-quoted string.}
13 \item{format}{a character string specifying the format of the DNA
14 sequences. Three choices are possible: \code{"interleaved"},
15 \code{"sequential"}, or \code{"fasta"}, or any unambiguous
16 abbreviation of these.}
17 \item{append}{a logical, if \code{TRUE} the data are appended to the
18 file without erasing the data possibly existing in the file,
19 otherwise the file (if it exists) is overwritten (\code{FALSE} the
21 \item{nbcol}{a numeric specifying the number of columns per row (6 by
22 default); may be negative implying that the nucleotides are printed
24 \item{colsep}{a character used to separate the columns (a single
26 \item{colw}{a numeric specifying the number of nucleotides per column
28 \item{indent}{a numeric or a character specifying how the blocks of
29 nucleotides are indented (see details).}
30 \item{blocksep}{a numeric specifying the number of lines between the
31 blocks of nucleotides (this has an effect only if `format =
35 This function writes in a file a list of DNA sequences in sequential,
36 interleaved, or FASTA format. The names of the vectors of the list are
40 The same three formats are supported in the present function than in
41 \code{\link{read.dna}}: see its help page and the references below for
42 a description of these formats.
44 If the sequences have no names, then they are given "1", "2", ... as
47 With the interleaved and sequential formats, the sequences must be all
48 of the same length; if the taxon names are longer than 10 characters,
49 they are truncated and a warning message is issued.
51 The argument `indent' specifies how the rows of nucleotides are
52 indented. In the interleaved and sequential formats, the rows with
53 the taxon names are never indented; the subsequent rows are indented
54 with 10 spaces by default (i.e. if `indent = NULL)'. In the FASTA
55 format, the rows are not indented by default. This default behaviour
56 can be modified by specifying a value to `indent': the rows are then
57 indented with `indent' (if it is a character) or `indent' spaces (if
58 it is a numeric). For example, specifying `indent = " "' or `indent
59 = 3' will have exactly the same effect (use `indent = "\t"' for a
63 Specifying a negative value for `nbcol' (meaning that the nucleotides
64 are printed on a single line) gives the same result for the
65 interleaved and sequential formats.
67 The different options are intended to give flexibility in formatting
68 the sequences. For instance, if the sequences are very long it may be
69 judicious to remove all the spaces beween columns `(colsep = ""), in
70 the margins (indent = 0), and between the blocks (blocksep = 0) to
71 produce a smaller file.
74 None (invisible `NULL').
76 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
78 Anonymous. FASTA format description.
79 \url{http://www.ncbi.nlm.nih.gov/BLAST/fasta.html}
81 Anonymous. IUPAC ambiguity codes.
82 \url{http://www.ncbi.nlm.nih.gov/SNP/iupac.html}
84 Felsenstein, J. (1993) Phylip (Phylogeny Inference Package) version
85 3.5c. Department of Genetics, University of Washington.
86 \url{http://evolution.genetics.washington.edu/phylip/phylip.html}
89 \code{\link{read.dna}}, \code{\link{read.GenBank}}