Mercurial > repos > iuc > dropletutils
changeset 3:f0de368eabca draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
author | iuc |
---|---|
date | Tue, 15 Oct 2019 09:03:56 -0400 |
parents | a8aa294401be |
children | 1797cbe967d1 |
files | dropletutils.xml scripts/dropletutils.Rscript |
diffstat | 2 files changed, 25 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <description>Utilities for handling droplet-based single-cell RNA-seq data</description> <macros> <token name="@PACKAGE_VERSION@" >1.2.1</token> - <token name="@GALAXY_VERSION@" >3</token> + <token name="@GALAXY_VERSION@" >4</token> <token name="@TXIN@">tenx.input</token> <token name="@TXOUT@">tenx.output</token> <xml name="test_dirin" > <conditional name="tenx_format"> <param name="use" value="directory" /> <param name="input" value="in_matrix.mtx" /> + <param name="input_barcodes" value="in_barcodes.tsv" /> <param name="input_genes" value="in_genes.tsv" /> - <param name="input_barcodes" value="in_barcodes.tsv" /> </conditional> </xml> </macros>
--- 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))) }