
read.GenoDive
takes a text file in the format for the software
GenoDive and produces a vector indicating which samples are in which
populations and a two-dimensional list of vectors containing the genotypes.read.GenoDive(infile, missing = -9)
read.GenoDive
imports data from text
files formatted for this program.
The first line of the file is a comment line, ignored by the function.
On the second line, separated by tabs, are the number of individuals,
number of populations, number of loci, maximum ploidy
(ignored), and number of digits used to code alleles.
The following lines contain the names of populations, which are ignored
by the function although the number of lines should be the same as the
number of populations as specified in the first line. After that is a
header line for the genotype data. This line contains, separated by
tabs, column headers for populations, clones (optional), and
individuals, followed by the name of each locus. The loci names for the
genotype object are derived from this line.
Each individual is on one line following the genotype header line.
Separated by tabs are the population number, the clone number
(optional), the individual name (used as the sample name in the output)
and the genotypes at each locus. Alleles at one locus are concatenated
together in one string without any characters to separate them. Each
allele must have the same number of digits, although leading zeros can
be omitted.
If the only alleles listed for a particular individual and locus are
zeros, this is interpreted by read.GenoDive
as missing data, and
missing
(-9 by default) is recorded in the list.
GenoDive allows for a genotype to be partially missing but polysat does
not; therefore, if an allele is coded as zero but other alleles are
recorded for that sample and locus, the output genotype will just
contain the alleles that are present, with the zeros thrown out.read.GeneMapper
, write.GenoDive
,
read.Tetrasat
, read.ATetra
,
read.Structure
, dominant.to.codominant
,
read.SPAGeDi
# create data file (normally done in a text editor or spreadsheet software)
cat(c("example comment line", "5t2t2t3t2", "pop1", "pop2",
"poptindtloc1tloc2", "1tJohnt102t1214",
"1tPault202t0", "2tGeorget101t121213",
"2tRingot10304t131414","1tYokot10303t120014"),
file = "genodiveExample.txt", sep = "")
# import file data
exampledata <- read.GenoDive("genodiveExample.txt")
# view data
exampledata$PopData
exampledata$Genotypes[,"loc1"]
exampledata$Genotypes[,"loc2"]
Run the code above in your browser using DataLab