knitr::opts_chunk$set(warning = FALSE)
````{=html}
## Introduction **EnrichR** [@Kuleshov2016][@Chen2013] is a GSE (Gene Set Enrichment) method that infers biological knowledge by performing enrichment of input gene sets with curated biologically relevant prior databases that represent biological functions or functional pathways. Single-Cell Toolkit (SCTK) offers an easy to use interface to the EnrichR method and only requires the selection of input genes and the databases against which the genes should be tested. To view detailed instructions on how to use the method from the toolkit, please select "Interactive Analysis" for using enrichR in shiny application or "Console Analysis" for using this method on R console from the tabs below: ## Workflow Guide ````{=html} <div class="tab"> <button class="tablinks" onclick="openTab(event, 'interactive')" id="ia-button">Interactive Analysis</button> <button class="tablinks" onclick="openTab(event, 'console')" id="console-button">Console Analysis</button> </div> <div id="interactive" class="tabcontent">
An overall workflow guide on how to use EnrichR sub-tab is described below.
\
To enter the tab for running EnrichR analysis, users need to:
Approaches to select genes
\
At the top-left of the EnrichR tab, a radio-button set is provided for users to choose a way to specify the gene set to use for EnrichR test.
````{=html}
A. Use differential expression genes already identified
1. **Select DE Analysis** - After performing [differential expression analysis](differential_expression.html) with SCTK, users will have options available in this dropdown box. Users can select an analysis to import the DEGs identified there. <br> 2. **Use Log2FC greater than** - Filter the DEGs, to only use genes with the absolute value of log2 fold-change greater than the input. <br> 3. **Use FDR less than** - Filter the DEGs, to only use genes with FDR value less than the input. <br> 4. **Only use upregulated genes** - Filter the DEGs, check to only use genes with positive log2 fold-change values. <br> 5. **Use mean exp in group1 greater than** - Filter the DEGs, to only use genes with mean expression within group1 ([what is group1?](differential_expression.html)) greater then the input. <br> 6. **Use mean exp in group2 less than** - Filter the DEGs, to only use genes with mean expression within group2 less then the input. <br> 7. **Use exp% in group1 greater than** - Filter the DEGs, to only use genes expressed in greater than this fraction of cells in group1. <br> 8. **Use exp% in group2 less than** - Filter the DEGs, to only use genes expressed in greater than this fraction of cells in group1. <br> By making changes above, the number of remaining DEGs and the list of remaining DEGs will be shown at the bottom of this section. ````{=html} </details> <details> <summary><b>B. Manually select genes</b></summary>
````{=html}
C. Upload a file that contains gene names
10. Users can upload a text table file where the first column contains the gene identifiers. A text file with one gene per line works the same. CSV, TSV or TXT formats may be accepted. Depending on the exact situation of the file, selection might be applied in the following options. 11. **Header** - If the first line of the file is a header (e.g. column names if it's a table, "Genes", "Symbols" or etc. if it's just the genes), users need to check this option to let the APP ignore the line. 12. **Separator** - If the text file is a table, users need to make sure of the separator of entries and make the corresponding selection here. Usually, "Comma" for CSV files and "Tab" for TSV files. 13. **Quote** - Depending on whether each entry in the text table file is quoted, users might make a selection here. Users might open file with a text editor software, or run `head ${FILENAME}` command on Unix system, to exactly have a check on it. 14. **Match feature type** - If the type of the gene identifiers (e.g. symbol, ensembl ID, etc.) provided in the file does not match to the default type for the dataset (denoted as "rownames"), users need to select from available feature metadata to find the match. ````{=html} </details>
Other necessary options
Select symbol annotation - EnrichR only expects gene symbols as the input. That's to say, if the genes selected from previous steps appear to be IDs, EnrichR is likely to return zero lines of result. In this case, users are provided with a selection to convert the identifier type from available feature metadata.
Select DB - Select databases to test the input genes against. By default, no selection is made and all available databases will be used. However, this may take long time to compute
Set analysis name - Users have to set an analysis name for each run, in order to distinguish the results of different input.
Press Run to start computation of enrichment scores.
Result display
After running the analysis, the result table will be automatically shown on the right side of the EnrichR tab (left part of the figure). The content to be shown might be adjusted as instructed below.
Click on the cog button to open a dropdown box with options (right part of the figure).
Select analysis name - Choose to show the result of a sepecific analysis. All EnrichR analyses conducted by SCTK will be available here.
Show result of sepecific database - Filter the result table by database. Only the databases used for the selected analysis will be available here. Leave unselected for showing all results.
````{=html}
**1. Select genes and databases** ```r websiteLive <- getOption("enrichR.live") if (isTRUE(websiteLive)) { enrichR::listEnrichrSites() enrichR::setEnrichrSite("Enrichr") # Human genes } genes <- c("HES1", "PON2", "FBXO44", "DEK", "SOX4", "FBXL16") databases <- enrichR::listEnrichrDbs()$libraryName ``` **2. Run EnrichR** ```r sce <- runEnrichR(inSCE = sce, features = genes, db = databases, analysisName = "tutorial_analysis") ``` For the `runEnrichR()` function above, the required parameters are: - `inSCE`: The input `SingleCellExperiment` object - `features`: A vector of input gene names - `analysisName`: A string to identify a single analysis Other optional parameters include: - `db`: A character vector of the databases to test - `by`: Indicates where the method should find the `features`. Can be `"rownames"` or a column name of `rowData(inSCE)`. - `featureName`: EnrichR expects gene symbols as the input. Need to choose from `rowData` to convert `features` if necessary. **3. Get results** ```r getEnrichRResult(sce, analysisName = "tutorial_analysis")$result ``` <br> ````{=html} <details> <summary><b>Example</b></summary>
# Fetch databases library(enrichR) websiteLive <- getOption("enrichR.live") if (isTRUE(websiteLive)) { listEnrichrSites() setEnrichrSite("Enrichr") # Human genes } # Make enrichR do its job, and connect to the database databases <- listEnrichrDbs() # Load singleCellTK & pbmc3k example data library(singleCellTK) sce <- importExampleData(dataset = "pbmc3k") # Select genes genes <- c("HES1", "PON2", "FBXO44", "DEK", "SOX4", "FBXL16") # Run enrichR sce <- runEnrichR(inSCE = sce, features = genes, db = databases$libraryName, analysisName = "tutorial_test")
# Print the first five results result <- getEnrichRResult(sce, "tutorial_test")$result head(result)
res <- getEnrichRResult(sce, "tutorial_test")$result knitr::kable(format(head(res), digits = 3))
{=html}
</details>
</div>
<script>
document.getElementById("ia-button").click();
</script>
</body>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.