loadHMM: Load HMM parameters fitted by fastPHASE

Description Usage Arguments Details Value References See Also Examples

View source: R/fastphase.R

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

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

Details

This function by default returns a structure with three fields:

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.

Value

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

References

\insertRef

scheet2006SNPknock

See Also

Other fastPHASE: runFastPhase, writeXtoInp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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)

SNPknock documentation built on May 18, 2019, 1:03 a.m.