### Install msigdbr Package Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Install the msigdbr package from CRAN. This is the first step before using the package. ```r install.packages("msigdbr") ``` -------------------------------- ### Retrieve Hallmark Gene Sets for Mouse Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Filter gene sets by specifying the 'collection' parameter. This example retrieves the Hallmark gene sets for mouse. ```R h_gene_sets <- msigdbr(species = "mouse", collection = "H") ``` -------------------------------- ### Get CGP Gene Sets for Rattus norvegicus Source: https://igordot.github.io/msigdbr/reference/msigdbr.html Use this function to retrieve CGP gene sets. Ensure the `msigdbr` package is installed. The output includes gene symbols mapped to rat orthologs. ```r gs <- msigdbr(species = "Rattus norvegicus", collection = "C2", subcollection = "CGP") head(gs) ``` -------------------------------- ### Retrieve C2 CGP Gene Sets for Mouse Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Filter gene sets by specifying both 'collection' and 'subcollection' parameters. This example retrieves the C2 (curated) CGP (chemical and genetic perturbations) gene sets for mouse. ```R cgp_gene_sets <- msigdbr(species = "mouse", collection = "C2", subcollection = "CGP") ``` -------------------------------- ### GET msigdbr_collections Source: https://igordot.github.io/msigdbr/reference/msigdbr_collections.html Retrieves a data frame of available gene set collections for a specified species. ```APIDOC ## GET msigdbr_collections ### Description List the collections available in the msigdbr package for a given species. ### Method GET ### Endpoint msigdbr_collections(db_species) ### Parameters #### Query Parameters - **db_species** (string) - Optional - Species abbreviation for the human or mouse databases ("HS" or "MM"). Defaults to "HS". ### Response #### Success Response (200) - **db_version** (string) - Database version identifier. - **gs_collection** (string) - Gene set collection code. - **gs_subcollection** (string) - Gene set subcollection code. - **gs_collection_name** (string) - Descriptive name of the collection. - **num_genesets** (integer) - Number of gene sets in the collection. ``` -------------------------------- ### Load msigdbr Package Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Load the msigdbr package into your R session. This is required before calling any of its functions. ```r library(msigdbr) ``` -------------------------------- ### Prepare gene sets for GSVA (gsvaParam) Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html This prepares the gene sets as a list of gene symbols for use with the gsvaParam function in the GSVA package. Ensure msigdbr_df is loaded. ```r msigdbr_list <- split(x = msigdbr_df$gene_symbol, f = msigdbr_df$gs_name) gsvapar <- gsvaParam(geneSets = msigdbr_list, ...) gsva(gsvapar) ``` -------------------------------- ### Prepare gene sets for fgsea Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html This prepares the gene sets as a list of gene symbols, suitable for the fgsea package. Ensure msigdbr_df is loaded. ```r msigdbr_list <- split(x = msigdbr_df$gene_symbol, f = msigdbr_df$gs_name) fgsea(pathways = msigdbr_list, ...) ``` -------------------------------- ### Prepare gene sets for clusterProfiler (Gene Symbols) Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Use this when your gene IDs are gene symbols. Ensure msigdbr_df is loaded and contains the necessary columns. ```r msigdbr_t2g <- dplyr::distinct(msigdbr_df, gs_name, gene_symbol) enricher(gene = gene_symbols_vector, TERM2GENE = msigdbr_t2g, ...) ``` -------------------------------- ### Prepare gene sets for older GSVA versions Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html For GSVA versions prior to 1.50, the gsva() function can directly accept the list of gene sets. Ensure msigdbr_df is loaded. ```r msigdbr_list <- split(x = msigdbr_df$gene_symbol, f = msigdbr_df$gs_name) gsva(gset.idx.list = msigdbr_list, ...) ``` -------------------------------- ### List supported species Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Retrieves a tibble of available species names and their common aliases. ```R msigdbr_species() ``` -------------------------------- ### Prepare gene sets for clusterProfiler (Entrez IDs) Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Use this when your gene IDs are NCBI/Entrez IDs. Ensure msigdbr_df is loaded and contains the necessary columns. ```r msigdbr_t2g <- dplyr::distinct(msigdbr_df, gs_name, ncbi_gene) enricher(gene = gene_ids_vector, TERM2GENE = msigdbr_t2g, ...) ``` -------------------------------- ### msigdbr_species() - List Species Source: https://igordot.github.io/msigdbr/reference/index.html This function lists the species supported by the msigdbr package. ```APIDOC ## msigdbr_species() ### Description Lists the species available in the msigdbr package. ### Method N/A (R function) ### Endpoint N/A ### Parameters N/A ### Request Example ```R msigdbr_species() ``` ### Response #### Success Response (200) - **character vector** - A vector of strings, where each string is the name of a supported species. ``` -------------------------------- ### Retrieve Mouse Gene Sets with msigdbr Source: https://igordot.github.io/msigdbr/reference/msigdbr.html Fetches all mouse gene sets from the MSigDB database, specifying the mouse database species and output species. Use `head()` to display the first few rows of the resulting tibble. ```r gs <- msigdbr(db_species = "MM", species = "Mus musculus") head(gs) ``` -------------------------------- ### List available species Source: https://igordot.github.io/msigdbr/reference/msigdbr_species.html Retrieves a data frame of species supported by the msigdbr package. ```R msigdbr_species() ``` ```R msigdbr_species() #> # A tibble: 20 × 2 #> species_name species_common_name #> #> 1 Anolis carolinensis Carolina anole, green anole #> 2 Bos taurus bovine, cattle, cow, dairy cow, domestic cat… #> 3 Caenorhabditis elegans NA #> 4 Canis lupus familiaris dog, dogs #> 5 Danio rerio leopard danio, zebra danio, zebra fish, zebr… #> 6 Drosophila melanogaster fruit fly #> 7 Equus caballus domestic horse, equine, horse #> 8 Felis catus cat, cats, domestic cat #> 9 Gallus gallus bantam, chicken, chickens, Gallus domesticus #> 10 Homo sapiens human #> 11 Macaca mulatta rhesus macaque, rhesus macaques, Rhesus monk… #> 12 Monodelphis domestica gray short-tailed opossum #> 13 Mus musculus house mouse, mouse #> 14 Ornithorhynchus anatinus duck-billed platypus, duckbill platypus, pla… #> 15 Pan troglodytes chimpanzee #> 16 Rattus norvegicus brown rat, Norway rat, rat, rats #> 17 Saccharomyces cerevisiae baker's yeast, brewer's yeast, S. cerevisiae #> 18 Schizosaccharomyces pombe 972h- NA #> 19 Sus scrofa pig, pigs, swine, wild boar #> 20 Xenopus tropicalis tropical clawed frog, western clawed frog ``` -------------------------------- ### Verify MSigDB Database Version Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Check the version of the MSigDB database used in the gene set data frame. ```R unique(all_gene_sets$db_version) #> [1] "2026.1.Hs" ``` -------------------------------- ### Retrieve Gene Sets from Mouse Database Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Specify the 'db_species' parameter to select the MSigDB database (e.g., 'MM' for mouse). The 'species' parameter still defines the orthologs to retrieve. ```R all_mm_gene_sets <- msigdbr(db_species = "MM", species = "Mus musculus") head(all_mm_gene_sets) ``` -------------------------------- ### msigdbr_collections() - List Collections Source: https://igordot.github.io/msigdbr/reference/index.html This function lists the available collections within the msigdbr package. ```APIDOC ## msigdbr_collections() ### Description Lists the collections available in the msigdbr package. ### Method N/A (R function) ### Endpoint N/A ### Parameters N/A ### Request Example ```R msigdbr_collections() ``` ### Response #### Success Response (200) - **character vector** - A vector of strings, where each string is the name of an available collection. ``` -------------------------------- ### List available collections Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Retrieves a table of MSigDB collections, sub-collections, and the number of gene sets per category. ```R msigdbr_collections() ``` -------------------------------- ### Retrieve Human Gene Sets with msigdbr Source: https://igordot.github.io/msigdbr/reference/msigdbr.html Fetches all human gene sets from the MSigDB database. Use `head()` to display the first few rows of the resulting tibble. ```r gs <- msigdbr() head(gs) ``` -------------------------------- ### Retrieve Gene Sets for Mus musculus Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Use the 'species' parameter to convert human genes to orthologs in model organisms like Mus musculus. Use msigdbr_species() to check available species. ```R all_gene_sets <- msigdbr(species = "Mus musculus") head(all_gene_sets) ``` -------------------------------- ### List available collections Source: https://igordot.github.io/msigdbr/reference/msigdbr_collections.html Retrieves a data frame of available gene set collections. The db_species argument defaults to 'HS' for human. ```R msigdbr_collections(db_species = "HS") ``` ```R msigdbr_collections() ``` -------------------------------- ### Retrieve All Gene Sets Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html Retrieve a data frame containing all genes and gene sets from the MSigDB. The output includes gene symbols, IDs, and detailed gene set information. ```r all_gene_sets <- msigdbr() head(all_gene_sets) ``` -------------------------------- ### Retrieve MSigDB gene sets Source: https://igordot.github.io/msigdbr/index.html Fetches the full set of MSigDB gene sets as a tidy data frame. ```R library(msigdbr) genesets <- msigdbr() ``` -------------------------------- ### List Available Species Source: https://igordot.github.io/msigdbr/reference/msigdbr_species.html This function lists all the species for which gene set enrichment data is available in the msigdbr package. ```APIDOC ## msigdbr_species() ### Description List the species available in the msigdbr package. ### Method Function Call ### Endpoint N/A (R function) ### Parameters None ### Request Example ```R msigdbr_species() ``` ### Response #### Success Response (200) A data frame containing the available species, with columns for `species_name` and `species_common_name`. #### Response Example ```json [ { "species_name": "Anolis carolinensis", "species_common_name": "Carolina anole, green anole" }, { "species_name": "Bos taurus", "species_common_name": "bovine, cattle, cow, dairy cow, domestic cat" } ] ``` ``` -------------------------------- ### Retrieve species-specific gene sets Source: https://igordot.github.io/msigdbr/index.html Filters gene sets for a specific organism, such as mouse, by specifying the species argument. ```R genesets <- msigdbr(species = "mouse") ``` -------------------------------- ### Retrieve specific gene set collections Source: https://igordot.github.io/msigdbr/index.html Filters gene sets by both species and collection, such as the Hallmark collection. ```R genesets <- msigdbr(species = "mouse", collection = "H") ``` -------------------------------- ### msigdbr() - Retrieve Gene Sets Source: https://igordot.github.io/msigdbr/reference/index.html This function retrieves the gene sets data frame from the msigdbr package. ```APIDOC ## msigdbr() ### Description Retrieves the gene sets data frame. ### Method N/A (R function) ### Endpoint N/A ### Parameters N/A ### Request Example ```R msigdbr() ``` ### Response #### Success Response (200) - **data.frame** - A data frame containing gene set information. ``` -------------------------------- ### Retrieve Gene Sets Data Frame Source: https://igordot.github.io/msigdbr/reference/msigdbr.html This function retrieves a data frame of gene sets and their member genes. It supports converting human gene identifiers to counterparts in other model organisms and includes gene symbols along with NCBI and Ensembl IDs. ```APIDOC ## msigdbr() ### Description Retrieve a data frame of gene sets and their member genes. The original human genes can be converted into their corresponding counterparts in various model organisms, including mouse, rat, pig, zebrafish, fly, and yeast. The output includes gene symbols along with NCBI and Ensembl IDs. ### Arguments - **db_species** (string) - Species abbreviation for the human or mouse databases (`"HS"` or `"MM"`). - **species** (string) - Species name for output genes, such as `"Homo sapiens"` or `"Mus musculus"`. Both scientific and common names are acceptable. Use `msigdbr_species()` to see the available options. - **collection** (string) - Collection abbreviation, such as `"H"` or `"C1"`. Use `msigdbr_collections()` to see the available options. - **subcollection** (string) - Sub-collection abbreviation, such as `"CGP"` or `"BP"`. Use `msigdbr_collections()` for the available options. - **category** (deprecated) - use the `collection` argument - **subcategory** (deprecated) - use the `subcollection` argument ### Value A tibble (a data frame with class `tibble::tbl_df`) of gene sets with one gene per row. ### Details Historically, the MSigDB resource has been tailored to the analysis of human-specific datasets, with gene sets exclusively aligned to the human genome. Starting with release 2022.1, MSigDB incorporated a database of mouse-native gene sets and was split into human and mouse divisions ("Hs" and "Mm"). Each one is provided in the approved gene symbols of its respective species. Mouse MSigDB includes gene sets curated from mouse-centric datasets and specified in native mouse gene identifiers, eliminating the need for ortholog mapping. ### References https://www.gsea-msigdb.org/gsea/msigdb/index.jsp ### Examples __```R # Get all human gene sets gs <- msigdbr() head(gs) # Get all mouse gene sets gs <- msigdbr(db_species = "MM", species = "Mus musculus") head(gs) ```__ ``` -------------------------------- ### Filter Gene Sets using dplyr Source: https://igordot.github.io/msigdbr/articles/msigdbr-intro.html The output of msigdbr() is a data frame that can be manipulated using standard methods like dplyr::filter for precise subsetting. ```R dplyr::filter(all_gene_sets, gs_collection == "H") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.