S3 class for tmod gene set collections
tmodGS-class.Rd
S3 class for tmod gene set collections
Usage
makeTmodGS(gs2gene, gs = NULL, weights = NULL, info = NULL)
makeTmod(modules, modules2genes, genes2modules = NULL, genes = NULL)
as_tmodGS(x, check_sanity = FALSE)
# S3 method for tmodGS
print(x, ...)
# S3 method for tmodGS
length(x)
# S3 method for tmodGS
[(x, i)
# S3 method for tmod
[(x, i)
Arguments
- gs2gene, modules2genes
A list with module IDs as names. Each member of the list is a character vector with IDs of genes contained in that module
- gs, modules
[Optional] A data frame with at least columns ID and Title
- weights
[Optional] a named numeric vector of weights for each gene set
- info
[Optional] a list containing meta-information about the gene set collection
- genes2modules, genes
Ignored
- x
a tmodGS or tmod object
- check_sanity
whether the tmodGS object should be tested for correctness
- ...
further arguments passed to `print()`
- i
indices specifying elements to extract or replace
Details
An object of class tmod contains the gene set annotations (`tmod$gs`), a character vector of gene identifiers (`tmod$gv`) and a mapping between gene sets and gene identifiers (`tmod$gs2gv`). Optionally, a vector of numeric weights of the same length as `gs2gv` may be provided (`tmod$weights`).
Furthermore, it may contain additional information about the gene set (`tmod$info`).
`tmod$gs` is a data frame which must contain the column "ID". Additional optional columns `Title` and `Description` are recognized by some functions. Any further columns may contain additional information on the gene sets. The number of rows of that data frame is equal to the number of gene sets in a gene set collection.
Each element of the tmod$g2m list corresponds to the respective row of the `tmod$gs` data frame. Each element is an integer vector containing the positions of the gene identifiers in the `tmod$gv` character vector.
Objects of class tmodGS should be constructed by calling the function makeTmodGS(). This function check the validity and consistency of the provided objects.
The makeTmod function remains for compatibility with previous versions of the package. It produces the objects of the new class tmodGS, however.
See the package vignette for more on constructing custom module sets.
Examples
# A minimal example
gs <- data.frame(ID=letters[1:3], Title=LETTERS[1:3])
gs2gv <- list(a=c("g1", "g2"), b=c("g3", "g4"), c=c("g1", "g2", "g4"))
mymset <- makeTmodGS(gs2gene=gs2gv, gs=gs)
str(mymset)
#> Classes 'list', 'tmodGS' hidden list of 5
#> $ gs : tibble [3 × 2] (S3: tbl_df/tbl/data.frame)
#> ..$ ID : chr [1:3] "a" "b" "c"
#> ..$ Title: chr [1:3] "A" "B" "C"
#> $ gs2gv :List of 3
#> ..$ : int [1:2] 1 2
#> ..$ : int [1:2] 3 4
#> ..$ : int [1:3] 1 2 4
#> $ gv : chr [1:4] "g1" "g2" "g3" "g4"
#> $ info : NULL
#> $ weights: NULL