QC for tcell panel

library(knitr)
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
library(kableExtra)
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), select = 1)
})

cqc_data <- cqc_gs_list(gslist)

QC Check gates

#group by gates
groups <- cqc_check(cqc_data, "gate")
groups
diff(groups)

#vis the difference
# plot_diff(groups)

# match reference
match_result <- cqc_match(groups, ref = 1)
# match_result

cqc_fix(match_result)

cqc_check(cqc_data, "gate")

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

Markers are more standardized and go ahead to further clean it

res <- cqc_match(groups, ref = 3) 
res

Manually match the individual items that are still not matched

res <- cqc_update_match(res,  map = c("CD197" = "CCR7"))
res
cqc_fix(res)

update checks

groups <- cqc_check(cqc_data, "marker")
groups

check pannel

res <- cqc_check(cqc_data, "panel")
res
res <- cqc_check(cqc_data, "panel", by = "marker")
res

Use the marker as reference to standardize the channels across centers

res <- cqc_match(res, ref = 3)
res
cqc_fix(res)
groups <- cqc_check(cqc_data, "panel")
groups

Refresh QC report

groups <- cqc_check(cqc_data, "channel")
groups
diff(groups)

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


RGLab/cytoqc documentation built on Jan. 25, 2023, 11:05 p.m.