Browse code

fixed minor bugs, version cran check-ed and BiocCheck-ed

ciccio authored on 21/09/2017 20:28:35
Showing 14 changed files

... ...
@@ -12,7 +12,7 @@ Description: Pathway Expression Profiles (PEPs) are based on the
12 12
     perturbagens.
13 13
 License: GPL-3
14 14
 Imports:
15
-    repo,
15
+    repo (>= 2.1.1),
16 16
     XML,
17 17
     foreach,
18 18
     stats,
... ...
@@ -22,7 +22,7 @@ Suggests:
22 22
     testthat,
23 23
     knitr,
24 24
     rmarkdown
25
-RoxygenNote: 5.0.1
25
+RoxygenNote: 6.0.1
26 26
 VignetteBuilder: knitr
27 27
 biocViews: GeneExpression,
28 28
     DifferentialExpression,
... ...
@@ -10,26 +10,35 @@
10 10
 #' @details
11 11
 #'
12 12
 #' \code{gep2pep} creates a local repository of gene sets, which can
13
-#' also be imported from the MSigDB database. The local repository is
14
-#' in the \code{repo} format. When a GEP, defined as a ranked list of
15
-#' genes, is passed to \code{\link{buildPEPs}}, the stored database of
16
-#' pathways is used to convert the GEP to a PEP and permanently store
17
-#' the latter.
13
+#' also be imported from the MSigDB [1] database. The local repository
14
+#' is in the \code{repo} format. When a GEP, defined as a ranked list
15
+#' of genes, is passed to \code{\link{buildPEPs}}, the stored database
16
+#' of pathways is used to convert the GEP to a PEP and permanently
17
+#' store the latter.
18 18
 #'
19 19
 #' One type of analysis that can be performed on PEPs and that is
20 20
 #' directly supported by \code{gep2pep} is the Drug-Set Enrichment
21
-#' Analysis (DSEA, see reference section). It finds pathways that
22
-#' are consistently dysregulated by a set of drugs, as opposed to a
23
-#' background of other drugs. Of course PEPs may refer to
24
-#' non-pharmacological perturbagens (genetic perturbations, disease
25
-#' states, etc.) for analogous analyses. See \code{\link{PertSEA}}
26
-#' function.
21
+#' Analysis (DSEA [2]). It finds pathways that are consistently
22
+#' dysregulated by a set of drugs, as opposed to a background of other
23
+#' drugs. Of course PEPs may refer to non-pharmacological perturbagens
24
+#' (genetic perturbations, disease states, etc.) for analogous
25
+#' analyses. See \code{\link{PertSEA}} function.
27 26
 #'
28 27
 #' A complementary approach is that of finding perturbagens that
29 28
 #' consistently dysregulate a set of pathways. This is the
30 29
 #' pathway-based version of the Gene Set Enrichment Analysis
31
-#' (GSEA). See \code{\link{PathSEA}}.
32
-#'
30
+#' (GSEA). As an application example, this approach can be used to
31
+#' find drugs mimicking the dysregulation of a gene by looking for
32
+#' drugs dysregulating pathways involving the gene (this has been
33
+#' published as the \code{gene2drug} tool [3]). See
34
+#' \code{\link{PathSEA}}.
35
+#'
36
+#' Both DSEA and gene2drug analyses can be performed using
37
+#' preprocessed data from
38
+#' \url{http://dsea.tigem.it/downloads.php}. The data include
39
+#' Connectivity Map GEPs converted to PEPs in the form of a
40
+#' \code{gep2pep} repository.
41
+#' 
33 42
 #' Naming conventions:
34 43
 #'
35 44
 #' \itemize{
... ...
@@ -60,10 +69,20 @@
60 69
 #'   package. It is implemented in \code{repo} format.}
61 70
 #'
62 71
 #' }
63
-#' @references Napolitano F. et al, Drug-set enrichment analysis: a
64
-#'     novel tool to investigate drug mode of action. Bioinformatics
65
-#'     32, 235-241 (2016).
66
-#' 
72
+#' @references 
73
+#'
74
+#' [1] Subramanian A. et al. Gene set enrichment analysis: A
75
+#'     knowledge-based approach for interpreting genome-wide
76
+#'     expression profiles. PNAS 102, 15545–15550 (2005).
77
+#'
78
+#' [2] Napolitano F. et al, Drug-set enrichment analysis: a novel tool
79
+#'     to investigate drug mode of action. Bioinformatics 32, 235-241
80
+#'     (2016).
81
+#'
82
+#' [3] Napolitano F. et al, gene2drug: a Computational Tool for
83
+#'     Pathway-based Rational Drug Repositioning, bioRxiv 192005; doi:
84
+#'     https://doi.org/10.1101/192005
85
+#'
67 86
 #' @docType package
68 87
 #' @name gep2pep-package
69 88
 #' @author Francesco Napolitano \email{franapoli@@gmail.com}
... ...
@@ -189,6 +208,7 @@ importMSigDB.xml <- function(fname) {
189 208
 #' Check both repository data consistency (see \code{repo_check} from
190 209
 #' the \code{repo} package) and specific gep2pep data consistency.
191 210
 #' @inheritParams dummyFunction
211
+#' @return Nothing.
192 212
 #' @examples
193 213
 #' db <- readRDS(system.file("testgmd.RDS", package="gep2pep"))
194 214
 #' repo_path <- file.path(tempdir(), "gep2pepTemp")
... ...
@@ -216,17 +236,17 @@ checkRepository <- function(rp) {
216 236
     
217 237
     off <- setdiff(names(perts), dbs)
218 238
     if(length(off>0)) {
219
-        say("The following collections are in perturbagens",
220
-            "list but not in repository collections:", "warning",
221
-            off)
239
+        say(paste("The following collections are in perturbagens",
240
+                  "list but not in repository collections:"),
241
+            "warning", off)
222 242
         problems <- TRUE
223 243
     }
224 244
 
225 245
     off <- setdiff(names(perts), dbs)
226 246
     if(length(off>0)) {
227
-        say("The following collections are in repository",
228
-            "collections but not in perturbagens list:", "warning",
229
-            off)
247
+        say(paste("The following collections are in repository",
248
+                  "collections but not in perturbagens list:"),
249
+            "warning", off)
230 250
         problems <- TRUE
231 251
     }
232 252
 
... ...
@@ -235,9 +255,9 @@ checkRepository <- function(rp) {
235 255
 
236 256
     off <- setdiff(pepitems, dbs)
237 257
     if(length(off>0)) {
238
-        say("The following collections have PEPs but not",
239
-            "pathways in the repository:", "warning",
240
-            off)
258
+        say(paste("The following collections have PEPs but not",
259
+                  "pathways in the repository:"),
260
+                  "warning", off)
241 261
         problems <- TRUE
242 262
     }
243 263
 
... ...
@@ -255,9 +275,9 @@ checkRepository <- function(rp) {
255 275
                 peps <- rp$get(dbs[i])
256 276
 
257 277
                 if(!identical(colnames(peps$ES), perts[[dbs[i]]])) {
258
-                    say(paste("Column names in the PEP matrix differ from those",
259
-                              "in the perturbagens repository item: this is a",
260
-                              "serious inconsistency!"),
278
+                    say(paste("Column names in the PEP matrix differ from",
279
+                              "those in the perturbagens repository item:",
280
+                              "this is a serious inconsistency!"),
261 281
                         "warning")
262 282
                     problems <- TRUE
263 283
                 }
... ...
@@ -897,7 +917,7 @@ PathSEA <- function(rp_peps, pathways, bgsets="all", collections="all",
897 917
     pathways <- pwList2pwStruct(pathways)
898 918
 
899 919
     for(i in 1:length(pathways))
900
-        if(!rp$has(names(pathways)[i]))
920
+        if(!rp_peps$has(names(pathways)[i]))
901 921
             say("Cold not find PEPs: ", "error", names(pathways)[i])
902 922
 
903 923
     if(length(bgsets)==1 && bgsets != "all") {
... ...
@@ -911,10 +931,10 @@ PathSEA <- function(rp_peps, pathways, bgsets="all", collections="all",
911 931
             say(paste("There is at least one selected collections for which",
912 932
                       "no pathway has been provided"), "warning")
913 933
         
914
-        offcolls <- setdiff(collections, getCollections(rp_peps))
934
+        offcols <- setdiff(collections, getCollections(rp_peps))
915 935
         if(length(offcols) > 0)
916 936
             say("The following collections are not in the repository:",
917
-                "error", offcolls)
937
+                "error", offcols)
918 938
     }
919 939
             
920 940
     collections <- intersect(names(pathways),
... ...
@@ -1095,8 +1115,8 @@ storePEPs <- function(rp, db_id, peps) {
1095 1115
         curmat[["PV"]][, oldpeps] <- peps$PV[, oldpeps]
1096 1116
 
1097 1117
         ## adding new PEPs
1098
-        peps$ES <- cbind(curmat$ES, peps$ES[, newpeps, drop=F])
1099
-        peps$PV <- cbind(curmat$PV, peps$PV[, newpeps, drop=F])
1118
+        peps$ES <- cbind(curmat$ES, peps$ES[, newpeps, drop=FALSE])
1119
+        peps$PV <- cbind(curmat$PV, peps$PV[, newpeps, drop=FALSE])
1100 1120
     }
1101 1121
 
1102 1122
     
... ...
@@ -1315,6 +1335,6 @@ checkSets <- function(rp, sets) {
1315 1335
         off <- setdiff(sub, names(coll))
1316 1336
         if(length(off) > 0)
1317 1337
             say(paste0("The following pathways could not be found ",
1318
-                      "in collection ", ucoll_ids[i], ": "), "error", off)            
1338
+                      "in collection ", ucoll_ids[i], ": "), "error", off)
1319 1339
     }            
1320 1340
 }
... ...
@@ -88,4 +88,3 @@ psea$PathSEA$C3_TFT
88 88
 unlink(repo_path, TRUE)
89 89
 
90 90
 }
91
-
... ...
@@ -99,4 +99,3 @@ Napolitano F. et al, Drug-set enrichment analysis: a
99 99
     novel tool to investigate drug mode of action. Bioinformatics
100 100
     32, 235-241 (2016).
101 101
 }
102
-
... ...
@@ -85,4 +85,3 @@ unlink(repo_path, TRUE)
85 85
 \seealso{
86 86
 buildPEPs
87 87
 }
88
-
... ...
@@ -79,4 +79,3 @@ unlink(repo_path, TRUE)
79 79
 \seealso{
80 80
 buildPEPs
81 81
 }
82
-
... ...
@@ -23,4 +23,3 @@ Nothing
23 23
 \description{
24 24
 Dummy function for parameter inheritance
25 25
 }
26
-
... ...
@@ -42,4 +42,3 @@ unlink(repo_path, TRUE)
42 42
 \seealso{
43 43
 PertSEA, PathSEA
44 44
 }
45
-
... ...
@@ -38,4 +38,3 @@ unlink(repo_path, TRUE)
38 38
 \seealso{
39 39
 createRepository, PathSEA
40 40
 }
41
-
... ...
@@ -2,8 +2,8 @@
2 2
 % Please edit documentation in R/gep2pep.R
3 3
 \docType{package}
4 4
 \name{gep2pep-package}
5
-\alias{gep2pep}
6 5
 \alias{gep2pep-package}
6
+\alias{gep2pep}
7 7
 \title{gep2pep: creation and analysis of Pathway Expression Profiles}
8 8
 \description{
9 9
 Pathway Expression Profiles (PEPs) are based on the collective
... ...
@@ -14,25 +14,34 @@ and performs enrichment analysis of pathways or perturbagens.
14 14
 }
15 15
 \details{
16 16
 \code{gep2pep} creates a local repository of gene sets, which can
17
-also be imported from the MSigDB database. The local repository is
18
-in the \code{repo} format. When a GEP, defined as a ranked list of
19
-genes, is passed to \code{\link{buildPEPs}}, the stored database of
20
-pathways is used to convert the GEP to a PEP and permanently store
21
-the latter.
17
+also be imported from the MSigDB [1] database. The local repository
18
+is in the \code{repo} format. When a GEP, defined as a ranked list
19
+of genes, is passed to \code{\link{buildPEPs}}, the stored database
20
+of pathways is used to convert the GEP to a PEP and permanently
21
+store the latter.
22 22
 
23 23
 One type of analysis that can be performed on PEPs and that is
24 24
 directly supported by \code{gep2pep} is the Drug-Set Enrichment
25
-Analysis (DSEA, see reference section). It finds pathways that
26
-are consistently dysregulated by a set of drugs, as opposed to a
27
-background of other drugs. Of course PEPs may refer to
28
-non-pharmacological perturbagens (genetic perturbations, disease
29
-states, etc.) for analogous analyses. See \code{\link{PertSEA}}
30
-function.
25
+Analysis (DSEA [2]). It finds pathways that are consistently
26
+dysregulated by a set of drugs, as opposed to a background of other
27
+drugs. Of course PEPs may refer to non-pharmacological perturbagens
28
+(genetic perturbations, disease states, etc.) for analogous
29
+analyses. See \code{\link{PertSEA}} function.
31 30
 
32 31
 A complementary approach is that of finding perturbagens that
33 32
 consistently dysregulate a set of pathways. This is the
34 33
 pathway-based version of the Gene Set Enrichment Analysis
35
-(GSEA). See \code{\link{PathSEA}}.
34
+(GSEA). As an application example, this approach can be used to
35
+find drugs mimicking the dysregulation of a gene by looking for
36
+drugs dysregulating pathways involving the gene (this has been
37
+published as the \code{gene2drug} tool [3]). See
38
+\code{\link{PathSEA}}.
39
+
40
+Both DSEA and gene2drug analyses can be performed using
41
+preprocessed data from
42
+\url{http://dsea.tigem.it/downloads.php}. The data include
43
+Connectivity Map GEPs converted to PEPs in the form of a
44
+\code{gep2pep} repository.
36 45
 
37 46
 Naming conventions:
38 47
 
... ...
@@ -65,12 +74,19 @@ Naming conventions:
65 74
 
66 75
 }
67 76
 }
77
+\references{
78
+[1] Subramanian A. et al. Gene set enrichment analysis: A
79
+    knowledge-based approach for interpreting genome-wide
80
+    expression profiles. PNAS 102, 15545–15550 (2005).
81
+
82
+[2] Napolitano F. et al, Drug-set enrichment analysis: a novel tool
83
+    to investigate drug mode of action. Bioinformatics 32, 235-241
84
+    (2016).
85
+
86
+[3] Napolitano F. et al, gene2drug: a Computational Tool for
87
+    Pathway-based Rational Drug Repositioning, bioRxiv 192005; doi:
88
+    https://doi.org/10.1101/192005
89
+}
68 90
 \author{
69 91
 Francesco Napolitano \email{franapoli@gmail.com}
70 92
 }
71
-\references{
72
-Napolitano F. et al, Drug-set enrichment analysis: a
73
-    novel tool to investigate drug mode of action. Bioinformatics
74
-    32, 235-241 (2016).
75
-}
76
-
... ...
@@ -42,4 +42,3 @@ getCollections(rp)
42 42
 unlink(repo_path, TRUE)
43 43
 
44 44
 }
45
-
... ...
@@ -69,4 +69,3 @@ str(db_sample[[1]], nchar.max=20)
69 69
 \references{
70 70
 \url{http://software.broadinstitute.org/gsea/downloads.jsp}
71 71
 }
72
-
... ...
@@ -35,4 +35,3 @@ length(db)
35 35
 \seealso{
36 36
 importMSigDB.xml
37 37
 }
38
-
... ...
@@ -42,4 +42,3 @@ unlink(repo_path, TRUE)
42 42
 \seealso{
43 43
 createRepository
44 44
 }
45
-