Mercurial > repos > iuc > dropletutils
annotate scripts/dropletutils.Rscript @ 7:2c1200fba922 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 0a1586a00f94215b8182423e4b2f34fdf706a47d"
| author | iuc | 
|---|---|
| date | Thu, 07 Jan 2021 19:36:54 +0000 | 
| parents | 8855361fcfc5 | 
| children | a9caad671439 | 
| rev | line source | 
|---|---|
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
1 ## Load in data | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
2 args <- commandArgs(trailingOnly = T) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
3 if (length(args) != 1) { | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
4 stop("Please provide the config file") | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
5 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
6 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
7 suppressWarnings(suppressPackageStartupMessages(require(DropletUtils))) | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
8 suppressWarnings(suppressPackageStartupMessages(require(Matrix))) | 
| 
1
 
cfe1e6c28d95
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 40d4a92c62d75fe931baba8657cde006a26d84cf"
 
iuc 
parents: 
0 
diff
changeset
 | 
9 suppressWarnings(suppressPackageStartupMessages(require(scater))) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
10 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
11 source(args[1]) | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
12 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
13 ## Helper functions | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
14 set_sparse <- function(obj) { | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
15 return(as(obj, "dgCMatrix")) | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
16 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
17 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
18 write_tsv <- function(fileout, obj) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
19 write.table(as.matrix(obj), file = fileout, | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
20 col.names = NA, sep = "\t", quote = FALSE) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
21 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
22 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
23 determine_geneids <- function(object) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
24 if (!is.null(rowData(object)$Symbol)) { | 
| 
3
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
25 return(rowData(object)$Symbol) | 
| 
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
26 } | 
| 
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
27 return(rownames(object)) | 
| 
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
28 } | 
| 
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
29 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
30 get_counts <- function(object) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
31 return(Matrix(counts(object), sparse = TRUE)) | 
| 
3
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
32 } | 
| 
 
f0de368eabca
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit a4cee4cac5097029188d836d5b904b605dbb943d"
 
iuc 
parents: 
2 
diff
changeset
 | 
33 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
34 write_out <- function(object, fileout, typeout) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
35 if (typeout == "tsv") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
36 write_tsv(fileout, get_counts(object)) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
37 } | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
38 else if (typeout == "h5") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
39 write10xCounts(fileout, get_counts(object), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
40 type = "HDF5", | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
41 gene.symbol = determine_geneids(object), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
42 overwrite = TRUE) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
43 } | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
44 else if (typeout == "directory") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
45 write10xCounts(fileout, get_counts(object), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
46 type = "sparse", | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
47 gene.symbol = determine_geneids(object), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
48 overwrite = TRUE) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
49 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
50 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
51 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
52 read_10x_files <- function(filein, typein) { | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
53 sce <- NULL | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
54 if (typein == "tsv") { | 
| 
1
 
cfe1e6c28d95
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 40d4a92c62d75fe931baba8657cde006a26d84cf"
 
iuc 
parents: 
0 
diff
changeset
 | 
55 ## Exploding memory problems occured here | 
| 
 
cfe1e6c28d95
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 40d4a92c62d75fe931baba8657cde006a26d84cf"
 
iuc 
parents: 
0 
diff
changeset
 | 
56 ## - solution is to use the readSparseCounts function from scater | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
57 sce <- SingleCellExperiment(assays = | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
58 list(counts = readSparseCounts(filein))) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
59 } | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
60 else if (typein == "h5") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
61 # use barcodes.tsv as column names | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
62 sce <- read10xCounts(filein, col.names = T, type = "HDF5") | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
63 } | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
64 else if (typein == "directory") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
65 sce <- read10xCounts(filein, col.names = T, type = "sparse") | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
66 } | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
67 counts(sce) <- set_sparse(counts(sce)) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
68 return(sce) | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
69 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
70 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
71 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
72 ## Methods | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
73 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
74 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
75 do_empty_drops <- function(files, eparams, intype = "directory", | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
76 outtype = "h5", fdr_threshold = 0.01) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
77 sce <- read_10x_files(files$infile, intype) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
78 | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
79 eparams$... <- NULL ## hack to remove other parameters from being | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
80 eparams$m <- Matrix(counts(sce), sparse = TRUE) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
81 | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
82 ## Determine sensible lowerbound | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
83 m_stats <- summary(colSums(counts(sce))) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
84 print("Cell Library Size Distribution:") | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
85 print(m_stats) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
86 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
87 if (m_stats["Min."] > eparams$lower) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
88 print(paste0("CAUTION: Min. Lib. Size (", m_stats["Min."] | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
89 , ") < requested lowerbound (", eparams$lower, ")")) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
90 message(paste0("Setting lowerbound to Mean: ", m_stats["Mean"])) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
91 eparams$lower <- m_stats["Mean"] | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
92 } | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
93 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
94 e_out <- do.call(emptyDrops, c(eparams)) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
95 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
96 bar_names <- colnames(sce) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
97 if (length(bar_names) != nrow(e_out)) { | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
98 stop("Length of barcodes and output metrics don't match.") | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
99 } | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
100 e_out <- cbind(bar_names, e_out) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
101 e_out$is_cell <- e_out$FDR <= fdr_threshold | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
102 e_out$is_cellandlimited <- e_out$is_cell & e_out$Limited | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
103 | 
| 
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
104 ## Write to Plot | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
105 e_out$is_cell[is.na(e_out$is_cell)] <- FALSE | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
106 xlim_dat <- e_out[complete.cases(e_out), ]$Total | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
107 | 
| 
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
108 ## Write to table | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
109 write_tsv(files$table, e_out[complete.cases(e_out), ]) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
110 | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
111 png(files$plot) | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
112 plot(e_out$Total, -e_out$LogProb, col = ifelse(e_out$is_cell, | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
113 "red", "black"), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
114 xlab = "Total UMI count", ylab = "-Log Probability", | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
115 xlim = c(min(xlim_dat), max(xlim_dat))) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
116 dev.off() | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
117 | 
| 
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
118 ## Filtered | 
| 
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
119 called <- NULL | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
120 if (fdr_threshold != 0) { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
121 called <- e_out$is_cellandlimited | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
122 } else { | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
123 called <- e_out$is_cell | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
124 } | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
125 called[is.na(called)] <- FALSE # replace NA's with FALSE | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
126 sce_filtered <- sce[, called] | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
127 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
128 write_out(sce_filtered, files$out, outtype) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
129 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
130 message(paste("Cells:", sum(na.omit(e_out$is_cell)))) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
131 message(paste("Cells and Limited:", sum(na.omit(e_out$is_cellandlimited)))) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
132 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
133 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
134 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
135 do_default_drops <- function(files, dparams, | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
136 intype = "directory", outtype = "h5") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
137 sce <- read_10x_files(files$infile, intype) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
138 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
139 dparams$m <- counts(sce) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
140 called <- do.call(defaultDrops, c(dparams)) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
141 | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
142 # Filtered | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
143 sce_filtered <- sce[, called] | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
144 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
145 write_out(sce_filtered, files$out, outtype) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
146 | 
| 
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
147 message(paste("Cells:", sum(called))) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
148 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
149 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
150 do_barcode_rankings <- function(files, bparams, intype = "directory") { | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
151 sce <- read_10x_files(files$infile, intype) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
152 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
153 bparams$... <- NULL ## hack | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
154 bparams$m <- counts(sce) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
155 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
156 brout <- do.call(barcodeRanks, c(bparams)) | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
157 | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
158 png(files$plot) | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
159 plot(brout$rank, brout$total, log = "xy", | 
| 
7
 
2c1200fba922
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 0a1586a00f94215b8182423e4b2f34fdf706a47d"
 
iuc 
parents: 
6 
diff
changeset
 | 
160 xlab = "(log) Rank", ylab = "(log) Total UMI Counts") | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
161 o <- order(brout$rank) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
162 lines(brout$rank[o], brout$fitted[o], col = "red") | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
163 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
164 abline(h = brout$knee, col = "dodgerblue", lty = 2) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
165 abline(h = brout$inflection, col = "forestgreen", lty = 2) | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
166 legend("bottomleft", lty = 2, col = c("dodgerblue", "forestgreen"), | 
| 
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
167 legend = c("knee", "inflection")) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
168 dev.off() | 
| 
2
 
a8aa294401be
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit 4d89eb1eb951ef094d1f77c46824d9c38be4445b"
 
iuc 
parents: 
1 
diff
changeset
 | 
169 | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
170 print(paste("knee =", brout$knee, ", inflection = ", brout$inflection)) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
171 } | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
172 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
173 ## Main | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
174 set.seed(seed.val) | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
175 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
176 if (do.method == "barcodeRankings") { | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
177 do_barcode_rankings(files, bparams, intype) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
178 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
179 } else if (do.method == "defaultDrops") { | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
180 do_default_drops(files, dparams, intype, outtype) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
181 | 
| 
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
182 } else if (do.method == "emptyDrops") { | 
| 
6
 
8855361fcfc5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit ed0625fe59342d14a08745996e3e32c6f922a738"
 
iuc 
parents: 
5 
diff
changeset
 | 
183 do_empty_drops(files, eparams, intype, outtype, empty_fdr_threshold) | 
| 
0
 
4cd9f0008d9c
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/dropletutils/ commit e66ab3d4fc0c1a72523e8f93447cc07cdd6816b7
 
iuc 
parents:  
diff
changeset
 | 
184 } | 
