Last updated: 2023-12-13

Checks: 7 0

Knit directory: muse/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200712) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 5b0e194. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/
    Ignored:    r_packages_4.3.2/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/msigdb.Rmd) and HTML (docs/msigdb.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 5b0e194 Dave Tang 2023-12-13 Downloading molecular signatures in R

Following the vignette.

The molecular signatures database (MSigDB) is one of the largest collections of molecular signatures or gene expression signatures. A variety of gene expression signatures are hosted on this database including experimentally derived signatures and signatures representing pathways and ontologies from other curated databases. This rich collection of gene expression signatures (>25,000) can facilitate a wide variety of signature-based analyses, the most popular being gene set enrichment analyses. These signatures can be used to perform enrichment analysis in a DE experiment using tools such as {GSEA}, {fry} (from {limma}) and {camera} (from {limma}). Alternatively, they can be used to perform single-sample gene-set analysis of individual transcriptomic profiles using approaches such as {singscore}, {ssGSEA} and {GSVA}.

This package provides the gene sets in the MSigDB in the form of GeneSet objects. This data structure is specifically designed to store information about gene sets, including their member genes and metadata. Other packages, such as {msigdbr} and {EGSEAdata} provide these gene sets too, however, they do so by storing them as lists or tibbles. These structures are not specific to gene sets therefore do not allow storage of important metadata associated with each gene set, for example, their short and long descriptions. Additionally, the lack of structure allows creation of invalid gene sets. Accessory functions implemented in the {GSEABase} package provide a neat interface to interact with GeneSet objects.

Package

Install GSVA. (Dependencies are listed in the Imports section in the DESCRIPTION file.)

if (!require("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

if (!require("msigdb", quietly = TRUE))
  BiocManager::install("msigdb")

Load package.

library(msigdb)
packageVersion("msigdb")
[1] '1.10.0'

Downloading the MSigDB database

In order to download the MSigDB database, we need to load {ExperimentHub} and {GSEABase}.

library(ExperimentHub)
library(GSEABase)

Query an ExperimentHub object.

eh <- ExperimentHub(ask = FALSE)
AnnotationHub::query(x = eh, pattern = 'msigdb')
ExperimentHub with 49 records
# snapshotDate(): 2023-10-24
# $dataprovider: Broad Institute, Emory University, EBI
# $species: Homo sapiens, Mus musculus
# $rdataclass: GSEABase::GeneSetCollection, list, data.frame
# additional mcols(): taxonomyid, genome, description,
#   coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
#   rdatapath, sourceurl, sourcetype 
# retrieve records with, e.g., 'object[["EH5421"]]' 

           title                   
  EH5421 | msigdb.v7.2.hs.SYM      
  EH5422 | msigdb.v7.2.hs.EZID     
  EH5423 | msigdb.v7.2.mm.SYM      
  EH5424 | msigdb.v7.2.mm.EZID     
  EH6727 | MSigDB C8 MANNO MIDBRAIN
  ...      ...                     
  EH8296 | msigdb.v7.5.1.hs.SYM    
  EH8297 | msigdb.v7.5.1.mm.EZID   
  EH8298 | msigdb.v7.5.1.mm.idf    
  EH8299 | msigdb.v7.5.1.mm.SYM    
  EH8300 | imex_hsmm_0722          

Specify a more specific pattern to look for only human collections.

AnnotationHub::query(x = eh, pattern = 'msigdb.*hs.SYM')
ExperimentHub with 7 records
# snapshotDate(): 2023-10-24
# $dataprovider: Broad Institute
# $species: Homo sapiens
# $rdataclass: GSEABase::GeneSetCollection
# additional mcols(): taxonomyid, genome, description,
#   coordinate_1_based, maintainer, rdatadateadded, preparerclass, tags,
#   rdatapath, sourceurl, sourcetype 
# retrieve records with, e.g., 'object[["EH5421"]]' 

           title                
  EH5421 | msigdb.v7.2.hs.SYM   
  EH6772 | msigdb.v7.3.hs.SYM   
  EH6778 | msigdb.v7.4.hs.SYM   
  EH7359 | msigdb.v7.5.hs.SYM   
  EH8284 | msigdb.v2022.1.hs.SYM
  EH8290 | msigdb.v2023.1.hs.SYM
  EH8296 | msigdb.v7.5.1.hs.SYM 

The experiment hubs seem to be ordered from earliest to latest.

AnnotationHub::query(x = eh, pattern = 'msigdb.*hs.SYM') |>
  tail(1) -> msigdb_hs_latest

names(msigdb_hs_latest)
[1] "EH8296"
msigdb_hs_latest
ExperimentHub with 1 record
# snapshotDate(): 2023-10-24
# names(): EH8296
# package(): msigdb
# $dataprovider: Broad Institute
# $species: Homo sapiens
# $rdataclass: GSEABase::GeneSetCollection
# $rdatadateadded: 2023-07-03
# $title: msigdb.v7.5.1.hs.SYM
# $description: Gene expression signatures (Homo sapiens) from the Molecular...
# $taxonomyid: 9606
# $genome: NA
# $sourcetype: XML
# $sourceurl: https://data.broadinstitute.org/gsea-msigdb/msigdb/release/7.5...
# $sourcesize: NA
# $tags: c("Homo_sapiens_Data", "Mus_musculus_Data") 
# retrieve record with 'object[["EH8296"]]' 

Data can be downloaded using the unique ID.

eh[[names(msigdb_hs_latest)]]
GeneSetCollection
  names: chr1p11, chr1p12, ..., GOMF_STARCH_BINDING (45226 total)
  unique identifiers: RPL22P6, NBPF8, ..., POM121L15P (41072 total)
  types in collection:
    geneIdType: SymbolIdentifier (1 total)
    collectionType: BroadCollection (1 total)

Data can also be downloaded using msigdb::getMsigdb().

msigdb_ver <- sub(pattern = "msigdb.v(.*).hs.SYM", replacement = "\\1", msigdb_hs_latest$title)

msigdb.hs <- msigdb::getMsigdb(org = "hs", id = "SYM", version = msigdb_ver)
see ?msigdb and browseVignettes('msigdb') for documentation
loading from cache
msigdb.hs
GeneSetCollection
  names: chr1p11, chr1p12, ..., GOMF_STARCH_BINDING (45226 total)
  unique identifiers: RPL22P6, NBPF8, ..., POM121L15P (41072 total)
  types in collection:
    geneIdType: SymbolIdentifier (1 total)
    collectionType: BroadCollection (1 total)

Accessing the GeneSet and GeneSetCollection objects

A GeneSetCollection object is effectively a list and therefore all list processing functions work.

length(msigdb.hs)
[1] 45226

Each signature is stored in a GeneSet object and can be processed using functions from the {GSEABase} package.

gs <- msigdb.hs[[1000]]
geneIds(gs)
 [1] "HOXC13"      "MYC"         "BTG3"        "PIK3CG"      "MXI1"       
 [6] "NCSTN"       "HOXA11"      "GADD45B"     "RFNG"        "FZD6"       
[11] "CCND2"       "PRKCD"       "SOCS2"       "TNFSF13B"    "FANCA"      
[16] "FOSB"        "VSX2"        "MBD1"        "PSEN2"       "HES3"       
[21] "PRDM1"       "POU2AF1"     "XBP1"        "STAT5A"      "AKT1"       
[26] "COMMD3-BMI1" "DTX2"        "MIB1"        "IRF4"        "TRAF3"      
[31] "IRF6"       

Details of a gene set.

details(gs)
setName: SHIN_B_CELL_LYMPHOMA_CLUSTER_2 
geneIds: HOXC13, MYC, ..., IRF6 (total: 31)
geneIdType: Symbol
collectionType: Broad
  bcCategory: c2 (Curated)
  bcSubCategory: CGP
setIdentifier: LVY1HGGWMJ7:35020:Fri May 26 12:20:46 2023:93736
description: Cluster 2 of genes distinguishing among different B lymphocyte neoplasms.
  (longDescription available)
organism: Mus musculus
pubMedIds: 19010892
urls: https://data.broadinstitute.org/gsea-msigdb/msigdb/release/7.5.1/msigdb_v7.5.1.xml
contributor: Jessica Robertson
setVersion: 7.5.1
creationDate: 

Human collection types:

  • H - hallmark gene sets are coherently expressed signatures derived by aggregating many MSigDB gene sets to represent well-defined biological states or processes.
  • C1 - positional gene sets corresponding to human chromosome cytogenetic bands.
  • C2 - curated gene sets from online pathway databases, publications in PubMed, and knowledge of domain experts.
  • C3 - regulatory target gene sets based on gene target predictions for microRNA seed sequences and predicted transcription factor binding sites.
  • C4 - computational gene sets defined by mining large collections of cancer-oriented expression data.
  • C5 - ontology gene sets consist of genes annotated by the same ontology term.
  • C6 - oncogenic signature gene sets defined directly from microarray gene expression data from cancer gene perturbations.
  • C7 - immunologic signature gene sets represent cell states and perturbations within the immune system.
  • C8 - cell type signature gene sets curated from cluster markers identified in single-cell sequencing studies of human tissue.
table(sapply(lapply(msigdb.hs, collectionType), bcCategory))

   c1    c2    c3    c4    c5    c6    c7    c8     h 
  299  6180  3726   858 28005   189  5219   700    50 

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] GSEABase_1.64.0      graph_1.80.0         annotate_1.80.0     
 [4] XML_3.99-0.16        AnnotationDbi_1.64.1 IRanges_2.36.0      
 [7] S4Vectors_0.40.2     Biobase_2.62.0       ExperimentHub_2.10.0
[10] AnnotationHub_3.10.0 BiocFileCache_2.10.1 dbplyr_2.4.0        
[13] BiocGenerics_0.48.1  msigdb_1.10.0        BiocManager_1.30.22 
[16] workflowr_1.7.1     

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0              dplyr_1.1.4                  
 [3] blob_1.2.4                    filelock_1.0.3               
 [5] Biostrings_2.70.1             bitops_1.0-7                 
 [7] fastmap_1.1.1                 RCurl_1.98-1.13              
 [9] promises_1.2.1                digest_0.6.33                
[11] mime_0.12                     lifecycle_1.0.4              
[13] ellipsis_0.3.2                processx_3.8.3               
[15] KEGGREST_1.42.0               interactiveDisplayBase_1.40.0
[17] RSQLite_2.3.4                 magrittr_2.0.3               
[19] compiler_4.3.2                rlang_1.1.2                  
[21] sass_0.4.8                    tools_4.3.2                  
[23] utf8_1.2.4                    yaml_2.3.8                   
[25] knitr_1.45                    bit_4.0.5                    
[27] curl_5.2.0                    withr_2.5.2                  
[29] purrr_1.0.2                   fansi_1.0.6                  
[31] git2r_0.33.0                  xtable_1.8-4                 
[33] cli_3.6.2                     rmarkdown_2.25               
[35] crayon_1.5.2                  generics_0.1.3               
[37] rstudioapi_0.15.0             httr_1.4.7                   
[39] DBI_1.1.3                     cachem_1.0.8                 
[41] stringr_1.5.1                 zlibbioc_1.48.0              
[43] XVector_0.42.0                vctrs_0.6.5                  
[45] jsonlite_1.8.8                callr_3.7.3                  
[47] bit64_4.0.5                   jquerylib_0.1.4              
[49] glue_1.6.2                    ps_1.7.5                     
[51] stringi_1.8.3                 BiocVersion_3.18.1           
[53] later_1.3.2                   GenomeInfoDb_1.38.1          
[55] tibble_3.2.1                  pillar_1.9.0                 
[57] rappdirs_0.3.3                htmltools_0.5.7              
[59] GenomeInfoDbData_1.2.11       R6_2.5.1                     
[61] rprojroot_2.0.4               evaluate_0.23                
[63] shiny_1.8.0                   png_0.1-8                    
[65] memoise_2.0.1                 httpuv_1.6.13                
[67] bslib_0.6.1                   Rcpp_1.0.11                  
[69] whisker_0.4.1                 xfun_0.41                    
[71] fs_1.6.3                      getPass_0.2-4                
[73] pkgconfig_2.0.3