An S4 class to manage interactions with varSetFiles. varSets can be generated from annotations using the buildVarSet() method. Specific units and/or annotations can be loaded using the getVarSet method. A varSetFile can be used as input in assocTest() to perform burden/single variant association tests on the varSets included in the varSetFile.

Build a varSetFile

  • buildVarSet(x, ...): Generate a varSetList or varSetFile() that stores weighted variant sets for use in association testing. This can be based on 1) annotations uploaded to the gdb or 2) a data.frame including annotations. See buildVarSet() for details.

Connect to a varSetFile

  • varSetFile(path, memlimit = 5000): Connect to a varSetFile object.

Getters

In the following code snippets, x is a varSetFile object.

  • getVarSet(x, unit, varSetName): Retrieve varSets for specified units and/or varSetNames. Output will be of class varSetList.

  • listUnits(x): Return a vector of all units included in the varSetFile

  • listVarSets(x): Return a vector of all varSetNames included in the varSetFile

Association testing

A varSetFile can be directly supplied to the assocTest() gdb method, using the varSet parameter. Association tests will then be performed for each varSet included in the varSetFile.

Examples

library(rvatData)

# Build a varSetFile including variants with a moderate predicted impact
gdb <- create_example_gdb()
varsetfile_moderate <- tempfile()
buildVarSet(object = gdb, 
            output = varsetfile_moderate,
            varSetName = "Moderate", 
            unitTable = "varInfo", 
            unitName = "gene_name",
            where = "ModerateImpact = 1")
#> Generated varSetFile: /var/folders/cl/wvc0rvjx4vd5rzt2_fhpmfth0000gp/T//RtmpRC6myU/file1825cdb4b7f7
#> varSetFile object
#> Path:/var/folders/cl/wvc0rvjx4vd5rzt2_fhpmfth0000gp/T//RtmpRC6myU/file1825cdb4b7f7
#> Units:12

# connect to the varSetFile
varsetfile <- varSetFile(varsetfile_moderate)

# list included units and varSets 
units <- listUnits(varsetfile)
head(units)
#> [1] "ABCA4"   "CYP19A1" "FUS"     "IL3RA"   "NEK1"    "OPTN"   
varsets <- listVarSets(varsetfile)
head(varsets)
#> [1] "Moderate" "Moderate" "Moderate" "Moderate" "Moderate" "Moderate"

# basic operations
length(varsetfile)
#> [1] 12

# metadata
metadata(varsetfile)
#> $rvatVersion
#> [1] "0.3.2"
#> 
#> $gdbId
#> [1] "vmo8w57mh9lhjhijqf5ja9fu0suj"
#> 
#> $genomeBuild
#> [1] "GRCh38"
#> 
#> $creationDate
#> [1] "2025-02-12 12:29:26"
#> 
getRvatVersion(varsetfile)
#> [1] "0.3.2"
getGdbId(varsetfile)
#> [1] "vmo8w57mh9lhjhijqf5ja9fu0suj"

# retrieve varSets 
varsets <- getVarSet(varsetfile, unit = c("SOD1", "FUS"))
# this returns a varSetList, which is an in-memory representation of varSets
# most of the methods that work on a varSetFile also work on a varSetList (see ?varSetLit for details)
getVarSet(varsets, unit = "SOD1")
#> varSetList
#> Contains 1 records
#> [[1]]
#> unit=SOD1
#> varSetName=Moderate
#> VAR_id=1268,1270,1271,1273,1275,1276,1277,1278,1279,1281,1282,1283,1284,1285,1287,1288,1289,1290,1291,1292,1293,1294,1296,1297,1298,1299,1300,1304,1305,1306,1307,1308,1309,1312,1313,1314,1315,1316
#> w=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
#> 

# see e.g., ?assocTest and ?aggregate for downstream methods that can loop through varsetfiles and varsetlists.