HelenaLC / muscat

Multi-sample multi-group scRNA-seq analysis tools
160 stars 32 forks source link

aggregateData returns all zero when there is only 1 sample_id #124

Closed jsialar closed 1 year ago

jsialar commented 1 year ago

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 https://github.com/HelenaLC/muscat/blob/10cd3262bd5bc45930d62dc8f7d8b97629c3bbe4/R/utils-pbDS.R#L21 To ys <- map(is, ~assay(y)[, ., drop=F]) should resolve the issue.

HelenaLC commented 1 year ago

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