Learn R Programming

SNPknock (version 0.8.2)

loadHMM: Load HMM parameters fitted by fastPHASE

Description

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.

Usage

loadHMM(r_file, alpha_file, theta_file, char_file, compact = TRUE,
  phased = FALSE)

Arguments

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

Value

A structure containing the parameters from the Li and Stephens HMM for phased haplotypes.

Details

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.

References

scheet2006SNPknock

See Also

Other fastPHASE: runFastPhase, writeXtoInp

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab