Skip to content

Commit

Permalink
Convert sparse to dense for now due to bug in loomexperiment
Browse files Browse the repository at this point in the history
  • Loading branch information
nh3 committed Oct 2, 2019
1 parent 6aa2312 commit 2caaff4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/loom_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ writeExchangeableLoom <- function(sce, filename, main_layer=NULL, return_manifes

manifest <- rbind(attr_manifest, dts_manifest, rdim_manifest, colgraph_manifest, rowgraph_manifest)

# LoomExperiment currently handles sparse matrix incorrectly, so convert to dense for now
for (assay_name in SummarizedExperiment::assayNames(scle)) {
if (class(SummarizedExperiment::assays(scle)[[assay_name]]) == 'dgCMatrix')
SummarizedExperiment::assays(scle)[[assay_name]] <- as.matrix(SummarizedExperiment::assays(scle)[[assay_name]])
}
# Write to loom by LoomExperiment::export
if (file.exists(filename)) file.remove(filename)
suppressWarnings(LoomExperiment::export(
Expand Down

0 comments on commit 2caaff4

Please sign in to comment.