From 05e831a13225407067280044ad3ca907f1dfcb5f Mon Sep 17 00:00:00 2001 From: xiangpin Date: Tue, 3 Feb 2026 11:37:11 +0800 Subject: [PATCH 1/4] fix example of gson_GO_local --- R/gson.R | 4 ++-- man/gson_GO_local.Rd | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/gson.R b/R/gson.R index f4f848e..d44ea40 100644 --- a/R/gson.R +++ b/R/gson.R @@ -149,7 +149,7 @@ gson_WP <- function(organism) { #' #' @examples #' data = data.frame(gene_id = "gene1", -#' go_id = c("GO:0035492", "GO:0009764", "GO:0031063", "GO:0033714", "GO:0036349")) +#' go_id = c("GO:0035492", "GO:0009764", "GO:0031040", "GO:0033714", "GO:0036349")) #' gson_GO_local(data, species = "E. coli") gson_GO_local <- function(data, ont = c("ALL", "BP", "CC", "MF"), @@ -424,4 +424,4 @@ kegg_release = function(db){ y = readLines(url) release <- sub("\\w+\\s+", "", y[grep('Release', y)]) return(release) -} \ No newline at end of file +} diff --git a/man/gson_GO_local.Rd b/man/gson_GO_local.Rd index a3608b8..5319be0 100644 --- a/man/gson_GO_local.Rd +++ b/man/gson_GO_local.Rd @@ -23,6 +23,6 @@ Build a gson object that annotate Gene Ontology } \examples{ data = data.frame(gene_id = "gene1", - go_id = c("GO:0035492", "GO:0009764", "GO:0031063", "GO:0033714", "GO:0036349")) + go_id = c("GO:0035492", "GO:0009764", "GO:0031040", "GO:0033714", "GO:0036349")) gson_GO_local(data, species = "E. coli") } From 478bd941951dd5c7d9867d42146ecbda17110c99 Mon Sep 17 00:00:00 2001 From: xiangpin Date: Tue, 3 Feb 2026 11:38:30 +0800 Subject: [PATCH 2/4] fix jsonlite issue and add args doc of interpret --- R/interpret.R | 5 ++++- R/plot_interpret.R | 8 ++++---- man/interpret.Rd | 8 ++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/R/interpret.R b/R/interpret.R index 6b58609..caa717b 100644 --- a/R/interpret.R +++ b/R/interpret.R @@ -269,6 +269,10 @@ run_agent_synthesizer <- function(pathways, detective_report, context, model, ap #' @param n_pathways Number of top significant pathways to include in the analysis. Default is 20. #' @param model The LLM model to use. Default is "deepseek-chat". Supported models include "deepseek-chat", "glm-4", "qwen-turbo" etc. #' @param api_key The API key for the LLM. If NULL, it tries to fetch from `getOption('yulab_translate')` based on the model. +#' @param task Task type, default is "interpretation". Other options include "cell_type"/"annotation" and "phenotype"/"phenotyping". +#' @param prior Optional prior knowledge (e.g., a biological hypothesis) to guide the task. +#' @param add_ppi Boolean, whether to use PPI network integration. +#' @param gene_fold_change Named vector of logFC for expression context. #' @return A character string containing the LLM-generated interpretation. #' @author Guangchuang Yu #' @export @@ -847,7 +851,6 @@ Ensure the response is a valid JSON object. Do not include any markdown formatti return(base_prompt) } -#' @importFrom jsonlite toJSON fromJSON call_llm_fanyi <- function(prompt, model, api_key) { if (!requireNamespace("fanyi", quietly = TRUE)) { stop("Package 'fanyi' is required for interpret(). Please install it.") diff --git a/R/plot_interpret.R b/R/plot_interpret.R index a29c9e0..25c48da 100644 --- a/R/plot_interpret.R +++ b/R/plot_interpret.R @@ -21,12 +21,12 @@ plot.interpretation <- function(x, layout = "nicely", ...) { # Use ggtangle to visualize the network # Note: ggtangle extends ggplot2 - p <- ggtangle::ggtangle(g, layout = layout, ...) + p <- ggplot2::ggplot(g, layout = layout, ...) # Add edges # We try to map interaction type to color if available if ("interaction" %in% igraph::edge_attr_names(g)) { - p <- p + ggtangle::geom_edge(ggplot2::aes(color = interaction)) + + p <- p + ggtangle::geom_edge(ggplot2::aes(color = !!rlang::sym("interaction"))) + ggplot2::scale_color_manual(values = c( activation = "green3", inhibition = "red3", @@ -39,8 +39,8 @@ plot.interpretation <- function(x, layout = "nicely", ...) { } # Add nodes and labels - p <- p + ggtangle::geom_node_point(size = 5, color = "lightblue") + - ggtangle::geom_node_text(ggplot2::aes(label = name), repel = TRUE) + + p <- p + ggplot2::geom_point(size = 5, color = "lightblue") + + ggtangle::geom_cnet_label(ggplot2::aes(label = !!rlang::sym("name"))) + ggplot2::theme_void() main_title <- "Refined Regulatory Network" diff --git a/man/interpret.Rd b/man/interpret.Rd index eb2a810..ee1779c 100644 --- a/man/interpret.Rd +++ b/man/interpret.Rd @@ -26,6 +26,14 @@ interpret( \item{model}{The LLM model to use. Default is "deepseek-chat". Supported models include "deepseek-chat", "glm-4", "qwen-turbo" etc.} \item{api_key}{The API key for the LLM. If NULL, it tries to fetch from `getOption('yulab_translate')` based on the model.} + +\item{task}{Task type, default is "interpretation". Other options include "cell_type"/"annotation" and "phenotype"/"phenotyping".} + +\item{prior}{Optional prior knowledge (e.g., a biological hypothesis) to guide the task.} + +\item{add_ppi}{Boolean, whether to use PPI network integration.} + +\item{gene_fold_change}{Named vector of logFC for expression context.} } \value{ A character string containing the LLM-generated interpretation. From 4bbea238a463aee03e374a94489fe2f9f78d6157 Mon Sep 17 00:00:00 2001 From: xiangpin Date: Tue, 3 Feb 2026 11:39:24 +0800 Subject: [PATCH 3/4] new suggests pkg --- DESCRIPTION | 3 ++- NAMESPACE | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7a4e160..202616f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -48,7 +48,8 @@ Suggests: readr, org.Hs.eg.db, quarto, - testthat + testthat, + ggplot2 VignetteBuilder: quarto ByteCompile: true License: Artistic-2.0 diff --git a/NAMESPACE b/NAMESPACE index 5c189ad..7cb7f97 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -152,8 +152,6 @@ importFrom(enrichplot,ridgeplot) importFrom(gson,gson) importFrom(gson,read.gmt) importFrom(gson,read.gmt.wp) -importFrom(jsonlite,fromJSON) -importFrom(jsonlite,toJSON) importFrom(magrittr,"%<>%") importFrom(magrittr,"%>%") importFrom(methods,is) From 4a60118dd8f302060b6abde7dcf98c522ddd72d3 Mon Sep 17 00:00:00 2001 From: xiangpin Date: Thu, 5 Feb 2026 12:42:52 +0800 Subject: [PATCH 4/4] update docs --- DESCRIPTION | 1 - man/clusterProfiler-package.Rd | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bd7fa86..d26c4a1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -45,7 +45,6 @@ Suggests: DOSE, fanyi (>= 0.1.0), ggtangle, - jsonlite, readr, org.Hs.eg.db, quarto, diff --git a/man/clusterProfiler-package.Rd b/man/clusterProfiler-package.Rd index 12342a0..5737967 100644 --- a/man/clusterProfiler-package.Rd +++ b/man/clusterProfiler-package.Rd @@ -4,9 +4,9 @@ \name{clusterProfiler-package} \alias{clusterProfiler} \alias{clusterProfiler-package} -\title{clusterProfiler: A universal enrichment tool for interpreting omics data} +\title{clusterProfiler: A Universal Enrichment Tool for Interpreting Omics Data} \description{ -This package supports functional characteristics of both coding and non-coding genomics data for thousands of species with up-to-date gene annotation. It provides a universal interface for gene functional annotation from a variety of sources and thus can be applied in diverse scenarios. It provides a tidy interface to access, manipulate, and visualize enrichment results to help users achieve efficient data interpretation. Datasets obtained from multiple treatments and time points can be analyzed and compared in a single run, easily revealing functional consensus and differences among distinct gene clusters. +A universal tool for interpreting functional characteristics of omics data. It supports Over-Representation Analysis (ORA) and Gene Set Enrichment Analysis (GSEA) for both coding and non-coding genomics data of thousands of species. It provides a unified and tidy interface to access, manipulate, and visualize enrichment results. A key capability is the simultaneous analysis and comparison of datasets from multiple treatments or time points. Furthermore, it integrates Large Language Model (LLM) capabilities to provide automated and insightful interpretation of enrichment results. } \seealso{ Useful links: