alleleinit
converts genetic data with diploid loci as generated
by alleleconvert
into an object of class
alleleobject
. print.alleleobject
is a print method for such
objects.
alleleinit(file = NULL, allelematrix=NULL,
rows.are.individuals = TRUE,
neighborhood = "none", distance = "alleledist", namode="variables",
nachar="-", distcount=FALSE)
# S3 method for alleleobject
print(x, ...)
alleleinit
produces
an object of class alleleobject
(note that this is similar to
class prab
; for example both can be used with
prabclust
), which is a list with components
distance matrix between individuals.
data frame of input data with string variables in the input format, see details. Note that in the output for an individual the whole locus is declared missing if at least one of its alleles is missing in the input.
matrix of characters in which there are two rows for
every individual corresponding to the two alleles in every locus
(column). Entries are allele codes but missing values are coded as
NA
.
neighborhood list, see above.
a neighborhood list in which for every row in
charmatrix
the second row number corresponding to the
neighboring individuals is listed.
number of loci.
number of individuals.
maximum number of different alleles in a locus.
identical to n.individuals
used for
compatibility with prabclust
.
character vector with all used allele codes not including missing values.
matrix in which rows are loci, columns are alleles and entries are frequencies of alleles per locus.
useless matrix of number of factor levels corresponding to
amatrix
added for compatibility with objects of class
prab
.
vector of row-wise sums of prab
added for
compatibility with objects of class prab
.
vector of column-wise sums of prab
added for
compatibility with objects of class prab
.
string denoting the chosen distance measure, see above.
see above.
probability of missing values, numeric or vector, see
documentation of argument namode
.
number of missing entries (individual/loci) in
amatrix
.
see above.
logical. TRUE
if a neighborhood was submitted.
string. File name. File must be in "prabclus"
format, see details. Either file
or allelematrix
needs to be specified.
matrix in "prabclus"
-format as generated by
alleleconvert
, see details. Either file
or allelematrix
needs to be specified.
logical. If TRUE
, rows are interpreted
as individuals and columns are interpreted as loci.
A string or a list with a component for
every individual. The
components are vectors of integers indicating
neighboring individuals. An individual without neighbors
should be assigned a vector numeric(0)
. If neighborhood
is a filename, it is attempted to read such a list from a file,
where every row should correspond to one region (such as example
dataset nb.dat
). If
neighborhood="none"
, all neighborhoods are set to
numeric(0)
. The neighborhood can be tested by
nbtest
for consistency.
"alleledist"
or "none"
. The distance measure
between individuals to compute by alleleinit
.
one of "single"
, "individuals"
,
"variables"
, or "none"
. Determines whether a
single probability for the entry to be missing is computed for a
single locus of an individual ("single"
), a vector of
individual-wise probabilities for loci to be missing
("individuals"
), a vector of loci-wise probabilities for
individuals to be missing ("variables"
) or no missingness
probability at all.
character denoting missing values.
logical. If TRUE
, during distance computation
individuals are counted on the screen.
object of class alleleobject
.
necessary for print method.
Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en
The required input format is the output format "prabclus"
of
alleleconvert
. Alleles are coded by a single character,
so diploid loci need to be pairs of characters without space between
the two alleles (e.g., "AC"). The input needs to be an
individuals*loci matrix or data frame (or a file that produces such
a data frame by read.table(file,stringsAsFactors=FALSE)
)
alleleconvert
, alleledist
,
prabinit
.
# Only 50 observations are used in order to have a fast example.
data(tetragonula)
tnb <-
coord2dist(coordmatrix=tetragonula.coord[1:50,],cut=50,file.format="decimal2",neighbors=TRUE)
ta <- alleleconvert(strmatrix=tetragonula[1:50,])
tai <- alleleinit(allelematrix=ta,neighborhood=tnb$nblist)
print(tai)
Run the code above in your browser using DataLab