]> git.donarmstrong.com Git - ape.git/blob - man/write.dna.Rd
318a341378175137e6f2497835b84969a7180c36
[ape.git] / man / write.dna.Rd
1 \name{write.dna}
2 \alias{write.dna}
3 \title{Write DNA Sequences in a File}
4 \usage{
5 write.dna(x, file, format = "interleaved", append = FALSE,
6           nbcol = 6, colsep = " ", colw = 10, indent = NULL,
7           blocksep = 1)
8 }
9 \arguments{
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
20     default).}
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
23     on a single line.}
24   \item{colsep}{a character used to separate the columns (a single
25     space by default).}
26   \item{colw}{a numeric specifying the number of nucleotides per column
27     (10 by default).}
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 =
32     "interleaved"').}
33 }
34 \description{
35   This function writes in a file a list of DNA sequences in sequential,
36   interleaved, or FASTA format.
37 }
38 \details{
39   Three formats are supported in the present function: see the help page
40   of \code{\link{read.dna}} and the references below for a description.
41
42   If the sequences have no names, then they are given "1", "2", ... as
43   names in the file.
44
45   With the interleaved and sequential formats, the sequences must be all
46   of the same length. The names of the sequences are not truncated.
47
48   The argument \code{indent} specifies how the rows of nucleotides are
49   indented. In the interleaved and sequential formats, the rows with
50   the taxon names are never indented; the subsequent rows are indented
51   with 10 spaces by default (i.e., if \code{indent = NULL}). In the FASTA
52   format, the rows are not indented by default. This default behaviour
53   can be modified by specifying a value to \code{indent}: the rows are then
54   indented with ``indent'' (if it is a character) or `indent' spaces (if
55   it is a numeric). For example, specifying \code{indent = "   "} or
56   \code{indent = 3} will have the same effect (use \code{indent = "\\t"}
57   for a tabulation).
58
59   The different options are intended to give flexibility in formatting
60   the sequences. For instance, if the sequences are very long it may be
61   judicious to remove all the spaces beween columns (colsep = ""), in
62   the margins (indent = 0), and between the blocks (blocksep = 0) to
63   produce a smaller file.
64 }
65 \note{
66   Specifying a negative value for `nbcol' (meaning that the nucleotides
67   are printed on a single line) gives the same result for the
68   interleaved and sequential formats.
69
70   The names of the sequences may be truncated with the function
71   \code{\link{makeLabel}}. In particular, Clustal is limited to 30
72   characters, whereas PHYML seems limited to 99 characters.
73
74   The FASTA format may be used as input for Clustal.
75 }
76 \value{
77   None (invisible `NULL').
78 }
79 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
80 \references{
81   Anonymous. FASTA format description.
82   \url{http://www.ncbi.nlm.nih.gov/BLAST/fasta.html}
83
84   Anonymous. IUPAC ambiguity codes.
85   \url{http://www.ncbi.nlm.nih.gov/SNP/iupac.html}
86
87   Felsenstein, J. (1993) Phylip (Phylogeny Inference Package) version
88   3.5c. Department of Genetics, University of Washington.
89   \url{http://evolution.genetics.washington.edu/phylip/phylip.html}
90 }
91 \seealso{
92   \code{\link{read.dna}}, \code{\link{read.GenBank}},
93   \code{\link{makeLabel}}
94 }
95 \keyword{IO}