From 944e160351b54dc14327c96f620b613dfa8695d1 Mon Sep 17 00:00:00 2001 From: noriakis Date: Wed, 17 Apr 2024 12:09:45 +0900 Subject: [PATCH] clear the rcmdcheck notes --- NAMESPACE | 1 + R/alliance.R | 8 +++++++- R/bugsigdb.R | 4 ---- R/exportWCNetwork.R | 1 + R/getWordsOnDendro.R | 8 ++++---- R/manual.R | 11 ++++++----- R/pubmed.R | 25 +++++++++++++------------ R/refseq.R | 10 ++++++++-- R/sc.R | 4 ++-- man/generalf.Rd | 16 +++------------- 10 files changed, 45 insertions(+), 43 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index be4f89b..d8faef9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -83,6 +83,7 @@ importFrom(GetoptLong,qqcat) importFrom(MASS,cov.trob) importFrom(NLP,ngrams) importFrom(NLP,words) +importFrom(RColorBrewer,brewer.pal) importFrom(XML,xmlElementsByTagName) importFrom(XML,xmlParse) importFrom(XML,xmlTreeParse) diff --git a/R/alliance.R b/R/alliance.R index 795a7dc..5094e93 100644 --- a/R/alliance.R +++ b/R/alliance.R @@ -1,6 +1,6 @@ -#' alliance #' @rdname generalf #' @export +#' @importFrom RColorBrewer brewer.pal #' @examples #' geneList <- c("DDX41","PNKP","ERCC1","IRF3","XRCC1") #' \dontrun{alliance(geneList)} @@ -132,6 +132,12 @@ alliance <- function (geneList, ## If filter by GO terms if (filterByGO) { qqcat("`filterByGO` option enabled. Filtering by GO terms ...\n") + data_env <- new.env(parent = emptyenv()) + load(system.file("extdata", "sysdata.rda", package = "biotextgraph"), + envir=data_env) + goWords <- data_env[["goWords"]] + goWords2gram <- data_env[["goWords2gram"]] + if (ngram==1) { filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords] matSorted <- matSorted[filtered_by_GO] diff --git a/R/bugsigdb.R b/R/bugsigdb.R index 975a9c5..7618f06 100644 --- a/R/bugsigdb.R +++ b/R/bugsigdb.R @@ -1,7 +1,3 @@ -#' bugsigdb -#' -#' Visualize BugSigDB -#' #' @rdname generalf #' @import tm #' @import bugsigdbr diff --git a/R/exportWCNetwork.R b/R/exportWCNetwork.R index cb4d905..54de5c4 100644 --- a/R/exportWCNetwork.R +++ b/R/exportWCNetwork.R @@ -20,6 +20,7 @@ #' @param sizeMin minimum scale size for nodes #' @param sizeMax maximum scale size for nodes #' @param wcScale scaling size for wordcloud +#' @importFrom RColorBrewer brewer.pal #' @return export the Cytoscape.js network #' @export exportWCNetwork <- function(g, geneList, dir="network", colors=NULL, diff --git a/R/getWordsOnDendro.R b/R/getWordsOnDendro.R index 83e1243..106402d 100644 --- a/R/getWordsOnDendro.R +++ b/R/getWordsOnDendro.R @@ -356,7 +356,7 @@ getWordsOnDendro <- function(dhc, geneVec, geneNumLimit=1000, filter(.data$yend==h1) %>% filter(.data$xend <= max(labs1_x)) %>% filter(.data$xend >= min(labs1_x)) %>% - dplyr::pull(x) %>% unique() + dplyr::pull(.data$x) %>% unique() } labs2_x <- labelPos %>% @@ -368,7 +368,7 @@ getWordsOnDendro <- function(dhc, geneVec, geneNumLimit=1000, filter(.data$yend==h2) %>% filter(.data$xend <= max(labs2_x)) %>% filter(.data$xend >= min(labs2_x)) %>% - dplyr::pull(x) %>% unique() + dplyr::pull(.data$x) %>% unique() } XMIN <- median(c(min1, min2)) } else { @@ -399,7 +399,7 @@ getWordsOnDendro <- function(dhc, geneVec, geneNumLimit=1000, filter(.data$yend==h1) %>% filter(.data$xend <= max(labs1_x)) %>% filter(.data$xend >= min(labs1_x)) %>% - dplyr::pull(x) %>% unique() + dplyr::pull(.data$x) %>% unique() } labs2_x <- labelPos %>% @@ -411,7 +411,7 @@ getWordsOnDendro <- function(dhc, geneVec, geneNumLimit=1000, filter(.data$yend==h2) %>% filter(.data$xend <= max(labs2_x)) %>% filter(.data$xend >= min(labs2_x)) %>% - dplyr::pull(x) %>% unique() + dplyr::pull(.data$x) %>% unique() } XMAX <- median(c(max1, max2)) diff --git a/R/manual.R b/R/manual.R index 10b5882..f2fcf17 100644 --- a/R/manual.R +++ b/R/manual.R @@ -1,13 +1,8 @@ -#' manual -#' -#' Produce networks using manual input. -#' #' @rdname generalf #' @examples #' ret <- refseq("DDX41", plotType="wc") #' manual(getSlot(ret, "rawText")$Gene_summary, plotType="wc") #' @export -#' @return list of data frame and ggplot2 object #' @import tm #' @import GeneSummary #' @import wordcloud @@ -160,6 +155,12 @@ manual <- function(df, madeUpper=NULL, ## If filter by GO terms if (filterByGO) { qqcat("`filterByGO` option enabled. Filtering by GO terms ...\n") + data_env <- new.env(parent = emptyenv()) + load(system.file("extdata", "sysdata.rda", package = "biotextgraph"), + envir=data_env) + goWords <- data_env[["goWords"]] + goWords2gram <- data_env[["goWords2gram"]] + if (ngram==1) { filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords] matSorted <- matSorted[filtered_by_GO] diff --git a/R/pubmed.R b/R/pubmed.R index 0931cf8..b7cbdb1 100644 --- a/R/pubmed.R +++ b/R/pubmed.R @@ -1,11 +1,6 @@ -#' pubmed -#' -#' make word cloud or correlation network from PubMed -#' #' @rdname generalf #' @export #' @examples \dontrun{pubmed("DDX41")} -#' @return object consisting of data frame and ggplot2 object #' @import tm #' @import GeneSummary #' @import wordcloud @@ -216,14 +211,20 @@ pubmed <- function(queries, useRawQuery=FALSE, ## If filter by GO terms if (filterByGO) { - qqcat("`filterByGO` option enabled. Filtering by GO terms ...\n") - if (ngram==1) { - filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords] - matSorted <- matSorted[filtered_by_GO] - } else if (ngram==2) { + qqcat("`filterByGO` option enabled. Filtering by GO terms ...\n") + data_env <- new.env(parent = emptyenv()) + load(system.file("extdata", "sysdata.rda", package = "biotextgraph"), + envir=data_env) + goWords <- data_env[["goWords"]] + goWords2gram <- data_env[["goWords2gram"]] + + if (ngram==1) { + filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords] + matSorted <- matSorted[filtered_by_GO] + } else if (ngram==2) { filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords2gram] - matSorted <- matSorted[filtered_by_GO] - } else {# Do nothing + matSorted <- matSorted[filtered_by_GO] + } else {# Do nothing } } diff --git a/R/refseq.R b/R/refseq.R index 33d1ed3..1d227dc 100644 --- a/R/refseq.R +++ b/R/refseq.R @@ -2,10 +2,10 @@ #' #' @description Text mining RefSeq description, PubMed, BugSigDB #' and the other manually curated textual data. -#' @details The main functions of the {{biotextgraph}} package. The functions accepts +#' @details The main functions of the \pkg{biotextgraph} package. The functions accepts #' a character vector of biological entities (such as gene identifiers) #' and returns the summarized statistics and visualization -#' contained in {{biotext}} object. +#' contained in \code{biotext} object. #' #' @param geneList gene ID list #' @param queries query ID list @@ -354,6 +354,12 @@ refseq <- function (geneList, keyType="SYMBOL", ## If filter by GO terms if (filterByGO) { qqcat("`filterByGO` option enabled. Filtering by GO terms ...\n") + data_env <- new.env(parent = emptyenv()) + load(system.file("extdata", "sysdata.rda", package = "biotextgraph"), + envir=data_env) + goWords <- data_env[["goWords"]] + goWords2gram <- data_env[["goWords2gram"]] + if (ngram==1) { filtered_by_GO <- names(matSorted)[tolower(names(matSorted)) %in% goWords] matSorted <- matSorted[filtered_by_GO] diff --git a/R/sc.R b/R/sc.R index 3b923af..be852e6 100644 --- a/R/sc.R +++ b/R/sc.R @@ -366,14 +366,14 @@ plotReducedDimWithTexts <- function(sce, marker.info, YMe <- dens_max$y new_points <- rbind(new_points, - c(map_group[i], + c(colmap[i,"group"], XMe - r, YMe - r, XMe + r, YMe + r)) } else { new_points <- rbind(new_points, - c(map_group[i], + c(colmap[i,"group"], ctr["x"] - min(dist2center), ctr["y"] - min(dist2center), ctr["x"] + max(dist2center), diff --git a/man/generalf.Rd b/man/generalf.Rd index ec013a9..57fd438 100644 --- a/man/generalf.Rd +++ b/man/generalf.Rd @@ -8,7 +8,7 @@ \alias{pubmed} \alias{generalf} \alias{refseq} -\title{alliance} +\title{refseq, alliance, pubmed, manual, bugsigdb} \usage{ alliance( geneList, @@ -632,27 +632,17 @@ in which the function performs over-representation analysis by enrichKEGG or enr clusterProfiler and ReactomePA.} } \value{ -list of data frame and ggplot2 object - -object consisting of data frame and ggplot2 object - `biotext` class object } \description{ -Visualize BugSigDB - -Produce networks using manual input. - -make word cloud or correlation network from PubMed - Text mining RefSeq description, PubMed, BugSigDB and the other manually curated textual data. } \details{ -The main functions of the {{biotextgraph}} package. The functions accepts +The main functions of the \pkg{biotextgraph} package. The functions accepts a character vector of biological entities (such as gene identifiers) and returns the summarized statistics and visualization -contained in {{biotext}} object. +contained in \code{biotext} object. } \examples{ geneList <- c("DDX41","PNKP","ERCC1","IRF3","XRCC1")