Skip to content

Commit

Permalink
referring to mosdef when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
federicomarini committed Sep 13, 2024
1 parent baf9859 commit 5d710c0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion R/GeneTonic-extras.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' with a set of unambiguous identifiers (e.g. ENSEMBL ids) and `gene_name`,
#' containing e.g. HGNC-based gene symbols. This object can be constructed via
#' the `org.eg.XX.db` packages, e.g. with convenience functions such as
#' [pcaExplorer::get_annotation_orgdb()].
#' [mosdef::get_annotation_orgdb()].
#'
#' @return A `GeneTonic`-list object, containing in its named slots the arguments
#' specified above: `dds`, `res_de`, `res_enrich`, and `annotation_obj` - the names
Expand Down
2 changes: 1 addition & 1 deletion R/GeneTonic.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' with a set of unambiguous identifiers (e.g. ENSEMBL ids) and `gene_name`,
#' containing e.g. HGNC-based gene symbols. This object can be constructed via
#' the `org.eg.XX.db` packages, e.g. with convenience functions such as
#' [pcaExplorer::get_annotation_orgdb()].
#' [mosdef::get_annotation_orgdb()].
#' @param gtl A `GeneTonic`-list object, containing in its slots the arguments
#' specified above: `dds`, `res_de`, `res_enrich`, and `annotation_obj` - the names
#' of the list _must_ be specified following the content they are expecting
Expand Down
2 changes: 1 addition & 1 deletion R/check_inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ checkup_GeneTonic <- function(dds,
stop(
"The provided `annotation_obj` object does not respect the format required to use in GeneTonic\n",
"e.g. all required column names have to be present.\n",
"You can use e.g. `pcaExplorer::get_annotation_orgdb()` for this purpose.\n",
"You can use e.g. `mosdef::get_annotation_orgdb()` for this purpose.\n",
"Required columns: ", paste(colnames_annotation_obj, collapse = ", ")
)
}
Expand Down
4 changes: 2 additions & 2 deletions R/gs_shaker.R
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ shake_topGOtableResult <- function(obj,
p_value_column = "p.value_elim") {
if (!all(c("GO.ID", "Term", "Annotated", "Significant", "Expected", "p.value_classic") %in%
colnames(obj))) {
stop("The provided object must be of in the format specified by the `pcaExplorer::topGOtable` function")
stop("The provided object must be of in the format specified by the `pcaExplorer::topGOtable` function or the `mosdef::run_topGO` function")
}

if (!p_value_column %in% colnames(obj)) {
Expand All @@ -232,7 +232,7 @@ shake_topGOtableResult <- function(obj,
if (!"genes" %in% colnames(obj)) {
stop(
"The column `genes` is not present in the provided object and is required for properly running GeneTonic.",
"\nMaybe you did set `addGeneToTerms` to FALSE in the call to `pcaExplorer::topGOtable`?"
"\nMaybe you did set `addGeneToTerms` to FALSE in the call to `pcaExplorer::topGOtable` or to `mosdef::run_topGO`?"
)
}

Expand Down
15 changes: 7 additions & 8 deletions vignettes/GeneTonic_manual.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ head(res_macrophage_IFNg_vs_naive)

3. `res_enrich`: With the DE results of the previous step, we are going to extract the vector of DE genes (via `mosdef::deresult_to_df`), as well as the list of genes to be used as background, and feed these two objects into a function that computes the functional enrichment of the DE genes.

We are going to use the ORA method implemented in `r BiocStyle::Biocpkg("topGO")`, wrapped in the function `topGOtable` available in the `r BiocStyle::Biocpkg("pcaExplorer")` package, which by default uses the `BP` ontology and the `elim` method to decorrelate the GO graph structure and deliver less redundant functional categories.
We are going to use the ORA method implemented in `r BiocStyle::Biocpkg("topGO")`, wrapped in the function `run_topGO` available in the `r BiocStyle::Biocpkg("mosdef")` package, which by default uses the `BP` ontology and the `elim` method to decorrelate the GO graph structure and deliver less redundant functional categories.
You can also use as an alternative the `enrichGO` function from `r BiocStyle::Biocpkg("clusterProfiler")`.

```{r create_resenrich1, eval=TRUE}
Expand All @@ -178,12 +178,11 @@ bg_ids <- rowData(dds_macrophage)$SYMBOL[rowSums(counts(dds_macrophage)) > 0]
```{r create_resenrich2, eval=FALSE}
library("topGO")
topgoDE_macrophage_IFNg_vs_naive <-
pcaExplorer::topGOtable(de_symbols_IFNg_vs_naive,
bg_ids,
ontology = "BP",
mapping = "org.Hs.eg.db",
geneID = "symbol",
topTablerows = 500)
mosdef::run_topGO(de_genes = de_symbols_IFNg_vs_naive,
bg_genes = bg_ids,
ontology = "BP",
mapping = "org.Hs.eg.db",
geneID = "symbol")
```

```{r load_resenrich, eval=TRUE}
Expand Down Expand Up @@ -213,7 +212,7 @@ anno_df <- data.frame(
row.names = rownames(dds_macrophage)
)
## alternatively:
# anno_df <- pcaExplorer::get_annotation_orgdb(dds_macrophage, "org.Hs.eg.db", "ENSEMBL")
# anno_df <- mosdef::get_annotation_orgdb(dds_macrophage, "org.Hs.eg.db", "ENSEMBL")
```


Expand Down

0 comments on commit 5d710c0

Please sign in to comment.