annotate Seurat.R @ 5:06ed31cf52ed draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 98e7666ee048ec249fd3f65854feab03168fadef"
author iuc
date Mon, 08 Jun 2020 17:40:51 -0400
parents 321bdd834266
children 764f076e9d52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
13 #' min_pct: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
14 #' logfc_threshold: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
15 #' showcode: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
16 #' warn: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
17 #' varstate: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
18 #' vlnfeat: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
19 #' featplot: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
20 #' PCplots: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
21 #' tsne: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
22 #' heatmaps: ""
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
23 #' ---
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 #+ echo=F, warning = F, 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
26 options(show.error.messages = F, error = function(){cat(geterrmessage(), file = stderr()); q("no", 1, F)})
1
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
27 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
28 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
29 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
30 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
31 featplot <- as.logical(params$featplot)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
32 PCplots <- as.logical(params$PCplots)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
33 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
34 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
35
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
36 # 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
37 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
38
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
39
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
40 #+ 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
41 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
42 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
43 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
44 high_thresholds <- as.integer(params$high_thresholds)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
45 numPCs <- as.integer(params$numPCs)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
46 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
47 resolution <- as.double(params$resolution)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
48 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
49 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
50 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
51 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
52 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
53 print(paste0("Umi high threshold: ", high_thresholds))
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
54 print(paste0("Number of principal components: ", numPCs))
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
55 print(paste0("Resolution: ", resolution))
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
56 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
57 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
58
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
59 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
60 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
61 #+ 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
62 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
63 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
64
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
65 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
66 if(showcode == TRUE && vlnfeat == TRUE) print("Raw data vizualization")
1
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
67 #+ 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
68 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
69 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
70
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
71 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
72 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
73 #+ 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
74 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
75 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
76
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
77 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
78 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
79 #+ 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
80 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
81 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
82 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
83
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
84 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
85 if(showcode == TRUE && PCplots == TRUE) print("PCA Visualization")
1
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
86 #+ echo = `showcode`, warning = `warn`, include = `PCplots`
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
87 seuset <- Seurat::RunPCA(seuset, npcs = numPCs)
1
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
88 Seurat::VizDimLoadings(seuset, dims = 1:2)
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
89 Seurat::DimPlot(seuset, dims = c(1,2), reduction = "pca")
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
90 Seurat::DimHeatmap(seuset, dims = 1:numPCs, nfeatures = 30, reduction = "pca")
1
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
91 seuset <- Seurat::JackStraw(seuset, dims=numPCs, reduction = "pca", num.replicate = 100)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
92 seuset <- Seurat::ScoreJackStraw(seuset, dims = 1:numPCs)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
93 Seurat::JackStrawPlot(seuset, dims = 1:numPCs)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
94 Seurat::ElbowPlot(seuset, ndims = numPCs, reduction = "pca")
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
95
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
96 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
97 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
98 #+ 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
99 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
100 seuset <- Seurat::FindClusters(object = seuset)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
101 seuset <- Seurat::RunTSNE(seuset, dims = 1:numPCs, resolution = resolution)
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
102 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
103
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
104 #+ echo = FALSE
2
321bdd834266 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 3cf715ec11e2c9944f46572e324e5b2db5aa151f"
iuc
parents: 1
diff changeset
105 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
106 #+ 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
107 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
108 top10 <- dplyr::group_by(markers, cluster)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
109 top10 <- dplyr::top_n(top10, 10, avg_logFC)
7319f83ae734 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/seurat commit 88cf23c767023f71b4ea1e72aac568cc694cc34a"
iuc
parents:
diff changeset
110 Seurat::DoHeatmap(seuset, features = top10$gene)