Browse code

removed david mentioning

veitveit authored on 09/01/2025 16:06:06
Showing 3 changed files

1 1
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+* using log directory ‘/home/veit/devel/Bioinformatics/DataAnalysis/ShinyApps/vsclust/..Rcheck’
2
+* using R version 4.4.2 (2024-10-31)
3
+* using platform: x86_64-pc-linux-gnu
4
+* R was compiled by
5
+    gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
6
+    GNU Fortran (Ubuntu 13.2.0-23ubuntu4) 13.2.0
7
+* running under: Ubuntu 24.04.1 LTS
8
+* using session charset: UTF-8
9
+* checking for file ‘./DESCRIPTION’ ... ERROR
10
+Required fields missing or empty:
11
+  ‘Author’ ‘Maintainer’
12
+* DONE
13
+Status: 1 ERROR
... ...
@@ -80,9 +80,9 @@ shinyUI(fluidPage(theme=shinytheme("cosmo"),
80 80
                       h3("Distribution of features over clusters"),
81 81
                       DT::dataTableOutput("clustinf2"),
82 82
                       value="clust2"),
83
-                    tabPanel("Enriched terms (DAVID)",inputPanel(
83
+                    tabPanel("Enriched terms (STRING)",inputPanel(
84 84
                       # radioButtons("enrich_method","Enrichment tool",choices=c("DAVID"="DAVID","KEGG (local copy)"="KEGG","GO molecular function (local copy)"="GOMF"),selected = "DAVID"),br(),
85
-                      selectInput("infosource","Information resource (DAVID)",choices=list("GO terms"=c("GO molecular function"="Function",
85
+                      selectInput("infosource","Information resource (STRING)",choices=list("GO terms"=c("GO molecular function"="Function",
86 86
                                                                                                         "GO biological process"="Process",
87 87
                                                                                                         "GO cellular component"="Component"),
88 88
                                                                                            UniProt = c("UniProt keywords" = "Keyword"),
... ...
@@ -2,7 +2,7 @@
2 2
 % Please edit documentation in R/WrapperFuncs.R
3 3
 \name{enrichSTRING_API}
4 4
 \alias{enrichSTRING_API}
5
-\title{Functional Enrichment with STRING}
5
+\title{Enrichment Analysis via STRING REST API}
6 6
 \usage{
7 7
 enrichSTRING_API(
8 8
   genes,
... ...
@@ -13,57 +13,75 @@ enrichSTRING_API(
13 13
 )
14 14
 }
15 15
 \arguments{
16
-\item{cl}{A clustering result. Typically either the direct output of
17
-\code{vsclust_algorithm} or a \code{Bestcl} object from \code{ClustComp}
18
-or \code{runClustWrapper}.}
16
+\item{genes}{Character vector of gene or protein identifiers recognized by STRING.}
19 17
 
20
-\item{protnames}{Optional named vector mapping feature IDs (as in \code{cl$cluster})
21
-to more interpretable gene/protein identifiers. If \code{NULL} (the default),
22
-the feature names in \code{cl} themselves are used.}
18
+\item{species}{A single numeric or string specifying the NCBI taxonomy ID
19
+(e.g., \code{9606} for human). If \code{"none"} (default), no species is set in
20
+the request, and STRING will attempt to auto-detect or may fail.}
23 21
 
24
-\item{infosource}{Currently unused; previously indicated enrichment categories
25
-when using DAVID. Kept for compatibility but is ignored in this version.}
22
+\item{category}{One or more enrichment categories from STRING (e.g., \code{"KEGG"},
23
+\code{"Process"}, etc.). Defaults to \code{"KEGG"} if unspecified.}
24
+
25
+\item{adjpvalueCutoff}{Numeric cutoff for the BH-adjusted p-value (default 0.05).}
26
+
27
+\item{verbose}{Logical indicating whether to print diagnostic messages (default \code{FALSE}).}
26 28
 }
27 29
 \value{
28
-A list with three components:
29
-\describe{
30
-  \item{\code{fullFuncs}}{The full \code{compareCluster} result from \code{enrichSTRING_API}.}
31
-  \item{\code{redFuncs}}{A \code{compareClusterResult} object containing only
32
-        the top 20 enriched terms (if more than 20 were detected).}
33
-  \item{\code{BHI}}{A numeric value from \code{calcBHI} measuring cluster
34
-        heterogeneity.}
35
-}
30
+If any terms pass the cutoff, an \code{\link{enrichResult}} object
31
+  (from \emph{clusterProfiler}) is returned. Otherwise, if \emph{clusterProfiler}
32
+  is not installed or no terms pass filtering, the function either returns a
33
+  data.frame (if installed but no terms pass) or \code{NULL}.
36 34
 }
37 35
 \description{
38
-\code{runFuncEnrich} performs a functional enrichment analysis for each cluster
39
-of features (genes/proteins) using an \code{enrichSTRING_API} call (which queries
40
-the STRING database). It replaces a previously used approach that relied on
41
-\emph{RDAVIDWebService}, and is therefore more up to date.
36
+\code{enrichSTRING_API} performs a functional enrichment analysis by sending a
37
+gene list to STRING's TSV API endpoint, retrieving enrichment results for one or
38
+more categories (e.g., "KEGG"), and building a \code{clusterProfiler}-style result
39
+object. It is intended as a lightweight replacement for older web-service–based
40
+methods like \emph{RDAVIDWebService}.
42 41
 }
43 42
 \details{
44
-The function takes a clustering result (e.g., from \code{vsclust_algorithm} or
45
-\code{Bestcl} objects) and, for each cluster:
43
+This function:
46 44
 \enumerate{
47
-  \item Extracts the member features with membership above 0.5.
48
-  \item Optionally replaces their IDs with entries from \code{protnames}.
49
-  \item Calls \code{compareCluster} (from \emph{clusterProfiler}) using a
50
-        custom \code{enrichSTRING_API} function for the actual STRING-based enrichment.
45
+  \item Accepts a vector of \code{genes} recognized by STRING (e.g., Ensembl,
46
+        UniProt, or commonly used gene symbols for a given species).
47
+  \item Sends a \emph{POST} request to \url{https://string-db.org/api/tsv/enrichment} with
48
+        those identifiers (and optionally \code{species}).
49
+  \item Parses the returned \emph{TSV}-formatted enrichment data, which typically
50
+        includes columns for \code{term}, \code{description}, \code{p_value}, and more.
51
+  \item Optionally filters by \code{category} (e.g., "KEGG", "Process", etc.), applies
52
+        \code{BH} multiple-testing correction, and removes terms above the
53
+        \code{adjpvalueCutoff}.
54
+  \item Returns an object of class \code{enrichResult} if \emph{clusterProfiler} is
55
+        installed; otherwise, it simply returns the filtered data frame.
51 56
 }
52
-The resulting \code{compareClusterResult} includes adjusted p-values (FDR),
53
-and the top 20 enriched terms are retained if the total set is larger than 20.
57
+
58
+Note that this function does \emph{not} allow you to explicitly supply a custom
59
+background gene set. The STRING API by default uses the entire known set of genes
60
+or proteins for the specified species as the background. Also, the total number of
61
+background genes is not reported by STRING; only how many of them map to each term.
54 62
 }
55 63
 \examples{
56
-\dontrun{
57
-  # Suppose 'mycl' is a clustering result from vsclust_algorithm,
58
-  # and we have a named vector 'myProtnames' that maps feature IDs to gene symbols:
64
+  library(httr)
59 65
 
60
-  res <- runFuncEnrich(mycl, protnames = myProtnames)
61
-  res$fullFuncs  # The full compareCluster output
62
-  res$redFuncs   # The top 20 enriched terms
63
-  res$BHI        # The numeric BHI value
64
-}
66
+  # A small gene set:
67
+  gene_set <- c("TP53","BRCA1","BRCA2","EGFR")
68
+
69
+  # Perform enrichment on KEGG terms for human (9606):
70
+  enr <- enrichSTRING_API(
71
+            genes       = gene_set,
72
+            species     = 9606,
73
+            category    = "KEGG",
74
+            adjpvalueCutoff = 0.05,
75
+            verbose     = TRUE
76
+         )
77
+
78
+  if (!is.null(enr)) {
79
+    # If clusterProfiler is installed and some terms pass filtering, check results:
80
+    head(enr@result)
81
+  }
65 82
 
66 83
 }
67 84
 \seealso{
68
-\code{\link{compareCluster}}, \code{\link{enrichSTRING_API}}
85
+\href{https://string-db.org/help/api/}{STRING API documentation},
86
+\code{\link{clusterProfiler}}.
69 87
 }