writeGenepop: Write GenAlEx-format genotypes to a text file in Genepop...

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 Genepop-format text file. included immediately to the right of genotype columns. Genepop and its documentation are available at http://kimura.univ-montp2.fr/~rousset/ and http://kimura.univ-montp2.fr/~rousset/Genepop.pdf.

Usage

1
writeGenepop(x, file, eol = "\n", check.annotation = TRUE)

Arguments

x

Annotated data frame of class genalex

file

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

eol

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

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

Although the GenAlEx and Genepop formats encode nearly the same data, there are flexibilities and limitations on both sides. For example, Genepop allows for a maximum of 3 digits to encode each allele, and only haploid or diploid data, while allowing for some mixing of diploid and haploid encodings. GenAlEx allows for more digits per allele and higher ploidy, although numeric data is still required, and only allows for a single ploidy per data file. Perhaps future extensions to this function will allow for additional haploid data to be written.

An attempt is made to produce output with useful whitespace. The locus names and each set of individual genotypes are aligned at a column determined by the longest sample name.

GenAlEx format components that are attributes of class genalex are translated to components in the Genepop file as so:

  1. The dataset title from the "dataset.title" attribute is written as the first line

  2. The locus names from the "locus.names" attribute are written comma-separated as the second line

  3. For each population listed in the "pop.labels" attribute, a single line containing Pop popname is written

  4. For each sample from a population, the sample identifier is written, then a space, comma and space, then the individual genotypes encoded as two or three digits per allele. Alleles for each locus are concatenated, and successive loci are separated by a single space.

  5. Populations are written in the order in which they appear in the "pop.labels" attribute

  6. Missing alleles are coded as zeroes "00" or "000"

  7. The same number of digits are used for encoding each allele of all loci

  8. For Genepop ploidy is indicated by the number of digits used for encoding each locus. Two or three digits for the entire locus indicates haploidy, while four or six digits indicates diploidy with each allele using two or three digits, respectively.

  9. For Genepop there is no provision for encoding additional non-genetic data

Value

No value is returned.

Author(s)

Douglas G. Scofield

References

Rousset, F. (2008) GENEPOP '007: a complete reimplementation of the GENEPOP software for Windows and Linux. Molecular Ecology Resources 8, 103-106. http://onlinelibrary.wiley.com/doi/10.1111/j.1471-8286.2007.01931.x/abstract.

See Also

writeGenalex

Examples

1
2
3
4
data(Qagr_pericarp_genotypes)
# lots of output to terminal
dd <- as.genalex(head(Qagr_pericarp_genotypes, 40), force = TRUE)
writeGenepop(dd, file = "")

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