RecodeHaplos: Recode SNP genotype data into possible haplotypes
Description
This function takes as an argument the original data frame with
non-SNP and SNP data and converts the genotype data at single SNPs
(the single-locus genotypes) into haplotype data.
The rows of the original data frame should correspond to
subjects and each SNP should have two columns, one for each
allele of the single-locus genotype. The SNP data should comprise the
last 2*numSNPs columns. If the haplotypes for a subject cannot be
inferred from his or her genotype data, "pseudo-individuals"
representing all possible haplotype combinations consistent with
the single-locus genotypes are considered.
Missing single-locus genotypes, up to a maximum of maxMissingGenos (see
below), are allowed, but subjects with missing data in more than
maxMissingGenos, or with missing non-SNP data, are removed.Usage
RecodeHaplos(dat, numSNPs, maxMissingGenos = 1)
Arguments
dat
the non-SNP and SNP data as a data frame
numSNPs
the number of SNPs in a haplotype
maxMissingGenos
maximum number of single-locus genotypes with missing data to allow for each subject. (Subjects with more missing data, or with missing non-SNP data are removed.) The default is 1.
Value
- nonHaploDMnon-genetic portion of an AUGMENTED data frame which includes
any possible pseudo-individuals
- haploDMa data frame with $2^{numSNPs}$ columns scoring number of copies of each haplotype for each pseudo-individual
- haploMatmatrix with 2 columns giving the haplotypes as a string of
zeros and ones for each pseudo-individual
- wtvector of crude weights for each pseudo-individual to
be updated by CheckHaplos
- IDindex for each individual in the original data frame. Note that
all pseudo-individuals for a subject have the same ID value
synopsis
RecodeHaplos(dat, numSNPs, maxMissingGenos = 1, logriskmodel="additive")Examples
Run this code# To convert SNP data from a simulated diabetes example into two-locus haplotypes:
data(hypoDat)
example.haplos<-RecodeHaplos(hypoDat, 2)
Run the code above in your browser using DataLab