From 38f4b23f5de538be5688c3b41f7d7ea054a70633 Mon Sep 17 00:00:00 2001 From: noriakis <31095487+noriakis@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:40:52 +0900 Subject: [PATCH] resolve warning --- DESCRIPTION | 3 +-- NAMESPACE | 6 +++++- R/bugsigdb.R | 2 +- R/utils.R | 6 +++++- vignettes/basic_usage_of_biotextgraph.Rmd | 24 ++++++++++++----------- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 017a4a5..4c55cf9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,6 @@ Depends: Imports: tm, dplyr, GeneSummary, wordcloud, cowplot, ggplotify, stopwords, ggraph, igraph, ggdendro, AnnotationDbi, patchwork, org.Hs.eg.db, jsonlite, gridExtra, pvclust, rentrez, GetoptLong, grid, grDevices, stats, NLP, bugsigdbr, stringr, XML, methods, dendextend, RColorBrewer, utils, ggrepel, cyjShiny, graphlayouts, ggforce, ggwordcloud, MASS, tidygraph, data.table, shadowtext Suggests: concaveman, - clusterProfiler, png, limma, knitr, @@ -20,7 +19,7 @@ Suggests: testthat (>= 3.0.0), BiocStyle Enhances: - ReactomePA, Seurat, scater, pubmedMini, ggtree, quanteda, taxonomizr, udpipe + ReactomePA, Seurat, scater, pubmedMini, ggtree, quanteda, taxonomizr, udpipe, clusterProfiler RoxygenNote: 7.3.1 VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index b2cb663..be4f89b 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -64,7 +64,6 @@ export(tag_words) export(textORA) exportMethods(getSlot) import(GeneSummary) -import(XML) import(bugsigdbr) import(ggplot2) import(ggraph) @@ -84,6 +83,11 @@ importFrom(GetoptLong,qqcat) importFrom(MASS,cov.trob) importFrom(NLP,ngrams) importFrom(NLP,words) +importFrom(XML,xmlElementsByTagName) +importFrom(XML,xmlParse) +importFrom(XML,xmlTreeParse) +importFrom(XML,xmlValue) +importFrom(XML,xpathSApply) importFrom(cowplot,as_grob) importFrom(cyjShiny,dataFramesToJSON) importFrom(data.table,fread) diff --git a/R/bugsigdb.R b/R/bugsigdb.R index 73548e6..9b57853 100644 --- a/R/bugsigdb.R +++ b/R/bugsigdb.R @@ -8,7 +8,7 @@ #' @import wordcloud #' @import igraph #' @import ggraph ggplot2 -#' @import XML +#' @importFrom XML xmlParse xpathSApply xmlTreeParse xmlElementsByTagName xmlValue #' @importFrom dplyr filter #' @importFrom stats dist #' @importFrom grDevices palette diff --git a/R/utils.R b/R/utils.R index 55575f2..2852caf 100644 --- a/R/utils.R +++ b/R/utils.R @@ -14,7 +14,11 @@ split_by_ea <- function(args) { geneList <- args$geneList } if (args$splitByEA=="kegg") { - enr_res <- clusterProfiler::enrichKEGG(geneList) + if (requireNamespace("clusterProfiler")) { + enr_res <- clusterProfiler::enrichKEGG(geneList) + } else { + stop("Please install clusterProfiler.") + } } else { if (requireNamespace("ReactomePA")) { enr_res <- ReactomePA::enrichPathway(geneList) diff --git a/vignettes/basic_usage_of_biotextgraph.Rmd b/vignettes/basic_usage_of_biotextgraph.Rmd index 5838019..88781ea 100644 --- a/vignettes/basic_usage_of_biotextgraph.Rmd +++ b/vignettes/basic_usage_of_biotextgraph.Rmd @@ -107,15 +107,6 @@ hCNet <- refseq(keggList$`05160`, plotType="network", plotNet(hCNet, asis=TRUE) ``` -The summarization of text in enrichment analysis results can be performed by `enrich` option. The below example shows enrichment analysis of KEGG database. - -```{r basic5, warning=FALSE, message=FALSE, cache=TRUE, fig.height=8, fig.width=8} -hCNetK <- refseq(keggList$`05160`, enrich="kegg", keyType="ENTREZID",cooccurrence = TRUE, - topPath=50, numWords=50, autoThresh=FALSE, - plotType="network", corThresh=0.1) -plotNet(hCNetK, asis=TRUE) -``` - We create another `biotext` object to compare with. ```{r basic6, warning=FALSE, message=FALSE, cache=TRUE, fig.height=8, fig.width=8} @@ -125,11 +116,22 @@ ecoli <- refseq(keggList$`05130`, keyType="ENTREZID", autoThresh=FALSE) Comparison of networks can be performed by `compareWordNet`. By providing multiple biotext class objects, it is possible to create a new network by integrating the networks and tag information contained in each object. This makes it possible to compare multiple different IDs. ```{r compare_word_net, warning=FALSE, message=FALSE, cache=TRUE, fig.height=15, fig.width=15} -compareWordNet(list(hCNet, hCNetK, ecoli), - titles=c("RefSeq_05160","KEGG_05160","RefSeq_05130"), +compareWordNet(list(hCNet, ecoli), + titles=c("RefSeq_05160","RefSeq_05130"), colPal = "Dark2") |> plotNet() ``` +The summarization of text in enrichment analysis results can be optionally performed by `enrich` option. The below example shows enrichment analysis of KEGG database. + +```{r basic5, warning=FALSE, message=FALSE, cache=TRUE, fig.height=8, fig.width=8} +if (requireNamespace("clusterProfiler")) { + hCNetK <- refseq(keggList$`05160`, enrich="kegg", keyType="ENTREZID",cooccurrence = TRUE, + topPath=50, numWords=50, autoThresh=FALSE, + plotType="network", corThresh=0.1) + plotNet(hCNetK, asis=TRUE) +} +``` + ## Summarizing other identifiers' data Other than genes, microbial information can also be summarized in the similar manner. For obtaining and summarizing information on disease relationship, enzymes, metabolites, and biological pathways, please refer to the [documentation](https://noriakis.github.io/software/biotextgraph). Furthermore, a manual function (`manual`) is available that performs similar operations based on customized user input.