loadHMM.Rd
This function loads the parameter estimates obtained by fastPHASE (see runFastPhase) and assembles the Li and Stephens HMM, in the format required by the knockoff generation functions knockoffHaplotypes and knockoffGenotypes.
loadHMM(r_file, alpha_file, theta_file, char_file, compact = TRUE, phased = FALSE)
r_file | a string with the path of the "_rhat.txt" file produced by fastPHASE. |
---|---|
alpha_file | a string with the path of the "_alphahat.txt" file produced by fastPHASE. |
theta_file | a string with the path of the "_thetahat.txt" file produced by fastPHASE. |
char_file | a string with the path of the "_origchars" file produced by fastPHASE. |
compact | whether to assemble the explicit transition and emission matrices for the HMM (default: FALSE). |
phased | whether to assemble a model for phased haplotypes, if compact==FALSE (default: FALSE). |
A structure containing the parameters from the Li and Stephens HMM for phased haplotypes.
This function by default returns a structure with three fields:
"r": a numerical array of length p.
"alpha": a numerical array of size (p,K).
"theta": a numerical array of size (p,K).
If the parameter compact is FALSE, this function assembles the HMM model for the genotype data (either unphased or phased), in the format required by the knockoff generation function knockoffHMM.
Scheet P, Stephens M (2006). “A fast and flexible statistical model for large-scale population genotype data: applications to inferring missing genotypes and haplotypic phase.” Am. J. Hum. Genet., 78, 629--644. doi: 10.1086/502802 .
Other fastPHASE: runFastPhase
,
writeXtoInp
# Specify the location of the fastPHASE output files containing the parameter estimates. # Example files can be found in the package installation directory. r_file = system.file("extdata", "genotypes_rhat.txt", package = "SNPknock") alpha_file = system.file("extdata", "genotypes_alphahat.txt", package = "SNPknock") theta_file = system.file("extdata", "genotypes_thetahat.txt", package = "SNPknock") char_file = system.file("extdata", "genotypes_origchars", package = "SNPknock") # Read the parameter files and load the HMM hmm = loadHMM(r_file, alpha_file, theta_file, char_file) # Read the parameter files and load the HMM hmm.large = loadHMM(r_file, alpha_file, theta_file, char_file, compact=FALSE)