alleleinit {prabclus} | R Documentation |
Diploid loci matrix initialization
Description
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.
Usage
alleleinit(file = NULL, allelematrix=NULL,
rows.are.individuals = TRUE,
neighborhood = "none", distance = "alleledist", namode="variables",
nachar="-", distcount=FALSE)
## S3 method for class 'alleleobject'
print(x, ...)
Arguments
file |
string. File name. File must be in |
allelematrix |
matrix in |
rows.are.individuals |
logical. If |
neighborhood |
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 |
distance |
|
namode |
one of |
nachar |
character denoting missing values. |
distcount |
logical. If |
x |
object of class |
... |
necessary for print method. |
Details
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)
)
Value
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
distmat |
distance matrix between individuals. |
amatrix |
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. |
charmatrix |
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
|
nb |
neighborhood list, see above. |
ext.nblist |
a neighborhood list in which for every row in
|
n.variables |
number of loci. |
n.individuals |
number of individuals. |
n.levels |
maximum number of different alleles in a locus. |
n.species |
identical to |
alevels |
character vector with all used allele codes not including missing values. |
leveldist |
matrix in which rows are loci, columns are alleles and entries are frequencies of alleles per locus. |
prab |
useless matrix of number of factor levels corresponding to
|
regperspec |
vector of row-wise sums of |
specperreg |
vector of column-wise sums of |
distance |
string denoting the chosen distance measure, see above. |
namode |
see above. |
naprob |
probability of missing values, numeric or vector, see
documentation of argument |
nasum |
number of missing entries (individual/loci) in
|
nachar |
see above. |
spatial |
logical. |
Author(s)
Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en
See Also
alleleconvert
, alleledist
,
prabinit
.
Examples
# 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)