Browse code

adapting for windows R CMD check

RobTesf authored on 07/03/2024 13:57:57
Showing 3 changed files

... ...
@@ -30,10 +30,10 @@ getInfos <- function(file=NULL, printInfos = TRUE, returnInfos = FALSE) {
30 30
     }else{
31 31
         stop("File is not found!")
32 32
     }
33
-    file_name <- stringr::str_split(file, "/", simplify = TRUE)[
34
-        length(stringr::str_split(file, "/", simplify = TRUE))]
33
+    file_name <- paste0(GetFileName(file), ".", GetFileExtension(file))
35 34
     file_path <- stringr::str_remove(file, paste0(file_name,"$"))
36
-    if (! stringr::str_detect(file_path, "^[\\.]{0,1}/")) {
35
+    if (! stringr::str_detect(file_path, "^[\\.]{0,1}/") && 
36
+    .Platform$OS.type != "windows") {
37 37
         file_path <- paste0("./",file_path)
38 38
     }
39 39
     if(GetFileExtension(file) == "hic"){
... ...
@@ -72,7 +72,13 @@ dir.create(temp.dir)
72 72
 
73 73
 Hic.url <- "https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/7386f953-8da9-47b0-acb2-931cba810544/4DNFIOTPSS3L.hic"
74 74
 HicOutput.pth <- file.path(temp.dir, "Control_HIC.hic")
75
-download.file(Hic.url, HicOutput.pth, method = 'auto', extra = '-k')
75
+HicOutput.pth <- normalizePath(HicOutput.pth)
76
+if(.Platform$OS.type == "windows"){
77
+    download.file(Hic.url, HicOutput.pth, method = 'auto', extra = '-k',mode="wb")
78
+}else{
79
+    download.file(Hic.url, HicOutput.pth, method = 'auto', extra = '-k')
80
+}
81
+
76 82
 ```
77 83
 
78 84
 ## Genomic location and annotation data
... ...
@@ -79,14 +79,27 @@ dir.create(temp.dir)
79 79
 ```{r, eval = TRUE, message = FALSE}
80 80
 Hic.url <- "https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/7386f953-8da9-47b0-acb2-931cba810544/4DNFIOTPSS3L.hic"
81 81
 HicOutput.pth <- file.path(temp.dir, "Control_HIC.hic")
82
-download.file(Hic.url, HicOutput.pth, method = 'auto', extra = '-k')
82
+HicOutput.pth <- normalizePath(HicOutput.pth)
83
+if(.Platform$OS.type == "windows"){
84
+    download.file(Hic.url, HicOutput.pth, method = "auto",
85
+        extra = "-k", mode="wb")
86
+}else{
87
+    download.file(Hic.url, HicOutput.pth, method = "auto", extra = "-k")
88
+}
89
+
83 90
 ```
84 91
 
85 92
 ### Heat shock condition (.mcool File)
86 93
 ```{r, eval = TRUE, message = FALSE}
87 94
 Mcool.url <- "https://4dn-open-data-public.s3.amazonaws.com/fourfront-webprod/wfoutput/4f1479a2-4226-4163-ba99-837f2c8f4ac0/4DNFI8DRD739.mcool"
88 95
 McoolOutput.pth <- file.path(temp.dir, "HeatShock_HIC.mcool")
89
-download.file(Mcool.url, McoolOutput.pth, method = "auto", extra = "-k")
96
+McoolOutput.pth <- normalizePath(McoolOutput.pth)
97
+if(.Platform$OS.type == "windows"){
98
+    download.file(Mcool.url, McoolOutput.pth, method = "auto",
99
+        extra = "-k", mode="wb")
100
+}else{
101
+    download.file(Mcool.url, McoolOutput.pth, method = "auto", extra = "-k")
102
+}
90 103
 ```
91 104
 
92 105
 ## 2 Genomic location and annotation data