Mercurial > repos > iuc > seurat
annotate Seurat.R @ 10:bb9732cfcdbe draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit c7b2b60384d54bf3ab5deca109cccba6d30b5c2e"
author | iuc |
---|---|
date | Mon, 20 Dec 2021 10:09:33 +0000 |
parents | c4db6ec33fec |
children | fab6ff46e019 |
rev | line source |
---|---|
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
1 #' --- |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
2 #' title: "Seurat Analysis" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
3 #' author: "Performed using Galaxy" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
4 #' params: |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
5 #' counts: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
6 #' min_cells: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
7 #' min_genes: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
8 #' low_thresholds: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
9 #' high_thresholds: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
10 #' numPCs: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
11 #' cells_use: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
12 #' resolution: "" |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
13 #' perplexity: "" |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
14 #' min_pct: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
15 #' logfc_threshold: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
16 #' showcode: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
17 #' warn: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
18 #' varstate: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
19 #' vlnfeat: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
20 #' featplot: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
21 #' PCplots: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
22 #' tsne: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
23 #' heatmaps: "" |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
24 #' --- |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
25 |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
26 # nolint start |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
27 #+ echo=F, warning = F, message=F |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
28 options(show.error.messages = F, error = function() { |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
29 cat(geterrmessage(), file = stderr()); q("no", 1, F) |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
30 }) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
31 showcode <- as.logical(params$showcode) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
32 warn <- as.logical(params$warn) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
33 varstate <- as.logical(params$varstate) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
34 vlnfeat <- as.logical(params$vlnfeat) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
35 featplot <- as.logical(params$featplot) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
36 pc_plots <- as.logical(params$PCplots) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
37 tsne <- as.logical(params$tsne) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
38 heatmaps <- as.logical(params$heatmaps) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
39 |
2
321bdd834266
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents:
1
diff
changeset
|
40 # we need that to not crash Galaxy with an UTF-8 error on German LC settings. |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
41 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
42 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
43 #+ echo = F, warning = `warn`, include =`varstate` |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
44 min_cells <- as.integer(params$min_cells) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
45 min_genes <- as.integer(params$min_genes) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
46 low_thresholds <- as.integer(params$low_thresholds) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
47 high_thresholds <- as.integer(params$high_thresholds) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
48 num_pcs <- as.integer(params$numPCs) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
49 cells_use <- as.integer(params$cells_use) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
50 resolution <- as.double(params$resolution) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
51 perplexity <- as.integer(params$perplexity) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
52 min_pct <- as.double(params$min_pct) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
53 logfc_threshold <- as.double(params$logfc_thresh) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
54 print(paste0("Minimum cells: ", min_cells)) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
55 print(paste0("Minimum features: ", min_genes)) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
56 print(paste0("Umi low threshold: ", low_thresholds)) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
57 print(paste0("Umi high threshold: ", high_thresholds)) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
58 print(paste0("Number of principal components: ", num_pcs)) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
59 print(paste0("Resolution: ", resolution)) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
60 print(paste0("Perplexity: ", perplexity)) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
61 print(paste0("Minimum percent of cells", min_pct)) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
62 print(paste0("Logfold change threshold", logfc_threshold)) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
63 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
64 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
65 if (showcode == TRUE) print("Read in data, generate inital Seurat object") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
66 #+ echo = `showcode`, warning = `warn`, message = F |
2
321bdd834266
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents:
1
diff
changeset
|
67 counts <- read.delim(params$counts, row.names = 1) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
68 seuset <- Seurat::CreateSeuratObject(counts = counts, min.cells = min_cells, min.features = min_genes) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
69 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
70 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
71 if (showcode == TRUE && vlnfeat == TRUE) print("Raw data vizualization") |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
72 #+ echo = `showcode`, warning = `warn`, include=`vlnfeat` |
2
321bdd834266
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents:
1
diff
changeset
|
73 Seurat::VlnPlot(object = seuset, features = c("nFeature_RNA", "nCount_RNA")) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
74 Seurat::FeatureScatter(object = seuset, feature1 = "nCount_RNA", feature2 = "nFeature_RNA") |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
75 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
76 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
77 if (showcode == TRUE) print("Filter and normalize for UMI counts") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
78 #+ echo = `showcode`, warning = `warn` |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
79 seuset <- subset(seuset, subset = `nCount_RNA` > low_thresholds & `nCount_RNA` < high_thresholds) |
2
321bdd834266
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents:
1
diff
changeset
|
80 seuset <- Seurat::NormalizeData(seuset, normalization.method = "LogNormalize", scale.factor = 10000) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
81 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
82 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
83 if (showcode == TRUE && featplot == TRUE) print("Variable Genes") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
84 #+ echo = `showcode`, warning = `warn`, include = `featplot` |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
85 seuset <- Seurat::FindVariableFeatures(object = seuset, selection.method = "mvp") |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
86 Seurat::VariableFeaturePlot(seuset, cols = c("black", "red"), selection.method = "disp") |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
87 seuset <- Seurat::ScaleData(object = seuset, vars.to.regress = "nCount_RNA") |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
88 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
89 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
90 if (showcode == TRUE && pc_plots == TRUE) print("PCA Visualization") |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
91 #+ echo = `showcode`, warning = `warn`, include = `pc_plots` |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
92 seuset <- Seurat::RunPCA(seuset, npcs = num_pcs) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
93 Seurat::VizDimLoadings(seuset, dims = 1:2) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
94 Seurat::DimPlot(seuset, dims = c(1, 2), reduction = "pca") |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
95 Seurat::DimHeatmap(seuset, dims = 1:num_pcs, nfeatures = 30, reduction = "pca") |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
96 seuset <- Seurat::JackStraw(seuset, dims = num_pcs, reduction = "pca", num.replicate = 100) |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
97 seuset <- Seurat::ScoreJackStraw(seuset, dims = 1:num_pcs) |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
98 Seurat::JackStrawPlot(seuset, dims = 1:num_pcs) |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
99 Seurat::ElbowPlot(seuset, ndims = num_pcs, reduction = "pca") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
100 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
101 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
102 if (showcode == TRUE && tsne == TRUE) print("tSNE") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
103 #+ echo = `showcode`, warning = `warn`, include = `tsne` |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
104 seuset <- Seurat::FindNeighbors(object = seuset) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
105 seuset <- Seurat::FindClusters(object = seuset) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
106 if (perplexity == -1) { |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
107 seuset <- Seurat::RunTSNE(seuset, dims = 1:num_pcs, resolution = resolution); |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
108 } else { |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
109 seuset <- Seurat::RunTSNE(seuset, dims = 1:num_pcs, resolution = resolution, perplexity = perplexity); |
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
110 } |
2
321bdd834266
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents:
1
diff
changeset
|
111 Seurat::DimPlot(seuset, reduction = "tsne") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
112 |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
113 #+ echo = FALSE |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
114 if (showcode == TRUE && heatmaps == TRUE) print("Marker Genes") |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
115 #+ echo = `showcode`, warning = `warn`, include = `heatmaps` |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
116 markers <- Seurat::FindAllMarkers(seuset, only.pos = TRUE, min.pct = min_pct, logfc.threshold = logfc_threshold) |
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
117 top10 <- dplyr::group_by(markers, cluster) |
9
c4db6ec33fec
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 7681c9101062f58ac4eb296a98b1644d4ed2340a"
iuc
parents:
6
diff
changeset
|
118 top10 <- dplyr::top_n(top10, 10, avg_log2FC) |
1
7319f83ae734
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff
changeset
|
119 Seurat::DoHeatmap(seuset, features = top10$gene) |
6
764f076e9d52
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit e8eeff2efea68e1e5bc697d0ff6a5808cd978db2"
iuc
parents:
2
diff
changeset
|
120 # nolint end |