writeGenalex: Write GenAlEx-format genotypes to a text file

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

Description

Writes genotype data encoded in an annotated data frame of class genalex to a GenAlEx-format text file. Extra data columns are written immediately to the right of genotype columns. GenAlEx and its documentation are available at http://biology-assets.anu.edu.au/GenAlEx.

Usage

1
2
writeGenalex(x, file, quote = FALSE, sep = "\t", eol = "\n", na = "0",
  na.character = "", check.annotation = TRUE)

Arguments

x

Annotated data frame of class genalex

file

File name or connection for writing. If given as "", stdout() is used.

quote

Logical value (TRUE or FALSE). If TRUE, all character data are surrounded by double quotes, and all header fields except for counts are quoted if they exist. Note that genotype data will not be quoted, as they are' numeric values. Data in the extra columns will be quoted, unless some have been made numeric since being read. If FALSE, nothing is quoted.

sep

Column separator for output (defaults to "\t").

eol

End-of-line character used for output (defaults to "\n").

na

The string to use when writing missing values in genotype data. Defaults to "0".

na.character

The string to use when writing missing values in character data. Defaults to "".

check.annotation

If TRUE, the annotations for the dataset are checked using is.genalex(x, force = TRUE, skip.strings = TRUE). If that returns FALSE, nothing is written and an error is generated.

Details

This function writes genotypes and associated information within an annotated data frame of class genalex to a text file in GenAlEx format. More information is available in the description for readGenalex, and at the GenAlEx website at http://biology-assets.anu.edu.au/GenAlEx.

Doing writeGenalex(readGenalex("file.txt"), "file-write.txt") won't necessarily produce an output file identical to the input file. Three areas for which this will likely be true are:

  1. Names on columns for alleles other than the first in a locus, which are ignored by readGenalex, converted to a simple concatenation of locus name and allele number in the resulting class genalex, and are left out of the output of writeGenalex.

  2. Locations of additional data columns beyond the genotype columns, which readGenalex should collect wherever there are named columns to the right of the genotype columns, and which writeGenalex will write immediately to the right of the genotype columns. The same column names are used when writing as were present when reading.

  3. Missing data will be coded with the values in na and na.character, regardless of the coding used when the data were read.

Value

No value is returned.

Author(s)

Douglas G. Scofield

References

Peakall, R. and Smouse P.E. (2012) GenAlEx 6.5: genetic analysis in Excel. Population genetic software for teaching and research-an update. Bioinformatics 28, 2537-2539.

Peakall, R. and Smouse P.E. (2006) GENALEX 6: genetic analysis in Excel. Population genetic software for teaching and research. Molecular Ecology Notes 6, 288-295.

See Also

readGenalex

Examples

1
2
3
data(Qagr_adult_genotypes)
# lots of output to terminal
writeGenalex(Qagr_adult_genotypes, file = "")

douglasgscofield/readGenalex documentation built on May 15, 2019, 10:43 a.m.