From 7724df738efcbcfef5e69fb93075a98e19329909 Mon Sep 17 00:00:00 2001
From: Luke Zappia <lazappi@users.noreply.github.com>
Date: Wed, 13 Sep 2017 11:45:05 +1000
Subject: [PATCH] Fix error in simulating batches

Problem using factor to index matrix
---
 R/splat-simulate.R | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/R/splat-simulate.R b/R/splat-simulate.R
index 38bbf7d..6684d23 100644
--- a/R/splat-simulate.R
+++ b/R/splat-simulate.R
@@ -356,8 +356,8 @@ splatSimBatchCellMeans <- function(sim, params) {
         batch.names <- unique(batches)
 
         batch.facs.gene <- rowData(sim)[, paste0("BatchFac", batch.names)]
-        batch.facs.cell <- as.matrix(batch.facs.gene[, factor(batches)])
-
+        batch.facs.cell <- as.matrix(batch.facs.gene[,
+                                                  as.numeric(factor(batches))])
     } else {
         nCells <- getParam(params, "nCells")
         nGenes <- getParam(params, "nGenes")
-- 
GitLab