alleleconvert {prabclus} | R Documentation |
Codominant marker data (which here means: data with several diploid
loci; two alleles per locus) can be represented in various ways. This
function converts the formats "genepop"
and "structure"
into
"structurama"
and "prabclus"
. "genepop"
is a version of the format
used by the package GENEPOP (Rousset, 2010), "structure"
is a version
of what is used by STRUCTURE (Pritchard et al., 2000), "structurama"
is a version of what is used by STRUCTURAMA (Huelsenbeck and
Andolfatto, 2007) and "prabclus"
is required by the function
alleleinit
in the present package.
alleleconvert(file=NULL,strmatrix=NULL, format.in="genepop", format.out="prabclus", alength=3,orig.nachar="000",new.nachar="-", rows.are.individuals=TRUE, firstcolname=FALSE, aletters=intToUtf8(c(65:90,97:122),multiple=TRUE), outfile=NULL)
file |
string. Filename of input file, see details. One of
|
strmatrix |
matrix or data frame of strings, see details. One of
|
format.in |
string. One of |
format.out |
string. One of |
alength |
integer. If |
orig.nachar |
string. Code for missing values in input data. |
new.nachar |
string. Code for missing values in output data. |
rows.are.individuals |
logical. If |
firstcolname |
logical. If |
aletters |
character vector. String of default characters for
alleles if |
outfile |
string. If specified, the output matrix (omitting
quotes) is written to a file of this name (including row names if
|
The formats are as follows (described is the format within R, i.e.,
for the input, the format of strmatrix
; if file
is
specified, the file is read with
read.table(file,colClasses="character")
and should give the
format explained below - note that colClasses="character"
implies that quotes are not needed in the input file):
Alleles are coded by strings of length alength
and there is no space between the two alleles in a locus, so a
value of "258260"
means that in the corresponding locus the two
alleles have codes 258 and 260.
Alleles are coded by strings of arbitrary length. Two rows correspond to each inidividual, the first row containing the first alleles in all loci and the second row containing the second ones.
Alleles are coded by strings of arbitrary
length. the two alleles in each locus are written with brackets
around them and a comma in between, so "258260"
in
"genepop"
corresponds to "(258,260)"
in "structurama"
.
Alleles are coded by a single character and there is
no space between the two alleles in a locus (e.g.,
"AC"
).
A matrix of strings in the format specified as format.out
with
an attribute "alevels"
, a vector of all used allele codes if
format.out=="prabclus"
, otherwise vector of allele codes of
last locus.
Christian Hennig chrish@stats.ucl.ac.uk http://www.homepages.ucl.ac.uk/~ucakche
Huelsenbeck, J. P., and P. Andolfatto (2007) Inference of population structure under a Dirichlet process model. Genetics 175, 1787-1802.
Pritchard, J. K., M. Stephens, and P. Donnelly (2000) Inference of population structure using multi-locus genotype data. Genetics 155, 945-959.
Rousset, F. (2010) Genepop 4.0 for Windows and Linux. http://kimura.univ-montp2.fr/~rousset/Genepop.pdf
data(tetragonula) # This uses example data file Heterotrigona_indoFO.dat str(alleleconvert(strmatrix=tetragonula)) strucmatrix <- cbind(c("I1","I1","I2","I2","I3","I3"),c("122","144","122","122","144","144"),c("0","0","21","33","35","44")) alleleconvert(strmatrix=strucmatrix,format.in="structure",format.out="prabclus",orig.nachar="0",firstcolname=TRUE) alleleconvert(strmatrix=strucmatrix,format.in="structure",format.out="structurama",orig.nachar="0",new.nachar="-9",firstcolname=TRUE)