Build a geneSetList or geneSetFile for use in gene set analyses (geneSetAssoc or assocTest-aggregateFile) Currently these can be build directly from GMT-files, data.frames and lists.

buildGeneSet(
  data = NULL,
  gmtpath = NULL,
  output = NULL,
  sep = "\t",
  verbose = TRUE
)

Arguments

data

Can be 1) data.frame where the first column includes the names of geneSets, the second column contains the genes included in the geneSet (comma-delimited). The third and fourth column are optional: the third column contains weights (comma-delimited), and the fourth column contains metadata. or 2) a list, where the names of the list represent the geneSet names and each element in the list contains a vector with the genes included in the respective geneset.

gmtpath

Path to a gmt-file

output

Optional output file path (output will be gz compressed text). Defaults to NULL, in which case a geneSetList is returned.

sep

Separator used in input file.

verbose

Should the function be verbose? (TRUE/FALSE), defaults to TRUE.

Examples


# build a genesetlist from a list (see ?geneSetList)
genesetlist <- buildGeneSet(
  list("geneset1" = c("SOD1", "NEK1"),
       "geneset2" = c("ABCA4", "SOD1", "NEK1"),
       "geneset3" = c("FUS", "NEK1")
       ))

# specify the output parameter to write to disk in the geneSetFile format (see ?geneSetFile)
file <- tempfile()
buildGeneSet(
  list("geneset1" = c("SOD1", "NEK1"),
       "geneset2" = c("ABCA4", "SOD1", "NEK1"),
       "geneset3" = c("FUS", "NEK1")
  ),
  output = file
  )
#> Generated geneSetFile: /var/folders/cl/wvc0rvjx4vd5rzt2_fhpmfth0000gp/T//RtmpRC6myU/file1825c85c03a3
#> geneSetFile
#> Path: /var/folders/cl/wvc0rvjx4vd5rzt2_fhpmfth0000gp/T//RtmpRC6myU/file1825c85c03a3
#> Sets: 3
genesetfile <- geneSetFile(file)

# the `gmtpath` parameter can be used to build a geneset from a mSigDb GMT-file
# see the tutorials on the RVAT website for examples