Skip to content

Commit 3fb704c

Browse files
committed
add fgsea
1 parent 83881a4 commit 3fb704c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Imports:
4242
Suggests:
4343
airway,
4444
BiocStyle,
45+
fgsea,
4546
knitr,
4647
org.Hs.eg.db,
4748
pkgdown,

vignettes/workshop_isee_extension.Rmd

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ head(res_deseq2)
415415

416416
We embed the results of the `r BiocStyle::Biocpkg("DESeq2")` analysis within the `airway` object using the `r BiocStyle::Biocpkg("iSEEde")` function `embedContrastResults()`.
417417

418-
The function embeds the results in a way makes them detectable by the `iSEE()` function, and gives the possibility to store multiple differential expression results -- possibly from multiple methods such as `r BiocStyle::Biocpkg("edgeR")` and `r BiocStyle::Biocpkg("limma")` -- under different names.
418+
The function embeds the results in a structured way makes them detectable by the `iSEE()` function, and gives the possibility to store multiple differential expression results -- possibly from multiple methods such as `r BiocStyle::Biocpkg("edgeR")` and `r BiocStyle::Biocpkg("limma")` -- under different names.
419419

420420
```{r, message=FALSE, warning=FALSE}
421421
library(iSEEde)
@@ -442,6 +442,7 @@ We can then run a standard `r BiocStyle::Biocpkg("fgsea")` analysis.
442442

443443
In this case, we rank genes using the log2 fold-change computed during the differential expression analysis.
444444
The `r BiocStyle::Biocpkg("iSEEde")` function `log2FoldChange()` is a convenient method to fetch this information as a named vector in a format immediately compatible with the `fgsea()` function.
445+
The `r BiocStyle::Biocpkg("iSEEde")` function `contrastResults()` is used to fetch embedded results by name.
445446

446447
```{r}
447448
library("fgsea")
@@ -465,13 +466,45 @@ airway <- embedPathwaysResults(
465466
airway
466467
```
467468

469+
#### Mapping pathways to genes
470+
471+
Separately, it is necessary to define and register a function that fetches the gene identifiers associated with a given pathway identifier.
472+
This function is required to transmit selections from pathway-level panels to feature-level panels.
473+
474+
Due to the use of `uniquifyFeatureNames()` above, the function must first map to the unique Ensembl gene identifier, to accurately identify the corresponding value in `rownames(airway)`.
475+
476+
```{r}
477+
map_GO <- function(pathway_id, se) {
478+
pathway_ensembl <- mapIds(org.Hs.eg.db, pathway_id, "ENSEMBL", keytype = "GOALL", multiVals = "CharacterList")[[pathway_id]]
479+
pathway_rownames <- rownames(se)[rowData(se)[["gene_id"]] %in% pathway_ensembl]
480+
pathway_rownames
481+
}
482+
airway <- registerAppOptions(airway, Pathways.map.functions = list(GO = map_GO))
483+
```
484+
468485
#### Add normalised gene expression
469486

470487
```{r}
471488
library("scuttle")
472489
airway <- logNormCounts(airway)
473490
```
474491

492+
### Live app
493+
494+
Finally, we can preconfigure the initial state of an app that immediately links panels to one another.
495+
496+
```{r, message=FALSE, warning=FALSE, eval=interactive()}
497+
iSEE(airway, initial = list(
498+
PathwaysTable(PanelWidth = 4L),
499+
VolcanoPlot(PanelWidth = 4L,
500+
RowSelectionSource = "PathwaysTable1", ColorBy = "Row selection"),
501+
ComplexHeatmapPlot(PanelWidth = 4L,
502+
RowSelectionSource = "PathwaysTable1",
503+
CustomRows = FALSE, ColumnData = "dex",
504+
ClusterRows = TRUE, ClusterRowsDistance = "euclidean", AssayCenterRows = TRUE),
505+
FgseaEnrichmentPlot(PanelWidth = 12L)
506+
))
507+
```
475508

476509
Plan:
477510

0 commit comments

Comments
 (0)