Mercurial > repos > iuc > scater_plot_exprs_freq
comparison scater-normalize.R @ 0:a8290d207005 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scater commit 5fdcafccb6c645d301db040dfeed693d7b6b4278
author | iuc |
---|---|
date | Thu, 18 Jul 2019 11:14:38 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a8290d207005 |
---|---|
1 #!/usr/bin/env Rscript | |
2 #Normalises a SingleCellExperiment object | |
3 | |
4 # Load optparse we need to check inputs | |
5 library(optparse) | |
6 library(workflowscriptscommon) | |
7 library(LoomExperiment) | |
8 library(scater) | |
9 | |
10 # parse options | |
11 option_list = list( | |
12 make_option( | |
13 c("-i", "--input-loom"), | |
14 action = "store", | |
15 default = NA, | |
16 type = 'character', | |
17 help = "A SingleCellExperiment object file in Loom format." | |
18 ), | |
19 make_option( | |
20 c("-o", "--output-loom"), | |
21 action = "store", | |
22 default = NA, | |
23 type = 'character', | |
24 help = "File name in which to store the SingleCellExperiment object in Loom format." | |
25 ) | |
26 ) | |
27 | |
28 opt <- wsc_parse_args(option_list, mandatory = c('input_loom', 'output_loom')) | |
29 | |
30 # Check parameter values | |
31 | |
32 if ( ! file.exists(opt$input_loom)){ | |
33 stop((paste('File', opt$input_loom, 'does not exist'))) | |
34 } | |
35 | |
36 # Input from Loom format | |
37 | |
38 scle <- import(opt$input_loom, format='loom', type='SingleCellLoomExperiment') | |
39 print(paste("Normalising....")) | |
40 | |
41 #Normalise | |
42 scle <- normalize(scle, exprs_values = 1) | |
43 | |
44 print(paste("Finished normalising")) | |
45 | |
46 # Output to a Loom file | |
47 if (file.exists(opt$output_loom)) { | |
48 file.remove(opt$output_loom) | |
49 } | |
50 export(scle, opt$output_loom, format='loom') |