From c6ca65a1c7eac0f606b55cb08c16f2b56da2f564 Mon Sep 17 00:00:00 2001 From: nh3 Date: Wed, 25 Sep 2019 12:48:55 +0100 Subject: [PATCH] Allow loom2sce to save files directly --- DESCRIPTION | 4 ++-- R/functions.R | 8 ++++++-- R/loom_utils.R | 0 3 files changed, 8 insertions(+), 4 deletions(-) mode change 100755 => 100644 R/loom_utils.R diff --git a/DESCRIPTION b/DESCRIPTION index ffc53ff..8d93f4e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,8 +3,8 @@ Type: Package Title: A package to help convert different single-cell data formats to each other Version: 0.0.1 Authors@R: c( - person('Vladimir', 'Kiselev', email='wikiselev@users.noreply.github.com', role='cre'), - person('Ni', 'Huang', email='nh3@users.noreply.github.com', role='aut')) + person('Ni', 'Huang', email='nh3@users.noreply.github.com', role='cre'), + person('Vladimir', 'Kiselev', email='wikiselev@users.noreply.github.com', role='aut')) Description: Convert Seurat, SingleCellExperiment, Loom object to AnnData object Depends: R (>= 3.5.1), diff --git a/R/functions.R b/R/functions.R index ed4c7e7..c272ba4 100644 --- a/R/functions.R +++ b/R/functions.R @@ -102,7 +102,7 @@ sce2anndata <- function( ) if (!is.null(outFile)) - anndata$AnnData$write(adata, outFile, compression = 'gzip') + adata$write(outFile, compression = 'gzip') adata } @@ -140,5 +140,9 @@ sce2loom <- function(obj, outFile, main_layer = NULL, ...) { } loom2sce <- function(inFile, outFile = NULL, main_layer = NULL, ...) { - readExchangeableLoom(inFile, backed = FALSE, ...) + sce <- readExchangeableLoom(inFile, backed = FALSE, ...) + if (!is.null(outFile)) + saveRDS(sce, outFile) + + sce } diff --git a/R/loom_utils.R b/R/loom_utils.R old mode 100755 new mode 100644