annotate signac-find_clusters.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("--algorithm"),
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("--output-object-file"),
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 = "File name in which to store serialized R matrix object."
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
34 )
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
35 )
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
36
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
37 opt <- wsc_parse_args(option_list)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
38
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
39 suppressPackageStartupMessages(require(Seurat))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
40 suppressPackageStartupMessages(require(Signac))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
41
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
42 set.seed(1234)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
43
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
44 # extract gene annotations from EnsDb
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
45 signac_object <- readRDS(file = opt$signac_object)
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
46
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
47 signac_object <- FindClusters(object = signac_object, verbose = FALSE, algorithm = as.numeric(opt$algorithm))
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
48
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
49 # Output to a serialized R object
6e0b320d8b6a "planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
gaelcge
parents:
diff changeset
50 saveRDS(signac_object, file = opt$output_object_file)