HelenaLC/muscat

aggregateData returns all zero when there is only 1 sample_id

Closed this issue · 1 comments

When running:

pb= aggregateData(pbmc.sce,
                    assay = "counts", fun = "sum",
                    by = c("cluster_id", "sample_id"),
                    BPPARAM = MulticoreParam(workers=2)
                   )

If there is only 1 sample_id in a cluster_id, the final pb object will contain zeros for all sample_ids for that cluster_id.
Changing

ys <- map(is, ~assay(y)[, .])

To
ys <- map(is, ~assay(y)[, ., drop=F])
should resolve the issue.

Thanks for this! Should be fixed on the devel branch as well as on Bioc devel within the next couple days.