read.genepop {FinePop} | R Documentation |
Create a genotype data object of populations from a GENEPOP format file.
Description
This function reads a GENEPOP format file (Rousset 2008) and parse it into an R data object. This data object provides a summary of genotype/haplotype of each sample, allele frequency in each population, and marker status. This data object is used in downstream analysis of this package. This function is a "lite" and faster version of readGenepop function in diveRsity package (Keenan 2015).
Usage
read.genepop(genepop, popname = NULL)
Arguments
genepop |
A character value specifying the name of the GENEPOP file to be analyzed. |
popname |
A character value specifying the name of the plain text file containing the names of subpopulations to be analyzed. This text file must not contain other than subpopulation names. The names must be separated by spaces, tabs or line breaks. If this argument is omitted, serial numbers will be assigned as subpopulation names. |
Value
npops |
Number of subpopulations. |
pop_sizes |
Number of samples in each subpopulation. |
pop_names |
Names of subpopulations. |
nloci |
Number of loci. |
loci_names |
Names of loci. |
all_alleles |
A list of alleles at each locus. |
nalleles |
Number of alleles at each locus. |
indtyp |
Number of genotyped samples in each subpopulation at each locus. |
ind_names |
Names of samples in each subpopulation. |
pop_alleles |
Genotypes of each sample at each locus in haploid designation. |
pop_list |
Genotypes of each sample at each locus in diploid designation. |
obs_allele_num |
Observed allele counts at each locus in each subpopulation. |
allele_freq |
Observed allele frequencies at each locus in each subpopulation. |
call_rate |
Rate of genotyped samples at each locus. |
Author(s)
Reiichiro Nakamichi
References
Keenan K (2015) diveRsity: A Comprehensive, General Purpose Population Genetics Analysis Package. https://github.com/kkeenan02/diveRsity
Rousset F (2008) Genepop'007: a complete reimplementation of the Genepop software for Windows and Linux. Mol. Ecol. Resources, 8, 103-106.
Examples
# Example of GENEPOP file
data(jsmackerel)
jsm.ms.genepop.file <- tempfile()
jsm.popname.file <- tempfile()
cat(jsmackerel$MS.genepop, file=jsm.ms.genepop.file, sep="\n")
cat(jsmackerel$popname, file=jsm.popname.file, sep=" ")
# Read GENEPOP file with subpopulation names
# Prepare your GENEPOP file and population name file in the working directory
# Replace "jsm.ms.genepop.file" and "jsm.popname.file" by your file names.
popdata <- read.genepop(genepop=jsm.ms.genepop.file, popname=jsm.popname.file)
# Read GENEPOP file without subpopulation names
popdata.noname <- read.genepop(genepop=jsm.ms.genepop.file)