polysat (version 1.7-4)

genIndex: Find All Unique Genotypes for a Locus

Description

This function will return all unique genotypes for a given locus (ignoring allele order, but taking copy number into account) and return those genotypes as well as an index indicating which genotype(s) each individual has. This is a generic function with methods for "'>genambig" objects and for arrays. The array method is primarily intended for internal use with meandistance.matrix2, processing the output of genotypeProbs.

Usage

genIndex(object, locus)

Arguments

object

Typically, a "genambig" object. A two-dimentional list (array) can also be used here, where samples are in the first dimension and loci in the second dimension and each element of the list is output from genotypeProbs.

locus

A character string or integer indicating which locus to process.

Value

A list with two elements:

uniquegen

A list, where each element in the list is a vector indicating a unique genotype that was found.

genindex

For "genambig" objects, an integer vector, with one value per sample. This is the index of that sample's genotype in uniquegen. For arrays, a list with one element per sample. Each element is a vector of indices of that sample's possible genotypes in uniquegen, in the same order as in the genotypeProbs output.

See Also

meandistance.matrix uses the "genambig" method internally.

.unal1loc, assignClones

Examples

Run this code
# NOT RUN {
data(simgen)
genIndex(simgen, 1)
# }

Run the code above in your browser using DataCamp Workspace