QC for tcell panel
library(flowCore)
library(flowWorkspace)
library(cytoqc)
# library(printr)
# library(DT)
path <- "~/remote/fh/fast/gottardo_r/mike_working/lyoplate_out/parsed"
centers <- c('BIIR','CIMR','Miami','NHLBI','Stanford','UCLA','Yale')
Load gs
panel <- "tcell"
gslist <- sapply(centers, function(center) {
message("Center: ", center)
gs <- load_gs(file.path(path, center, panel))
})
cqc_data <- cqc_gs_list(gslist)
QC Check gates
|
group_id
|
nGatingSet
|
gate
|
|
2
|
5
|
4- 8+, 4- 8+/38- DR-, 4- 8+/38- DR+, 4- 8+/38+ DR-, 4- 8+/38+ DR+, 4- 8+/CCR7- 45RA-, 4- 8+/CCR7- 45RA+, 4- 8+/CCR7+ 45RA-, 4- 8+/CCR7+ 45RA+, 4+ 8-, 4+ 8-/38- DR-, 4+ 8-/38- DR+, 4+ 8-/38+ DR-, 4+ 8-/38+ DR+, 4+ 8-/CCR7- 45RA-, 4+ 8-/CCR7- 45RA+, 4+ 8-/CCR7+ 45RA-, 4+ 8-/CCR7+ 45RA+, CD3, DNT, DPT, LYM, not dead, root, singlets
|
|
1
|
2
|
4- 8+, 4- 8+/38- DR-, 4- 8+/38- DR+, 4- 8+/38+ DR-, 4- 8+/38+ DR+, 4- 8+/CCR7- 45RA-, 4- 8+/CCR7- 45RA+, 4- 8+/CCR7+ 45RA-, 4- 8+/CCR7+ 45RA+, 4+ 8-, 4+ 8-/38- DR-, 4+ 8-/38- DR+, 4+ 8-/38+ DR-, 4+ 8-/38+ DR+, 4+ 8-/CCR7- 45RA-, 4+ 8-/CCR7- 45RA+, 4+ 8-/CCR7+ 45RA-, 4+ 8-/CCR7+ 45RA+, CD3, DNT, DPT, LYM, not dead, root
|
|
group_id
|
nGatingSet
|
gate
|
|
2
|
5
|
singlets
|
|
group_id
|
nGatingSet
|
gate
|
|
1
|
7
|
4- 8+, 4- 8+/38- DR-, 4- 8+/38- DR+, 4- 8+/38+ DR-, 4- 8+/38+ DR+, 4- 8+/CCR7- 45RA-, 4- 8+/CCR7- 45RA+, 4- 8+/CCR7+ 45RA-, 4- 8+/CCR7+ 45RA+, 4+ 8-, 4+ 8-/38- DR-, 4+ 8-/38- DR+, 4+ 8-/38+ DR-, 4+ 8-/38+ DR+, 4+ 8-/CCR7- 45RA-, 4+ 8-/CCR7- 45RA+, 4+ 8-/CCR7+ 45RA-, 4+ 8-/CCR7+ 45RA+, CD3, DNT, DPT, LYM, not dead, root
|
QC check for channel
groups <- cqc_check(cqc_data, "channel")
groups
Channels are very different across centers so move on to check marker
groups <- cqc_check(cqc_data, "marker")
groups
|
group_id
|
nGatingSet
|
marker
|
|
6
|
2
|
CD197, CD3, CD38, CD4, CD45RA, CD8, HLA-DR, Live Green
|
|
1
|
1
|
CCR7 PE, CD3 V450, CD38 APC, CD4 PerCP-Cy55, CD45RA PE-Cy7, CD8 APC-H7, HLA-DR V500, Live Dead FITC
|
|
2
|
1
|
CCR7, CD3, CD38, CD4, CD45RA, CD8, HLA DR, Live/Dead
|
|
3
|
1
|
CCR7, CD3, CD38, CD4, CD45RA, CD8, HLA-DR, LIVE
|
|
4
|
1
|
CCR7, CD3, CD38, CD4, CD45RA, CD8, HLADR, LIVE_GREEN
|
|
5
|
1
|
CD197, CD3, CD38, CD4, CD45RA, CD8, HLA-DR, LIVE DEAD
|
Markers are more standardized and go ahead to further clean it
res <- cqc_match(groups, ref = 3)
res
Re-match by relaxing the string matching threshold
res <- cqc_match(groups, ref = 3, max.distance = 0.6)
res
Manually match the individual items that are still not matched
res <- cqc_update_match(res, group = 1, map = c("CD4 PerCP-Cy55" = "CD4"
, "CD8 APC-H7" = "CD8"
, "Live Dead FITC" = "LIVE")
)
res
cqc_fix(res)
update checks
groups <- cqc_check(cqc_data, "marker")
groups
|
group_id
|
nGatingSet
|
marker
|
|
1
|
7
|
CCR7, CD3, CD38, CD4, CD45RA, CD8, HLA-DR, LIVE
|
check pannel
res <- cqc_check(cqc_data, "panel")
res
’
Spread markers
format(res, anchor = "marker")
Use the marker as reference to standardize the channels across centers
cf <- gs_cyto_data(cqc_data[[1]])[[1]]
panel <- cf_get_panel(cf, skip_na = TRUE)
panel
## # A tibble: 8 x 2
## channel marker
## <I<chr>> <I<chr>>
## 1 <APC-A> CD38
## 2 <APC-H7-A> CD8
## 3 <FITC-A> LIVE
## 4 <PerCP-Cy5-5-A> CD4
## 5 <V450-A> CD3
## 6 <V500-A> HLA-DR
## 7 <PE-A> CCR7
## 8 <PE-Cy7-A> CD45RA
cqc_set_panel(cqc_data, panel, ref.col = "marker")
groups <- cqc_check(cqc_data, "panel")
groups
Refresh QC report
groups <- cqc_check(cqc_data, "channel")
groups
|
group_id
|
nGatingSet
|
channel
|
|
1
|
3
|
<APC-A>, <APC-H7-A>, <FITC-A>, <PE-A>, <PE-Cy7-A>, <PerCP-Cy5-5-A>, <V450-A>, <V500-A>, FSC-A, FSC-H, FSC-W, SSC-A, SSC-H, SSC-W, Time
|
|
4
|
2
|
<APC-A>, <APC-H7-A>, <FITC-A>, <PE-A>, <PE-Cy7-A>, <PerCP-Cy5-5-A>, <V450-A>, <V500-A>, FSC-A, SSC-A, Time
|
|
2
|
1
|
<APC-A>, <APC-H7-A>, <FITC-A>, <PE-A>, <PE-Cy7-A>, <PerCP-Cy5-5-A>, <V450-A>, <V500-A>, FSC-A, FSC-H, SSC-A, SSC-H, Time
|
|
3
|
1
|
<APC-A>, <APC-H7-A>, <FITC-A>, <PE-A>, <PE-Cy7-A>, <PerCP-Cy5-5-A>, <V450-A>, <V500-A>, FSC-A, FSC-W, SSC-A, SSC-W, Time
|
diff(groups)
|
group_id
|
nGatingSet
|
channel
|
|
1
|
3
|
FSC-H, FSC-W, SSC-H, SSC-W
|
|
2
|
1
|
FSC-H, SSC-H
|
|
3
|
1
|
FSC-W, SSC-W
|
Remove H/W channels
res <- cqc_match(groups, ref = 4)
res
cqc_fix(res)
Coerce it directly into single GatingSet (zero-copying)
gs <- merge_list_to_gs(cqc_data)
gs
## A GatingSet with 63 samples