assocTest-aggregateFile.Rd
Run assocTest
on a aggregateFile
object.
See the main assocTest
page for details.
# S4 method for aggregateFile
assocTest(
object,
pheno,
test,
geneSet,
gdb,
cohort = "SM",
name = "none",
continuous = FALSE,
covar = NULL,
substractCovar = NULL,
dropUnits = NULL,
maxitFirth = 1000,
keep = NULL,
output = NULL,
verbose = TRUE,
strict = TRUE
)
a aggregateFile
object (generated using the aggregate
method).
field to test as response variable, the response variable
can either be binary (0/1) or continuous. If the response variable is continuous set
continuous
to TRUE
.
Vector of statistical tests to run, options include firth,glm,lm, and nbinom.
a geneSetList
or geneSetFile
object
a gdb
object, this will be used to load the cohort data.
Cohort name (present in the gdb)
Optional name of the analysis.
Is the response variable continuous? (TRUE/FALSE). Defaults to FALSE
.
Character vector of covariates, or list with multiple sets of covariates.
Covariate from which aggregate should be substracted. Useful when adjusting for total variant counts, by specifying the total variant count variable here, the aggregate score of the gene set tested will be substracted from the total count variable.
Optional, vector of units to exclude.
Maximum number of iterations to use for estimating firth confidence intervals.
vector of sample IDs to keep, defaults to NULL
, in which case all samples are kept.
Defaults to FALSE
.
Output file path for results.
Defaults to NULL
, in which case results are not written but returned as a data.frame()
.
Should the function be verbose? (TRUE/FALSE), defaults to TRUE
.
Should strict checks be performed? Defaults to TRUE
. Strict tests currently includes
checking whether supplied aggregateFile was generated from the same gdb as specified in gdb
.
library(rvatData)
gdb <- gdb(rvat_example("rvatData.gdb"))
# assocTest-aggregateFile allows for running association tests on pre-constructed aggregates.
# below we first generate the aggregates based on a varSetFile
varsetfile <- varSetFile(rvat_example("rvatData_varsetfile.txt.gz"))
varset <- getVarSet(varsetfile, unit = c("NEK1", "SOD1", "ABCA4"), varSetName = "High")
aggfile <- tempfile()
aggregate(x = gdb,
varSet = varset,
maxMAF = 0.001,
output = aggfile,
verbose = FALSE)
# connect to aggregateFile, see ?aggregateFile for more details
aggregatefile <- aggregateFile(aggfile)
# build an example genesetlist, see ?buildGeneSet for details
genesetlist <- buildGeneSet(
list("geneset1" = c("SOD1", "NEK1"),
"geneset2" = c("ABCA4", "SOD1", "NEK1")))
# perform association tests using assocTest
# note that this is very similar to running association tests on a genoMatrix (?`assocTest-genoMatrix`)
# or on a gdb (?`assocTest-gdb`). The main difference being that pre-constructed aggregates are used from
# the aggregateFile, and requires a genesetFile/geneSetList (?geneSetFile) to be provided to the `geneSet` argument.
aggAssoc <- assocTest(
aggregatefile,
gdb = gdb,
test = c("glm", "firth"),
cohort = "pheno",
pheno = "pheno",
geneSet = genesetlist,
covar = paste0("PC", 1:4),
verbose = FALSE
)