-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCytoExplorer example.R
141 lines (113 loc) · 4.04 KB
/
CytoExplorer example.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# from https://dillonhammill.github.io/CytoExploreR/articles/CytoExploreR.html
library(CytoExploreR)
library(CytoExploreRData)
# Download Compensation FCS files
cyto_save(Compensation,
save_as = "Compensation-Samples")
# Download Activation FCS files
cyto_save(Activation,
save_as = "Activation-Samples")
# Setup compensation controls
gs <- cyto_setup("Compensation-Samples",
gatingTemplate = "Compensation-gatingTemplate.csv")
# Transform fluorescent channels - default logicle transformations
gs <- cyto_transform(gs)
# Gate Cells
cyto_gate_draw(gs,
parent = "root",
alias = "Cells",
channels = c("FSC-A", "SSC-A"))
# Gate Single Cells
cyto_gate_draw(gs,
parent = "Cells",
alias = "Single Cells",
channels = c("FSC-A", "FSC-H"))
# Compute spillover matrix
spill <- cyto_spillover_compute(gs,
parent = "Single Cells",
spillover = "Spillover-Matrix.csv")
# Edit spillover matrix
spill <- cyto_spillover_edit(gs,
parent = "Single Cells",
spillover = "Spillover-Matrix.csv")
# Visualise uncompensated data
cyto_plot_compensation(gs,
parent = "Single Cells")
# Visualise compensated data
cyto_plot_compensation(gs,
parent = "Single Cells",
spillover = "Spillover-Matrix.csv",
compensate = TRUE)
# Load and annotate samples
gs <- cyto_setup("Activation-Samples",
gatingTemplate = "Activation-gatingTemplate.csv")
# Apply compensation
gs <- cyto_compensate(gs,
spillover = "Spillover-Matrix.csv")
# Transform fluorescent channels - default logicle transformations
gs <- cyto_transform(gs)
# Gate Cells
cyto_gate_draw(gs,
parent = "root",
alias = "Cells",
channels = c("FSC-A","SSC-A"))
# Gate Single Cells
cyto_gate_draw(gs,
parent = "Cells",
alias = "Single Cells",
channels = c("FSC-A","FSC-H"))
# Extract unstained control
NIL <- cyto_extract(gs, "Single Cells")[[33]]
# Gate Live Cells
cyto_gate_draw(gs,
parent = "Single Cells",
alias = c("Dead Cells", "Live Cells"),
channels = c("Hoechst-405", "Hoechst-430"),
type = "rectangle",
negate = TRUE,
overlay = NIL)
# Gate T Cells and Dedritic Cells
cyto_gate_draw(gs,
parent = "Live Cells",
alias = c("T Cells", "Dendritic Cells"),
channels = c("CD11c", "Va2"),
type = c("ellipse", "rectangle"),
overlay = NIL)
# Gate CD4 & CD8 T Cells
cyto_gate_draw(gs,
parent = "T Cells",
alias = c("CD4 T Cells", "CD8 T Cells"),
channels = c("CD4", "CD8"),
type = "r")
# Extract CD4 T Cells
CD4 <- cyto_extract(gs, "CD4 T Cells")
# Extract naive CD4 T Cells
CD4_naive <- cyto_select(CD4, OVAconc = 0)
# Gate CD69+ CD4 T Cells
cyto_gate_draw(gs,
parent = "CD4 T Cells",
alias = "CD69+ CD4 T Cells",
channels = c("CD44", "CD69"),
type = "rectangle",
overlay = CD4_naive)
# Gate CD69+ CD8 T Cells
cyto_gate_draw(gs,
parent = "CD8 T Cells",
alias = "CD69+ CD8 T Cells",
channels = c("CD44", "CD69"),
type = "rectangle",
contour_lines = 15)
# Gating Tree
cyto_plot_gating_tree(gs[[32]],
stat = "freq")
# Gating scheme
cyto_plot_gating_scheme(gs[32],
back_gate = FALSE,
gate_track = TRUE)
# Compute medFI - exclude unstained control
cyto_stats_compute(gs[1:32],
alias = c("CD69+ CD4 T Cells",
"CD69+ CD8 T Cells"),
stat = "median",
channels = c("CD44", "CD69"))
?cyto_transform