Browse code

resync with latest changes to HDF5Array package

Hervé Pagès authored on 13/12/2018 20:18:12
Showing5 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: bsseq
2
-Version: 1.19.0
2
+Version: 1.19.1
3 3
 Encoding: UTF-8
4 4
 Title: Analyze, manage and store bisulfite sequencing data
5 5
 Description: A collection of tools for analyzing and visualizing bisulfite
... ...
@@ -34,7 +34,7 @@ Imports:
34 34
     BSgenome,
35 35
     Biostrings,
36 36
     utils,
37
-    HDF5Array,
37
+    HDF5Array (>= 1.11.9),
38 38
     rhdf5
39 39
 Suggests:
40 40
     testthat,
... ...
@@ -326,7 +326,7 @@ BSmooth <- function(BSseq,
326 326
         #       HDF5Array::saveHDF5SummarizedExperiment().
327 327
         dir <- dirname(h5_path)
328 328
         x <- BSseq
329
-        x@assays <- HDF5Array:::.shorten_h5_paths(x@assays)
329
+        x@assays <- HDF5Array:::.shorten_assay2h5_links(x@assays)
330 330
         saveRDS(x, file = file.path(dir, "se.rds"))
331 331
     }
332 332
     BSseq
... ...
@@ -250,7 +250,11 @@ strandCollapse <- function(BSseq, shift = TRUE, BPPARAM = bpparam(),
250 250
         if (!isTRUEorFALSE(replace)) {
251 251
             stop("'replace' must be TRUE or FALSE")
252 252
         }
253
-        HDF5Array:::.create_dir(dir = dir, replace = replace)
253
+        if (!dir.exists(dir)) {
254
+            HDF5Array:::.create_dir(dir)
255
+        } else {
256
+            HDF5Array:::.replace_dir(dir, replace)
257
+        }
254 258
         h5_path <- file.path(dir, "assays.h5")
255 259
     } else if (identical(BACKEND, NULL)) {
256 260
         h5_path <- NULL
... ...
@@ -305,7 +309,7 @@ strandCollapse <- function(BSseq, shift = TRUE, BPPARAM = bpparam(),
305 309
         # NOTE: Save BSseq object; mimicing
306 310
         #       HDF5Array::saveHDF5SummarizedExperiment().
307 311
         x <- bsseq
308
-        x@assays <- HDF5Array:::.shorten_h5_paths(x@assays)
312
+        x@assays <- HDF5Array:::.shorten_assay2h5_links(x@assays)
309 313
         saveRDS(x, file = file.path(dir, "se.rds"))
310 314
     }
311 315
     bsseq
... ...
@@ -86,7 +86,11 @@ collapseBSseq <- function(BSseq, group, BPPARAM = bpparam(),
86 86
         if (!isTRUEorFALSE(replace)) {
87 87
             stop("'replace' must be TRUE or FALSE")
88 88
         }
89
-        HDF5Array:::.create_dir(dir = dir, replace = replace)
89
+        if (!dir.exists(dir)) {
90
+            HDF5Array:::.create_dir(dir)
91
+        } else {
92
+            HDF5Array:::.replace_dir(dir, replace)
93
+        }
90 94
         h5_path <- file.path(dir, "assays.h5")
91 95
     } else if (identical(BACKEND, NULL)) {
92 96
         h5_path <- NULL
... ...
@@ -138,7 +142,7 @@ collapseBSseq <- function(BSseq, group, BPPARAM = bpparam(),
138 142
         # NOTE: Save BSseq object; mimicing
139 143
         #       HDF5Array::saveHDF5SummarizedExperiment().
140 144
         x <- bsseq
141
-        x@assays <- HDF5Array:::.shorten_h5_paths(x@assays)
145
+        x@assays <- HDF5Array:::.shorten_assay2h5_links(x@assays)
142 146
         saveRDS(x, file = file.path(dir, "se.rds"))
143 147
     }
144 148
     bsseq
... ...
@@ -422,7 +422,11 @@ read.bismark <- function(files,
422 422
         if (!isTRUEorFALSE(replace)) {
423 423
             stop("'replace' must be TRUE or FALSE")
424 424
         }
425
-        HDF5Array:::.create_dir(dir = dir, replace = replace)
425
+        if (!dir.exists(dir)) {
426
+            HDF5Array:::.create_dir(dir)
427
+        } else {
428
+            HDF5Array:::.replace_dir(dir, replace)
429
+        }
426 430
     }
427 431
     # Set verbosity used by internal functions.
428 432
     subverbose <- as.logical(max(verbose - 1L, 0L))
... ...
@@ -533,7 +537,7 @@ read.bismark <- function(files,
533 537
         # NOTE: Save BSseq object; mimicing
534 538
         #       HDF5Array::saveHDF5SummarizedExperiment().
535 539
         x <- bsseq
536
-        x@assays <- HDF5Array:::.shorten_h5_paths(x@assays)
540
+        x@assays <- HDF5Array:::.shorten_assay2h5_links(x@assays)
537 541
         saveRDS(x, file = file.path(dir, "se.rds"))
538 542
     }
539 543
     bsseq