Diploid loci matrix initialization

Share:

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

1
2
3
4
5
6
7
8
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 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.

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"), 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.

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.

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 NA.

nb

neighborhood list, see above.

ext.nblist

a neighborhood list in which for every row in charmatrix the second row number corresponding to the neighboring individuals is listed.

n.variables

number of loci.

n.individuals

number of individuals.

n.levels

maximum number of different alleles in a locus.

n.species

identical to n.individuals used for compatibility with prabclust.

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 amatrix added for compatibility with objects of class prab.

regperspec

vector of row-wise sums of prab added for compatibility with objects of class prab.

specperreg

vector of column-wise sums of prab added for compatibility with objects of class prab.

distance

string denoting the chosen distance measure, see above.

namode

see above.

naprob

probability of missing values, numeric or vector, see documentation of argument namode.

nasum

number of missing entries (individual/loci) in amatrix

.

nachar

see above.

spatial

logical. TRUE if a neighborhood was submitted.

Author(s)

Christian Hennig chrish@stats.ucl.ac.uk http://www.homepages.ucl.ac.uk/~ucakche

See Also

alleleconvert, alleledist, prabinit.

Examples

1
2
3
4
5
6
7
# 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.