# HG changeset patch # User iuc # Date 1571144636 14400 # Node ID f0de368eabca11860b28d25893442d2a1db1dcb7 # Parent a8aa294401bec3236249d36fef07117cac80142a "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d" diff -r a8aa294401be -r f0de368eabca dropletutils.xml --- a/dropletutils.xml Fri Sep 06 10:56:16 2019 -0400 +++ b/dropletutils.xml Tue Oct 15 09:03:56 2019 -0400 @@ -3,15 +3,15 @@ Utilities for handling droplet-based single-cell RNA-seq data 1.2.1 - 3 + 4 tenx.input tenx.output + - diff -r a8aa294401be -r f0de368eabca scripts/dropletutils.Rscript --- a/scripts/dropletutils.Rscript Fri Sep 06 10:56:16 2019 -0400 +++ b/scripts/dropletutils.Rscript Tue Oct 15 09:03:56 2019 -0400 @@ -19,19 +19,35 @@ write.table(as.matrix(obj), file=fileout, col.names=NA, sep='\t', quote=FALSE) } -writeOut <- function(counts, fileout, typeout){ +determineGeneIDs <- function(object){ + if (!is.null(rowData(object)$Symbol)){ + return(rowData(object)$Symbol) + } + return(rownames(object)) +} + +getCounts <- function(object){ + return(Matrix(counts(object), sparse=TRUE)) +} + +writeOut <- function(object, fileout, typeout){ if (typeout == "tsv"){ - writeTSV(fileout, counts) + writeTSV(fileout, getCounts(object)) } else if (typeout == "h5ad"){ - write10xCounts(fileout, counts, type="HDF5", overwrite=TRUE) + write10xCounts(fileout, getCounts(object), + type="HDF5", + gene.symbol=determineGeneIDs(object), + overwrite=TRUE) } else if (typeout == "directory"){ - write10xCounts(fileout, counts, type="sparse", overwrite=TRUE) + write10xCounts(fileout, getCounts(object), + type="sparse", + gene.symbol=determineGeneIDs(object), + overwrite=TRUE) } } - read10xFiles <- function(filein, typein){ sce <- NULL if (typein == "tsv"){ @@ -92,7 +108,7 @@ called[is.na(called)] <- FALSE # replace NA's with FALSE sce.filtered <- sce[,called] - writeOut(counts(sce.filtered), files$out, out.type) + writeOut(sce.filtered, files$out, out.type) message(paste("Cells:", sum(na.omit(e.out$is.Cell)))) message(paste("Cells and Limited:", sum(na.omit(e.out$is.CellAndLimited)))) @@ -108,7 +124,7 @@ # Filtered sce.filtered <- sce[,called] - writeOut(Matrix(counts(sce.filtered),sparse=TRUE), files$out, out.type) + writeOut(sce.filtered, files$out, out.type) message(paste("Cells:", sum(called))) }