annotate signac-template.R @ 0:6e0b320d8b6a draft default tip

"planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
author gaelcge
date Tue, 02 Aug 2022 19:11:27 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
1 #!/usr/bin/env Rscript
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
2
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
3 # Load optparse we need to check inputs
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
4
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
5 suppressPackageStartupMessages(require(optparse))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
6
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
7 # Load common functions
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
8
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
9 suppressPackageStartupMessages(require(workflowscriptscommon))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
10
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
11 # parse options
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
12
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
13 option_list = list(
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
14 make_option(
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
15 c("--signac-object"),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
16 action = "store",
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
17 default = NA,
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
18 type = 'character',
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
19 help = ""
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
20 ),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
21 make_option(
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
22 c("--"),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
23 action = "store",
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
24 default = NA,
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
25 type = 'character',
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
26 help = "."
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
27 ),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
28 make_option(
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
29 c("--"),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
30 action = "store",
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
31 default = NA,
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
32 type = 'character',
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
33 help = "."
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
34 ),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
35 make_option(
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
36 c("--output-object-file"),
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
37 action = "store",
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
38 default = NA,
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
39 type = 'character',
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
40 help = "File name in which to store serialized R matrix object."
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
41 )
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
42 )
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
43
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
44 opt <- wsc_parse_args(option_list)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
45
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
46 suppressPackageStartupMessages(require(Seurat))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
47 suppressPackageStartupMessages(require(Signac))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
48 suppressPackageStartupMessages(require(GenomeInfoDb))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
49 suppressPackageStartupMessages(require(EnsDb.Hsapiens.v75))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
50 suppressPackageStartupMessages(require(EnsDb.Mmusculus.v79))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
51
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
52 set.seed(1234)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
53
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
54 # extract gene annotations from EnsDb
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
55 signac_object <- readRDS(file = opt$signac_object)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
56
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
57
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
58
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
59 # Output to a serialized R object
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
60 saveRDS(signac_object, file = opt$output_object_file)