Skip to content

Commit

Permalink
Quick patch - fixing a mixup in the vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
MarekGierlinski committed Apr 26, 2024
1 parent 39d9780 commit 4cfaf71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fenr
Title: Fast functional enrichment for interactive applications
Version: 1.1.10
Version: 1.1.11
Authors@R: person(
given = "Marek",
family = "Gierlinski",
Expand Down Expand Up @@ -52,8 +52,7 @@ Suggests:
testthat,
knitr,
rmarkdown,
topGO,
org.Sc.sgd.db
topGO
RoxygenNote: 7.3.1
VignetteBuilder: knitr
LazyData: false
25 changes: 12 additions & 13 deletions vignettes/fenr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -170,26 +170,25 @@ To illustrate, let's take the example of the *topGO* package.
```{r topGO}
suppressPackageStartupMessages({
library(topGO)
library(org.Sc.sgd.db)
})
# Convert gene symbols to gene IDs
symbol2id <- setNames(go$mapping$gene_id, go$mapping$gene_symbol)
all_ids <- unname(symbol2id[exmpl_all])
sel_ids <- unname(symbol2id[exmpl_sel])
# Prepare for topGO
all_genes <- setNames(rep(0, length(all_ids)), all_ids)
all_genes[all_ids %in% sel_ids] <- 1
# Preparing the gene set
all_genes <- setNames(rep(0, length(exmpl_all)), exmpl_all)
all_genes[exmpl_all %in% exmpl_sel] <- 1
# Define the gene selection function
gene_selection <- function(genes) {
genes > 0
}
# Mapping genes to GO
allGO2genes <- annFUN.org(whichOnto = "BP", feasibleGenes = NULL,
mapping = "org.Sc.sgd.db", ID = "ensembl")
# Mapping genes to GO, we use the go2gene downloaded above and convert it to a
# list
go2gene <- go$mapping |>
dplyr::select(gene_symbol, term_id) |>
dplyr::distinct() |>
dplyr::group_by(term_id) |>
dplyr::summarise(ids = list(gene_symbol)) |>
tibble::deframe()
# Setting up the GO data for analysis
go_data <- new(
Expand All @@ -198,7 +197,7 @@ go_data <- new(
allGenes = all_genes,
geneSel = gene_selection,
annot = annFUN.GO2genes,
GO2genes = allGO2genes
GO2genes = go2gene
)
# Performing the enrichment test
Expand Down

0 comments on commit 4cfaf71

Please sign in to comment.