While trying to run the following code in R
:
list_of_sce <- list()
# Looping though the UMI_count 'split_factor' columns at a time
split_factor = 500
for(i in seq(1,ncols, split_factor)) {
num_loop = floor(i / split_factor) + 1
idx = ncols
if (i + split_factor < ncols) {
idx = i + split_factor
}
sce <- SingleCellExperiment(list(counts=UMI_count[, i : idx]))
# Normalization of the dataset containing
# heterogenous cell data (different cell types)
clusters <- quickCluster(sce)
sce <- computeSumFactors(sce, cluster=clusters)
list_of_sce[[num_loop]] <- sce
}
I am getting the error:
Error in .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row, :
cells should have non-zero library sizes
There are warnings
, so when I run warnings()
command I see the following:
> warnings()
Warning messages:
1: In .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row, ... :
encountered negative size factor estimates
2: In .computeSumFactors(assay(x, i = assay.type), subset.row =
subset.row, ... :
encountered negative size factor estimates
3:...
...
39:....
I do not understand why is this happening, and how to debug it. Any suggestions would be greatly appreciated.
sce
be inside your loop? $\endgroup$