Browse code

Tweak .getBSseqBackends()

Peter Hickey authored on 03/10/2018 11:16:24
Showing1 changed files

... ...
@@ -39,6 +39,7 @@ data.frame2GRanges <- function(df, keepColumns = FALSE, ignoreStrand = FALSE) {
39 39
     }, logical(1L))
40 40
 }
41 41
 
42
+# TODO: The below is a hack, need a more reliable way to do this.
42 43
 .getBSseqBackends <- function(x) {
43 44
     assay_backends <- lapply(assays(x, withDimnames = FALSE), function(assay) {
44 45
         if (is.matrix(assay)) return(NULL)
... ...
@@ -46,14 +47,11 @@ data.frame2GRanges <- function(df, keepColumns = FALSE, ignoreStrand = FALSE) {
46 47
         if (all(vapply(seed_classes, function(x) x == "matrix", logical(1)))) {
47 48
             return(NULL)
48 49
         }
49
-        if (is.list(seed_classes)) {
50
-            seed_packages <- lapply(seed_classes, attr, "package")
51
-        } else {
52
-            seed_packages <- attr(seed_classes, "package")
50
+        backend <- gsub("Seed", "", as.vector(seed_classes))
51
+        if (!identical(backend, "HDF5Array")) {
52
+            stop("Don't know backend of object with seed '", seed_classes, "'.")
53 53
         }
54
-        seed_packages <- unique(seed_packages)
55
-        srb <- supportedRealizationBackends()
56
-        srb[srb[["package"]] == seed_packages, "BACKEND"]
54
+        backend
57 55
     })
58 56
     unique(unlist(assay_backends))
59 57
 }