Browse code

Fix issue #141

Yihang Xin authored on 15/06/2021 07:14:14 • Alexander Pico committed on 16/06/2021 01:27:33
Showing 5 changed files

... ...
@@ -321,9 +321,7 @@ exportFilters<-function(filename = "filters.json", base.url = .defaultBaseUrl, o
321 321
 #' }
322 322
 #' @export
323 323
 importFilters<-function(filename , base.url = .defaultBaseUrl){
324
-    if(!isAbsolutePath(filename))
325
-        filename = getAbsSandboxPath(filename)
326
-    
324
+    filename = getAbsSandboxPath(filename)
327 325
     res <- commandsGET(paste0('filter import file="',filename,'"'),base.url)
328 326
     Sys.sleep(get(".CATCHUP_FILTER_SECS",envir = RCy3env)) ## NOTE: TEMPORARY SLEEP "FIX" 
329 327
     return(res)
... ...
@@ -1053,7 +1053,7 @@ createNetworkFromDataFrames <-
1053 1053
 importNetworkFromFile <- function(file=NULL, base.url=.defaultBaseUrl){
1054 1054
     if(is.null(file))
1055 1055
         file <- system.file("extdata","galFiltered.sif",package="RCy3")
1056
-    else if(!isAbsolutePath(file))
1056
+    else 
1057 1057
         file = getAbsSandboxPath(file)
1058 1058
     
1059 1059
     res <- commandsPOST(paste('network load file file',file,sep = "="))
... ...
@@ -293,9 +293,10 @@ sandboxRemoveFile <- function(fileName, sandboxName=NULL, base.url=.defaultBaseU
293 293
         command <- paste(command, sprintf("sandboxName=%s", sandboxName))
294 294
     } else if(!is.null(fileName)){
295 295
         if(isAbsolutePath(fileName)){
296
-            fileName <- basename(fileName)
297
-        }
296
+            fileName <- fileName
297
+        } else {
298 298
         fileName <- file.path(sandboxPath, fileName)
299
+        }
299 300
     }
300 301
     if(!is.null(fileName)){
301 302
         command <- paste(command, sprintf("fileName=%s", fileName))
... ...
@@ -107,7 +107,6 @@ saveSession<-function(filename=NULL, base.url=.defaultBaseUrl, overwriteFile=TRU
107 107
             }
108 108
         }
109 109
         fullFilename <- fileInfo[['filePath']]
110
-        
111 110
         commandsPOST(paste0('session save as file="',
112 111
                             fullFilename,'"'), 
113 112
                      base.url=base.url)
... ...
@@ -187,9 +187,7 @@ exportVisualStyles<-function(filename=NULL, type="XML", styles=NULL, base.url=.d
187 187
 #' @seealso exportVisualStyles
188 188
 #' @export
189 189
 importVisualStyles<-function(filename="styles.xml", base.url=.defaultBaseUrl){
190
-    if(!isAbsolutePath(filename))
191
-        filename = getAbsSandboxPath(filename)
192
-    
190
+    filename = getAbsSandboxPath(filename)
193 191
     cmd.string <- paste0('vizmap load file',' file="',filename,'"')
194 192
     commandsPOST(cmd.string, base.url = base.url)
195 193
     }