writeGenPop: Write genind as GENEPOP file

Description Usage Arguments Details Value Author(s) Examples

Description

Write adegenet's genind object to GENEPOP format

Usage

1
writeGenPop(gi, file.name, comment)

Arguments

gi

A genind object with defined strata and population. See setPop. If a list, each list element will be written as a population. It is assumed that loci for all genind elements in a list are identical.

file.name

A character string defining file name. You will have to specify the extension as well.

comment

A character string with a desired comment that will be prepended to the beginning of the file.

Details

Function will write adegenet's genind object to GENEPOP as defined at http://genepop.curtin.edu.au/help_input.html. First line is a comment, second line is loci names and the rest consists of lines "pop" and genotype names and their allele values on corresponding loci. This function differs from writeGenePop, relies on defined strata and is more general.

Value

A file on disk, function return NULL to R.

Author(s)

Roman Lustrik (roman.lustrik@biolitika.si)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(adegenet)
data(nancycats)
# Genind object must have a population defined. This is trivial with strata.
other(nancycats)$pop <- sample(letters[1:4], size = nInd(nancycats), replace = TRUE)
strata(nancycats) <- data.frame(pop = other(nancycats)$pop)
setPop(nancycats) <- ~pop

# write the file and remove it
writeGenPop(nancycats, file.name = "test.gen", comment = "is a no comment")
file.remove("test.gen")

romunov/zvau documentation built on May 27, 2019, 1:50 p.m.