assocTest-aggdb.Rd# S4 method for class 'aggdb'
assocTest(
object,
pheno,
test,
geneSet,
gdb,
cohort = "SM",
name = "none",
continuous = FALSE,
covar = NULL,
subtractCovar = NULL,
dropUnits = NULL,
maxitFirth = 1000L,
keep = NULL,
output = NULL,
verbose = TRUE,
strict = TRUE
)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 (uploaded to 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 subtracted. 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 subtracted 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.
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 aggdb was generated from the same gdb as specified in gdb.
library(rvatData)
gdb <- create_example_gdb()
# assocTest-aggdb 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 aggdb, see ?aggdb for more details
aggdb <- aggdb(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 aggdb, and requires a genesetFile/geneSetList (?geneSetFile) to be provided to the `geneSet` argument.
aggAssoc <- assocTest(
aggdb,
gdb = gdb,
test = c("glm", "firth"),
cohort = "pheno",
pheno = "pheno",
geneSet = genesetlist,
covar = paste0("PC", 1:4),
verbose = FALSE
)