Browse code

fix issues with KL_compare

Shana White authored on 27/09/2017 17:21:59
Showing 2 changed files

... ...
@@ -19,6 +19,7 @@
19 19
 #' with 'stacked' nodes that the user can manipulate when multiple nodes are 
20 20
 #' mapped to one location
21 21
 #' @param graph_title An optional user-specified graph title
22
+#' @param tidy_edge A logical indicator; must be set to FALSE for expanded edges
22 23
 #' @param get_data A logical indicator; if set to true, will return the 
23 24
 #' 'expanded' edge information for the specified pathway
24 25
 #' @param convert_KEGG_IDs A logical indicator; if set to TRUE KEGG 
... ...
@@ -43,7 +44,7 @@ KL_compare <-
43 44
              get_data = FALSE,
44 45
              convert_KEGG_IDs = TRUE,
45 46
              graph_title = "default",
46
-             tidy_edges = TRUE,
47
+             tidy_edge = TRUE,
47 48
              layered_nodes = FALSE){
48 49
         cell_lines <- c("A375","A549","ASC","HA1E","HCC515","HEK293T","HEKTE",
49 50
                         "HEPG2","HT29","MCF7","NCIH716","NPC","PC3","SHSY5Y",
... ...
@@ -95,7 +96,8 @@ KL_compare <-
95 96
         if(expanded_edges$type[1] == "dummy"){
96 97
             graph_title <- paste0("Pathway = ", pathwayid, ":", 
97 98
                                   KGML@pathwayInfo@title,
98
-                                  "Cell-Line: ", cell_line, 
99
+                                  "Cell-Lines: ", 
100
+                                  paste0(cell_line1,",", cell_line2), 
99 101
                                   "  *No Edges in Pathway")
100 102
         }
101 103
         
... ...
@@ -104,8 +106,9 @@ KL_compare <-
104 106
             edge_map <- edge_mapping_info(expanded_edges)
105 107
             if (graph_title == "default"){
106 108
                 graph_title <- paste0("Pathway = ", pathwayid, ":", 
107
-                                      KGML@pathwayInfo@title, "Cell-Line: ", 
108
-                                      cell_line,  "  *No Edges in Data")
109
+                                      KGML@pathwayInfo@title, "Cell-Lines: ", 
110
+                                      paste0(cell_line1,",", cell_line2), 
111
+                                       "  *No Edges in Data")
109 112
             }
110 113
             warning("All documented edges are of type 'maplink'; 
111 114
                     Overlap data cannot be mapped to selected pathway")
... ...
@@ -157,7 +160,8 @@ KL_compare <-
157 160
                     edges_compare$summary_score[i] <- exp(abs(edges_compare$test[i]))
158 161
                     
159 162
                     
160
-                    if (edges_compare$test[i] <= qnorm(0.1) | edges_compare$test[i] >= qnorm(0.9)){
163
+                    if (edges_compare$test[i] <= stats::qnorm(0.1) | 
164
+                        edges_compare$test[i] >= stats::qnorm(0.9)){
161 165
                         edges_compare$significant[i] <- 1
162 166
                     }
163 167
                     else {
... ...
@@ -205,7 +209,7 @@ KL_compare <-
205 209
                     }
206 210
                 }
207 211
             }
208
-            if (tidy_edges == TRUE) {
212
+            if (tidy_edge == TRUE) {
209 213
                 edge_IDs <- seq(min(edge_map$edgeID), max(edge_map$edgeID))
210 214
                 for (i in edge_IDs){
211 215
                     edge_map <- tidy_edge(edges = edge_map, 
... ...
@@ -8,7 +8,7 @@ KL_compare(pathwayid, cell_line1 = NA, cell_line2 = NA,
8 8
   refine_by_cell_line = TRUE, add_L1000_edge_data = TRUE,
9 9
   significance_markup = TRUE, data_type = "100_full", pert_time = 96,
10 10
   only_mapped = TRUE, get_data = FALSE, convert_KEGG_IDs = TRUE,
11
-  graph_title = "default", tidy_edges = TRUE, layered_nodes = FALSE)
11
+  graph_title = "default", tidy_edge = TRUE, layered_nodes = FALSE)
12 12
 }
13 13
 \arguments{
14 14
 \item{pathwayid}{A KEGG pathway ID of the form "hsa12345" 
... ...
@@ -43,6 +43,8 @@ compounds will remain labeled via KEGG codes (do not need KEGGREST)}
43 43
 
44 44
 \item{graph_title}{An optional user-specified graph title}
45 45
 
46
+\item{tidy_edge}{A logical indicator; must be set to FALSE for expanded edges}
47
+
46 48
 \item{layered_nodes}{A logical indicator; if set to TRUE will create a graph 
47 49
 with 'stacked' nodes that the user can manipulate when multiple nodes are 
48 50
 mapped to one location}