Learn R Programming

polysat (version 0.1)

write.ATetra: Write Genotypes in ATetra Format

Description

Given a genotype object in the standard polysat format and an index of which samples belong to which populations, write.ATetra creates a text file of genotypes in the ATetra format.

Usage

write.ATetra(gendata, samples = dimnames(gendata)[[1]],
loci = dimnames(gendata)[[2]], popinfo = rep(1, length(samples)),
popnames = "onebigpop", commentline = "insert data info here",
missing = -9, file = "")

Arguments

gendata
A two-dimensional list of integer vectors, in the standard polysat format. Samples are represented in the first dimension and loci are represented in the second dimension, and both dimensions are named accordingly. Each vector contains each unique al
samples
A character vector of samples to write to the file. This is a subset of dimnames(gendata)[[1]].
loci
A character vector of loci to write to the file. This is a subset of dimnames(gendata)[[2]].
popinfo
An integer vector where each number represents to which population a sample belongs. The vector should have names corresponding to samples, or if unnamed is assumed to be in the same order as samples.
popnames
A character vector containing the name of each population. The populations should be ordered by the numbers used to represent them in popinfo.
commentline
A character string to be put into the title line of the file.
missing
The symbol used to represent missing data in gendata.
file
A character string indicating the path and name to which to write the file.

Value

  • A file is written but no value is returned.

Details

Note that missing data are not allowed in ATetra, although write.ATetra will still process missing data. When it does so, it leaves all alleles blank in the file for that particular sample and locus, and also prints a warning indicating which sample and locus had missing data. popinfo can contain information for additional samples that are not to be used in the file (are not in samples). If the number of poplations in popinfo is greater than the length of popnames, a warning will be printed and only the populations up to the length of popnames will be used. If popnames is longer than the number of populations in popinfo, the same warning will be printed and there will be a subscripting error.

References

http://www.vub.ac.be/APNA/ATetra_Manual-1-1.pdf van Puyvelde, K., van Geert, A. and Triest, L. (2010) ATETRA, a new software program to analyze tetraploid microsatellite data: comparison with TETRA and TETRASAT. Molecular Ecology Resources 10, 331-334.

See Also

read.ATetra, write.Tetrasat, write.GenoDive, write.Structure, write.GeneMapper, codominant.to.dominant, write.SPAGeDi

Examples

Run this code
# set up sample data (usually done by reading files)
mysamples <- c("ind1", "ind2", "ind3", "ind4")
myloci <- c("loc1", "loc2")
mygendata <- array(list(-9), dim=c(4,2), dimnames=list(mysamples, myloci))
mygendata[,"loc1"] <- list(c(202,204), c(204), c(200,206,208,212),
                           c(198,204,208))
mygendata[,"loc2"] <- list(c(78,81,84), c(75,90,93,96,99), c(87), c(-9))
mypopinfo <- c(1,2,1,2)
names(mypopinfo) <- mysamples
mypopnames <- c("this pop", "that pop")

# write an ATetra file
write.ATetra(mygendata, popinfo=mypopinfo, popnames=mypopnames,
             commentline="sample data", file="atetratest.txt")

# view the file
cat(readLines("atetratest.txt"),sep="")

Run the code above in your browser using DataLab