Mercurial > repos > gaelcge > r_signac_galaxy
comparison signac-dimplot.R @ 0:6e0b320d8b6a draft default tip
"planemo upload commit dc808171975d0012e25bd7b32adc7a5a5c56a145-dirty"
author | gaelcge |
---|---|
date | Tue, 02 Aug 2022 19:11:27 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:6e0b320d8b6a |
---|---|
1 #!/usr/bin/env Rscript | |
2 | |
3 # Load optparse we need to check inputs | |
4 | |
5 suppressPackageStartupMessages(require(optparse)) | |
6 | |
7 # Load common functions | |
8 | |
9 suppressPackageStartupMessages(require(workflowscriptscommon)) | |
10 | |
11 # parse options | |
12 | |
13 option_list = list( | |
14 make_option( | |
15 c("--signac-object"), | |
16 action = "store", | |
17 default = NA, | |
18 type = 'character', | |
19 help = "" | |
20 ), | |
21 make_option( | |
22 c("--dims"), | |
23 action = "store", | |
24 type = 'character', | |
25 help = "Dimension for x-axis (default 1)" | |
26 ), | |
27 make_option( | |
28 c("-p", "--pt-size"), | |
29 action = "store", | |
30 default = 1, | |
31 type = 'integer', | |
32 help = "Adjust point size for plotting" | |
33 ), | |
34 make_option( | |
35 c("-l", "--label-size"), | |
36 action = "store", | |
37 default = 4, | |
38 type = 'integer', | |
39 help = "Sets size of labels." | |
40 ), | |
41 make_option( | |
42 c("-d", "--do-label"), | |
43 action = "store", | |
44 default = FALSE, | |
45 type = 'logical', | |
46 help = "Whether to label the clusters." | |
47 ), | |
48 make_option( | |
49 c("--group-by"), | |
50 action = "store", | |
51 default = 'ident', | |
52 type = 'character', | |
53 help = "Group (color) cells in different ways (for example, orig.ident)." | |
54 ), | |
55 make_option( | |
56 c("--png-width"), | |
57 action = "store", | |
58 default = 1000, | |
59 type = 'integer', | |
60 help = "Width of png (px)." | |
61 ), | |
62 make_option( | |
63 c("--png-height"), | |
64 action = "store", | |
65 default = 1000, | |
66 type = 'integer', | |
67 help = "Height of png file (px)." | |
68 ), | |
69 make_option( | |
70 c("--output_image_file"), | |
71 action = "store", | |
72 default = NA, | |
73 type = 'character', | |
74 help = "File name in which to store serialized R matrix object." | |
75 ) | |
76 ) | |
77 | |
78 opt <- wsc_parse_args(option_list) | |
79 | |
80 suppressPackageStartupMessages(require(Seurat)) | |
81 suppressPackageStartupMessages(require(Signac)) | |
82 | |
83 set.seed(1234) | |
84 | |
85 dims_use <- opt$dims | |
86 if ( ! is.null(dims_use)){ | |
87 dims_parsed <- wsc_parse_numeric(opt, 'dims') | |
88 dims_use <- seq(from = dims_parsed[1], to = dims_parsed[2]) | |
89 } | |
90 | |
91 # extract gene annotations from EnsDb | |
92 signac_object <- readRDS(file = opt$signac_object) | |
93 | |
94 png(filename = opt$output_image_file, width = opt$png_width, height = opt$png_height) | |
95 DimPlot(object = signac_object, dims = dims_use, pt.size = opt$pt_size, label.size = opt$label_size, group.by = opt$group_by) + NoLegend() | |
96 dev.off() |