Mercurial > repos > iuc > dropletutils
comparison scripts/dropletutils.Rscript @ 5:cdf4443d5625 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ea9a67b5711b53fb911a0c50b6b49eb9db2366a7"
author | iuc |
---|---|
date | Wed, 29 Jan 2020 15:07:38 -0500 |
parents | f0de368eabca |
children | 8855361fcfc5 |
comparison
equal
deleted
inserted
replaced
4:1797cbe967d1 | 5:cdf4443d5625 |
---|---|
32 | 32 |
33 writeOut <- function(object, fileout, typeout){ | 33 writeOut <- function(object, fileout, typeout){ |
34 if (typeout == "tsv"){ | 34 if (typeout == "tsv"){ |
35 writeTSV(fileout, getCounts(object)) | 35 writeTSV(fileout, getCounts(object)) |
36 } | 36 } |
37 else if (typeout == "h5ad"){ | 37 else if (typeout == "h5"){ |
38 write10xCounts(fileout, getCounts(object), | 38 write10xCounts(fileout, getCounts(object), |
39 type="HDF5", | 39 type="HDF5", |
40 gene.symbol=determineGeneIDs(object), | 40 gene.symbol=determineGeneIDs(object), |
41 overwrite=TRUE) | 41 overwrite=TRUE) |
42 } | 42 } |
53 if (typein == "tsv"){ | 53 if (typein == "tsv"){ |
54 ## Exploding memory problems occured here | 54 ## Exploding memory problems occured here |
55 ## - solution is to use the readSparseCounts function from scater | 55 ## - solution is to use the readSparseCounts function from scater |
56 sce <- SingleCellExperiment(assays = list(counts = readSparseCounts(filein))) | 56 sce <- SingleCellExperiment(assays = list(counts = readSparseCounts(filein))) |
57 } | 57 } |
58 else if (typein == "h5ad"){ | 58 else if (typein == "h5"){ |
59 sce <- read10xCounts(filein, col.names=T, type="HDF5") # use barcodes.tsv as column names | 59 sce <- read10xCounts(filein, col.names=T, type="HDF5") # use barcodes.tsv as column names |
60 } | 60 } |
61 else if (typein == "directory"){ | 61 else if (typein == "directory"){ |
62 sce <- read10xCounts(filein, col.names=T, type="sparse") | 62 sce <- read10xCounts(filein, col.names=T, type="sparse") |
63 } | 63 } |
67 | 67 |
68 | 68 |
69 ## Methods | 69 ## Methods |
70 | 70 |
71 | 71 |
72 doEmptyDrops <- function(files, eparams, in.type="directory", out.type="h5ad", fdr_threshold = 0.01){ | 72 doEmptyDrops <- function(files, eparams, in.type="directory", out.type="h5", fdr_threshold = 0.01){ |
73 sce <- read10xFiles(files$infile, in.type) | 73 sce <- read10xFiles(files$infile, in.type) |
74 | 74 |
75 eparams$... <- NULL ## hack | 75 eparams$... <- NULL ## hack |
76 eparams$m = Matrix(counts(sce), sparse=TRUE) | 76 eparams$m = Matrix(counts(sce), sparse=TRUE) |
77 | 77 |
113 message(paste("Cells:", sum(na.omit(e.out$is.Cell)))) | 113 message(paste("Cells:", sum(na.omit(e.out$is.Cell)))) |
114 message(paste("Cells and Limited:", sum(na.omit(e.out$is.CellAndLimited)))) | 114 message(paste("Cells and Limited:", sum(na.omit(e.out$is.CellAndLimited)))) |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 doDefaultDrops <- function(files, dparams, in.type="directory", out.type="h5ad"){ | 118 doDefaultDrops <- function(files, dparams, in.type="directory", out.type="h5"){ |
119 sce <- read10xFiles(files$infile, in.type) | 119 sce <- read10xFiles(files$infile, in.type) |
120 | 120 |
121 dparams$m = counts(sce) | 121 dparams$m = counts(sce) |
122 called <- do.call(defaultDrops, c(dparams)) | 122 called <- do.call(defaultDrops, c(dparams)) |
123 | 123 |