Learn R Programming

prabclus (version 2.2-2)

alleleinit: 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 "prabclus" format, see details. Either file or allelematrix needs to be specified.
allelematrix
matrix in "prabclus"-format as generated by alleleconvert, see details. Either file or allelematrix needs to be specofied.
rows.are.individuals
logical. If TRUE, rows are interpreted as individuals and columns are interpreted as loci.
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 numeric(0). If neighborhoo
distance
"alleledist" or "none". The distance measure between individuals to compute by alleleinit.
namode
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"
nachar
character denoting missing values.
distcount
logical. If TRUE, during distance computation individuals are counted on the screen.
x
object of class alleleobject.
...
necessary for print method.

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
  • distmatdistance matrix between individuals.
  • amatrixdata 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.
  • charmatrixmatrix 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.
  • nbneighborhood list, see above.
  • ext.nblista neighborhood list in which for every row in charmatrix the second row number corresponding to the neighboring individuals is listed.
  • n.variablesnumber of loci.
  • n.individualsnumber of individuals.
  • n.levelsmaximum number of different alleles in a locus.
  • n.speciesidentical to n.individuals used for compatibility with prabclust.
  • alevelscharacter vector with all used allele codes not including missing values.
  • leveldistmatrix in which rows are loci, columns are alleles and entries are frequencies of alleles per locus.
  • prabuseless matrix of number of factor levels corresponding to amatrix added for compatibility with objects of class prab.
  • regperspecvector of row-wise sums of prab added for compatibility with objects of class prab.
  • specperregvector of column-wise sums of prab added for compatibility with objects of class prab.
  • distancestring denoting the chosen distance measure, see above.
  • namodesee above.
  • naprobprobability of missing values, numeric or vector, see documentation of argument namode.
  • nasumnumber of missing entries (individual/loci) in amatrix
  • .
  • nacharsee above.
  • spatiallogical. TRUE if a neighborhood was submitted.

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))

See Also

alleleconvert, alleledist, prabinit.

Examples

Run this code
# 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