aggdb.RdThe aggregate method saves genotype aggregates compressed in an aggdb file.
The aggdb class manages connecting/interacting with these files and retrieving
units of interest.
aggregate(x, ...): Returns an aggregate of genotypes for each individual.
See aggregate() for details.
aggdb(path): Connect to an aggdb object.
In the following code snippets, x is an aggdb object.
getUnit(x, unit): Retrieve aggregates for specified unit(s).
Use listUnits(x) to list the units includes in the aggdb
Output will be a matrix.
listUnits(x): Return a vector of all units included in the aggdb
listSamples(x): Return a vector of all sample IDs included in the aggdb
listParams(x): Return a list of parameters used to generate the aggdb.
metadata(x), getGdbId(x), getRvatVersion(x): various methods to retrieve metadata from the aggdb.
An aggdb can be directly supplied to the assocTest() method.
Aggdbs can be merged using the mergeAggDbs method.
library(rvatData)
gdb <- create_example_gdb()
# 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)
# list units and samples in aggdb
head(listUnits(aggdb))
#> [1] "ABCA4" "NEK1" "SOD1"
head(listSamples(aggdb))
#> [1] "ALS1" "ALS2" "ALS3" "ALS4" "ALS5" "ALS6"
# retrieve aggregates
aggregates <- getUnit(aggdb, unit = "SOD1")
# see ?`assocTest-aggdb` for details on running association tests on an aggdb