comparison scater-normalize.R @ 0:a30f4bfe8f01 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/scater commit 61f3899168453092fd25691cf31871a3a350fd3b"
author iuc
date Tue, 03 Sep 2019 14:30:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a30f4bfe8f01
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')