... | ... |
@@ -421,6 +421,14 @@ setMethod( |
421 | 421 |
if (is.null(batch)) { |
422 | 422 |
batch <- rep("all_cells", nC) |
423 | 423 |
|
424 |
+ # If batch null, bgBatch has to be null |
|
425 |
+ if (!is.null(batchBackground)){ |
|
426 |
+ stop( |
|
427 |
+ "When experiment default to no bacth, background should", |
|
428 |
+ "also default to no batch." |
|
429 |
+ ) |
|
430 |
+ } |
|
431 |
+ |
|
424 | 432 |
if (!is.null(countsBackground)) { |
425 | 433 |
batchBackground <- rep("all_cells", ncol(countsBackground)) |
426 | 434 |
} |
... | ... |
@@ -15,6 +15,7 @@ decontX(x, ...) |
15 | 15 |
batch = NULL, |
16 | 16 |
background = NULL, |
17 | 17 |
bgAssayName = NULL, |
18 |
+ bgBatch = NULL, |
|
18 | 19 |
maxIter = 500, |
19 | 20 |
delta = c(10, 10), |
20 | 21 |
estimateDelta = TRUE, |
... | ... |
@@ -32,6 +33,7 @@ decontX(x, ...) |
32 | 33 |
z = NULL, |
33 | 34 |
batch = NULL, |
34 | 35 |
background = NULL, |
36 |
+ bgBatch = NULL, |
|
35 | 37 |
maxIter = 500, |
36 | 38 |
delta = c(10, 10), |
37 | 39 |
estimateDelta = TRUE, |
... | ... |
@@ -72,15 +74,20 @@ should be considered different batches. Default NULL.} |
72 | 74 |
|
73 | 75 |
\item{background}{A numeric matrix of counts or a |
74 | 76 |
\linkS4class{SingleCellExperiment} with the matrix located in the assay |
75 |
-slot under \code{assayName}. It should have the same structure as \code{x} |
|
76 |
-except it contains the matrix of empty droplets instead of cells. When |
|
77 |
-supplied, empirical distribution of transcripts from these empty droplets |
|
77 |
+slot under \code{assayName}. It should have the same data format as \code{x} |
|
78 |
+except it contains the empty droplets instead of cells. When supplied, |
|
79 |
+empirical distribution of transcripts from these empty droplets |
|
78 | 80 |
will be used as the contamination distribution. Default NULL.} |
79 | 81 |
|
80 | 82 |
\item{bgAssayName}{Character. Name of the assay to use if \code{background} |
81 | 83 |
is a \linkS4class{SingleCellExperiment}. Default to same as |
82 | 84 |
\code{assayName}.} |
83 | 85 |
|
86 |
+\item{bgBatch}{Numeric or character vector. Batch labels for |
|
87 |
+\code{background}. Its unique values should be the same as those in |
|
88 |
+\code{batch}, such that each batch of cells have their corresponding batch |
|
89 |
+of empty droplets as background, pointed by this parameter. Default to NULL.} |
|
90 |
+ |
|
84 | 91 |
\item{maxIter}{Integer. Maximum iterations of the EM algorithm. Default 500.} |
85 | 92 |
|
86 | 93 |
\item{delta}{Numeric Vector of length 2. Concentration parameters for |