From 7542ff1c9811af5f7df8b5cfb45951b60c6d10ff Mon Sep 17 00:00:00 2001 From: Paul Hoffman Date: Thu, 9 Nov 2017 13:27:23 -0500 Subject: [PATCH] Fixed issues with chunking and iterating --- R/loom.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/R/loom.R b/R/loom.R index 2244346..8bbbca9 100644 --- a/R/loom.R +++ b/R/loom.R @@ -414,8 +414,8 @@ loom <- R6Class( chunk.data <- if (dataset.matrix) { switch( EXPR = MARGIN, - '1' = self[[dataset.use]][, chunk.indices], - '2' = self[[dataset.use]][chunk.indices, ] + '1' = self[[dataset.use]][, chunk.indices], # Chunk genes + '2' = self[[dataset.use]][chunk.indices, ] # Chunk cells ) } else { self[[private$iter.datset]][chunk.indices] @@ -522,8 +522,8 @@ loom <- R6Class( chunk.data <- if (dataset.matrix) { switch( EXPR = MARGIN, - '1' = self[[dataset.use]][chunk.indices, ], - '2' = self[[dataset.use]][, chunk.indices] + '1' = self[[dataset.use]][, chunk.indices], # Chunk genes + '2' = self[[dataset.use]][chunk.indices, ] # Chunk cells ) } else { self[[dataset.use]][chunk.indices] @@ -645,7 +645,7 @@ loom <- R6Class( } # Ensure the indices provided fit within the range of the dataset index.use[1] <- max(1, index.use[1]) - index.use[2] <- min(index.use[2], self$shape[private$iter.margin]) + index.use[2] <- min(index.use[2], rev(x = self$shape)[private$iter.margin]) # Ensure that index.use[1] is greater than index.use[2] if (index.use[1] > index.use[2]) { stop(paste0( -- 2.23.0