Mercurial > repos > iuc > seurat
annotate citeseq_Seurat.R @ 15:fab6ff46e019 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
author | iuc |
---|---|
date | Fri, 07 Jul 2023 01:43:02 +0000 |
parents | |
children |
rev | line source |
---|---|
15
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
1 #' --- |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
2 #' title: "Seurat Cite-seq Analysis" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
3 #' author: "Performed using Galaxy" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
4 #' params: |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
5 #' rna: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
6 #' prot: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
7 #' min_cells: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
8 #' min_genes: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
9 #' low_thresholds: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
10 #' high_thresholds: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
11 #' numPCs: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
12 #' resolution: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
13 #' perplexity: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
14 #' min_pct: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
15 #' logfc_threshold: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
16 #' showcode: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
17 #' warn: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
18 #' varstate: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
19 #' vlnfeat: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
20 #' featplot: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
21 #' PCplots: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
22 #' nmds: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
23 #' heatmaps: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
24 #' norm_out: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
25 #' variable_out: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
26 #' pca_out : "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
27 #' clusters_out: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
28 #' markers_out: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
29 #' cite_markers: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
30 #' comparison: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
31 #' feat_comp: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
32 #' marker_compare: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
33 #' top_x: "" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
34 #' --- |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
35 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
36 # nolint start |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
37 #+ echo=F, warning = F, message=F |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
38 options(show.error.messages = F, error = function() { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
39 cat(geterrmessage(), file = stderr()); q("no", 1, F) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
40 }) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
41 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
42 # we need that to not crash Galaxy with an UTF-8 error on German LC settings. |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
43 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
44 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
45 showcode <- as.logical(params$showcode) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
46 warn <- as.logical(params$warn) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
47 varstate <- as.logical(params$varstate) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
48 vlnfeat <- as.logical(params$vlnfeat) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
49 featplot <- as.logical(params$featplot) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
50 pc_plots <- as.logical(params$PCplots) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
51 nmds <- as.logical(params$nmds) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
52 heatmaps <- as.logical(params$heatmaps) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
53 end_step <- as.integer(params$end_step) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
54 norm_out <- as.logical(params$norm_out) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
55 comparison <- as.logical(params$comparison) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
56 feature <- trimws(unlist(strsplit(as.character(params$feat_comp), ","))) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
57 marker_compare <- as.logical(params$marker_compare) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
58 top_x <- as.integer(params$top_x) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
59 min_cells <- as.integer(params$min_cells) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
60 min_genes <- as.integer(params$min_genes) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
61 low_thresholds <- as.integer(params$low_thresholds) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
62 high_thresholds <- as.integer(params$high_thresholds) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
63 num_pcs <- as.integer(params$numPCs) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
64 cells_use <- as.integer(params$cells_use) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
65 resolution <- as.double(params$resolution) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
66 min_pct <- as.double(params$min_pct) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
67 logfc_threshold <- as.double(params$logfc_thresh) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
68 variable_out <- as.logical(params$variable_out) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
69 pca_out <- as.logical(params$pca_out) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
70 clusters_out <- as.logical(params$clusters_out) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
71 markers_out <- as.logical(params$markers_out) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
72 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
73 print(paste0("Minimum cells: ", min_cells)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
74 print(paste0("Minimum features: ", min_genes)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
75 print(paste0("Umi low threshold: ", low_thresholds)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
76 print(paste0("Umi high threshold: ", high_thresholds)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
77 print(paste0("Number of principal components: ", num_pcs)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
78 print(paste0("Resolution: ", resolution)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
79 print(paste0("Minimum percent of cells", min_pct)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
80 print(paste0("Logfold change threshold", logfc_threshold)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
81 if (params$perplexity == "") { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
82 perplexity <- -1 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
83 print(paste0("Perplexity: ", perplexity)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
84 } else { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
85 perplexity <- as.integer(params$perplexity) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
86 print(paste0("Perplexity: ", perplexity)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
87 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
88 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
89 #+ echo = FALSE |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
90 if (showcode == TRUE) print("Read in data, generate inital Seurat object") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
91 #+ echo = `showcode`, warning = `warn`, message = F |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
92 rna <- read.delim(params$rna, row.names = 1) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
93 rna <- Seurat::CollapseSpeciesExpressionMatrix(rna) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
94 protein <- read.delim(params$prot, row.names = 1) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
95 tryCatch(all.equal(colnames(rna), colnames(protein)), error = "Columns do not match in input files") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
96 seuset <- Seurat::CreateSeuratObject(counts = rna, min.cells = min_cells, min.features = min_genes) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
97 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
98 if (showcode == TRUE) print("asdf") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
99 #+ echo = `showcode`, warning = `warn`, message = F |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
100 prot_obj <- Seurat::CreateAssayObject(counts = protein) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
101 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
102 if (showcode == TRUE) print("qwer") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
103 #+ echo = `showcode`, warning = `warn`, message = F |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
104 seuset[["ADT"]] <- prot_obj |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
105 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
106 if (showcode == TRUE) print("zxcv") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
107 #+ echo = `showcode`, warning = `warn`, message = F |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
108 Seurat::DefaultAssay(seuset) <- "RNA" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
109 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
110 if (showcode == TRUE && vlnfeat == TRUE) print("Raw data vizualization") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
111 #+ echo = `showcode`, warning = `warn`, include=`vlnfeat` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
112 if (vlnfeat == TRUE){ |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
113 print(Seurat::VlnPlot(object = seuset, features = c("nFeature_RNA", "nCount_RNA"))) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
114 print(Seurat::FeatureScatter(object = seuset, feature1 = "nCount_RNA", feature2 = "nFeature_RNA")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
115 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
116 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
117 if (showcode == TRUE) print("Filter and normalize for UMI counts") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
118 #+ echo = `showcode`, warning = `warn` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
119 seuset <- subset(seuset, subset = `nCount_RNA` > low_thresholds & `nCount_RNA` < high_thresholds) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
120 seuset <- Seurat::NormalizeData(seuset, normalization.method = "LogNormalize", scale.factor = 10000) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
121 if (norm_out == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
122 saveRDS(seuset, "norm_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
123 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
124 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
125 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
126 if (showcode == TRUE && featplot == TRUE) print("Variable Genes") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
127 #+ echo = `showcode`, warning = `warn`, include = `featplot` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
128 seuset <- Seurat::FindVariableFeatures(object = seuset, selection.method = "mvp") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
129 if (featplot == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
130 print(Seurat::VariableFeaturePlot(seuset, cols = c("black", "red"), selection.method = "disp")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
131 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
132 seuset <- Seurat::ScaleData(object = seuset, vars.to.regress = "nCount_RNA") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
133 if (variable_out == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
134 saveRDS(seuset, "var_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
135 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
136 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
137 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
138 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
139 if (showcode == TRUE && pc_plots == TRUE) print("PCA Visualization") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
140 #+ echo = `showcode`, warning = `warn`, include = `pc_plots` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
141 seuset <- Seurat::RunPCA(seuset, npcs = num_pcs) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
142 seuset <- Seurat::JackStraw(seuset, dims = num_pcs, reduction = "pca", num.replicate = 100) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
143 seuset <- Seurat::ScoreJackStraw(seuset, dims = 1:num_pcs) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
144 if (pc_plots == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
145 print(Seurat::VizDimLoadings(seuset, dims = 1:2)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
146 print(Seurat::DimPlot(seuset, dims = c(1, 2), reduction = "pca")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
147 print(Seurat::DimHeatmap(seuset, dims = 1:num_pcs, nfeatures = 10, reduction = "pca")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
148 print(Seurat::JackStrawPlot(seuset, dims = 1:num_pcs)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
149 print(Seurat::ElbowPlot(seuset, ndims = num_pcs, reduction = "pca")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
150 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
151 if (pca_out == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
152 saveRDS(seuset, "pca_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
153 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
154 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
155 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
156 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
157 if (showcode == TRUE && nmds == TRUE) print("tSNE and UMAP") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
158 #+ echo = `showcode`, warning = `warn`, include = `nmds` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
159 seuset <- Seurat::FindNeighbors(object = seuset) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
160 seuset <- Seurat::FindClusters(object = seuset) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
161 if (perplexity == -1) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
162 seuset <- Seurat::RunTSNE(seuset, dims = 1:num_pcs, resolution = resolution, check_duplicates = FALSE) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
163 } else { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
164 seuset <- Seurat::RunTSNE(seuset, dims = 1:num_pcs, resolution = resolution, perplexity = perplexity, check_duplicates = FALSE) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
165 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
166 if (nmds == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
167 print(Seurat::DimPlot(seuset, reduction = "tsne")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
168 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
169 seuset <- Seurat::RunUMAP(seuset, dims = 1:num_pcs) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
170 if (nmds == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
171 print(Seurat::DimPlot(seuset, reduction = "umap")) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
172 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
173 if (clusters_out == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
174 tsnedata <- Seurat::Embeddings(seuset, reduction="tsne") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
175 saveRDS(seuset, "tsne_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
176 umapdata <- Seurat::Embeddings(seuset, reduction="umap") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
177 saveRDS(seuset, "umap_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
178 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
179 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
180 if (showcode == TRUE && heatmaps == TRUE) print("Marker Genes") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
181 #+ echo = `showcode`, warning = `warn`, include = `heatmaps` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
182 markers <- Seurat::FindAllMarkers(seuset, only.pos = TRUE, min.pct = min_pct, logfc.threshold = logfc_threshold) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
183 top10 <- dplyr::group_by(markers, cluster) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
184 top10 <- dplyr::top_n(top10, n = 10, wt = avg_log2FC) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
185 print(top10) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
186 if (heatmaps == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
187 print(Seurat::DoHeatmap(seuset, features = top10$gene)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
188 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
189 if (markers_out == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
190 saveRDS(seuset, "markers_out.rds") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
191 data.table::fwrite(x = markers, row.names=TRUE, sep="\t", file = "markers_out.tsv") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
192 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
193 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
194 #+ echo = FALSE |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
195 if (showcode == TRUE && comparison == TRUE) print("Compare") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
196 #+ echo = `showcode`, warning = `warn`, include = `comparison` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
197 Seurat::DefaultAssay(seuset) <- "ADT" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
198 seuset <- Seurat::NormalizeData(seuset, normalization.method = "CLR", margin = 2) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
199 Seurat::DefaultAssay(seuset) <- "RNA" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
200 seuset <- Seurat::NormalizeData(seuset, normalization.method = "CLR", margin = 2, assay = "ADT") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
201 if (comparison == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
202 for(x in feature) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
203 Seurat::DefaultAssay(seuset) <- "ADT" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
204 p1 <- Seurat::FeaturePlot(seuset, x, cols = c("lightgrey", "red")) + ggplot2::ggtitle(paste0("Protein:", " ", x)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
205 Seurat::DefaultAssay(seuset) <- "RNA" |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
206 p2 <- Seurat::FeaturePlot(seuset, x) + ggplot2::ggtitle(paste0("RNA:", " ", x)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
207 print(p1 | p2) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
208 label <- as.character(paste0(Seurat::Key(seuset[["ADT"]]), x)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
209 print(Seurat::VlnPlot(seuset, paste0("rna_", x))) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
210 print(Seurat::VlnPlot(seuset, paste0("adt_", x))) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
211 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
212 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
213 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
214 #+ echo = FALSE |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
215 if (showcode == TRUE) print("Cite-seq") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
216 #+ echo = `showcode`, warning = `warn`, include = `marker_compare` |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
217 rna_markers <- Seurat::FindAllMarkers(seuset, only.pos = TRUE, min.pct = min_pct, logfc.threshold = logfc_threshold, assay="RNA") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
218 protein_markers <- Seurat::FindAllMarkers(seuset, only.pos = TRUE, min.pct = min_pct, logfc.threshold = logfc_threshold, assay="ADT") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
219 if (marker_compare == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
220 data.table::fwrite(x = rna_markers, sep="\t", file = "rna_out.tsv") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
221 data.table::fwrite(x = protein_markers, sep="\t", file = "protein_out.tsv") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
222 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
223 toprna <- dplyr::top_n(dplyr::group_by(rna_markers, cluster), n=5, avg_log2FC) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
224 toprna <- head(as.list(unique(as.data.frame(toprna)$gene)), top_x) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
225 topprot <- dplyr::top_n(dplyr::group_by(protein_markers, cluster), n=5, avg_log2FC) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
226 topprot <- head(as.list(unique(as.data.frame(topprot)$gene)), top_x) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
227 if(marker_compare == TRUE) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
228 pdf(file="citeseq_out.pdf") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
229 rna_labels <- as.vector(toprna) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
230 rna_labels <- rna_labels[!duplicated(rna_labels)] |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
231 prot_labels <- as.vector(topprot) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
232 prot_labels <- prot_labels[!duplicated(prot_labels)] |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
233 for(rnamarker in rna_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
234 rnamarker <- paste("rna_", rnamarker, sep = "") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
235 for(protmarker in prot_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
236 protmarker <- paste("adt_", protmarker, sep="") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
237 plot <- Seurat::FeatureScatter(seuset, feature1 = rnamarker, feature2 = protmarker) + ggplot2::ggtitle(paste0(rnamarker, " vs ", protmarker)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
238 print(plot) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
239 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
240 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
241 for(rnamarker in rna_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
242 rnamarker <- paste("rna_", rnamarker, sep = "") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
243 for(rnamarker2 in rna_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
244 rnamarker2 <- paste("rna_", rnamarker2, sep="") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
245 plot <- Seurat::FeatureScatter(seuset, feature1 = rnamarker, feature2 = rnamarker2) + ggplot2::ggtitle(paste0(rnamarker, " vs ", rnamarker2)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
246 print(plot) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
247 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
248 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
249 for(protmarker in prot_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
250 protmarker <- paste("adt_", protmarker, sep = "") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
251 for(protmarker2 in prot_labels) { |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
252 protmarker2 <- paste("adt_", protmarker2, sep="") |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
253 plot <- Seurat::FeatureScatter(seuset, feature1 = protmarker, feature2 = protmarker2) + ggplot2::ggtitle(paste0(protmarker, " vs ", protmarker2)) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
254 print(plot) |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
255 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
256 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
257 dev.off() |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
258 } |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
259 |
fab6ff46e019
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit b437a46efb50e543b6d7c9988f954efe2caa9046
iuc
parents:
diff
changeset
|
260 # nolint end |