Instead of using OpenMx's default model processing sequence (i.e.,
omxDefaultComputePlan), it is more efficient and
convienient to assemble a compute plan tailored for a genome-wide
association study. This function returns a compute plan that loads
SNP data into model modelName
, fits the model, outputs the
results to out
, and repeats this procedure for all SNPs.
prepareComputePlan(model, snpData, out = "out.log", ..., SNP = NULL,
startFrom = 1L)
an instance of MxModel
the name of the file where the SNP data is stored
the filename where the results of fitted models shall be written
Not used. Forces remaining arguments to be specified by name.
a vector of SNP indices to include in the analysis; NULL is interpreted as all available SNPs
the index to start from when SNP=NULL
The given model with an appropriate compute plan.
You can request a specific list of SNPs using the SNP
argument. The numbers provided in SNP
refer to offsets in
the snpData
file. For example, SNP=c(100,200)
will
process the 100th and 200th SNP. The first SNP in the
snpData
file is at offset 1. When SNP
is omitted then
all available SNPs are processed.
The suffix of snpData
filename is interpreted to signal the
format of how the SNP data is stored on disk. Suffixes
‘pgen’, ‘bed’, and ‘bgen’ are supported.
Per-SNP descriptions are found in different places depending on the
suffix. For ‘bgen’, both the SNP data and description are
built into the same file. In the case of ‘pgen’, an
associated file with suffix ‘pvar’ is expected to exist (see
the
spec
for details). In the case of ‘bed’, an associated
‘bim’ file is expected to exist (see the
spec for
details). The chromosome, base-pair coordinate, and variant ID are
added to each line of out
.
A compute plan does not do anything by itself. You'll need to combine the compute plan with a model (such as returned by buildOneFac) to perform a GWAS.
# NOT RUN {
m1 <- mxModel("test", mxFitFunctionWLS())
dir <- system.file("extdata", package = "gwsem")
m1 <- prepareComputePlan(m1, file.path(dir,"example.pgen"))
m1$compute
# }
Run the code above in your browser using DataLab