cytoqc performs pre-cleaning, pre-gating and post-gating QC checks.
cqc_check
to see the summarycqc_match
to match against reference groupcqc_fix
based on the match results or cqc_drop_groups
for unsolvable issuessplit
the data into multiple sets for multi-panel caseslibrary(knitr) knitr::opts_chunk$set(warning = FALSE, message = FALSE) icuSetCollate(locale="en_US")
library(flowCore) library(flowWorkspace) library(cytoqc) # devtools::load_all()
# prepare the test data data("GvHD") fs <- fsApply(GvHD,function(fr)fr[1,]) data_dir <- tempfile() dir.create(data_dir) write.flowSet(fs, data_dir)
files <- list.files(data_dir, ".fcs", full.names = TRUE) cqc_data <- cqc_load_fcs(files) cqc_data
#simulate channel discrepancy #case cf <- cqc_data[[1]] colnames(cf)[1] <- "fsc-h" #missing cqc_data[[1]] <- cf[,1:7] #redundant thisfile <- files[2] fr <- read.FCS(thisfile) new_col <- exprs(fr)[,8,drop=F] colnames(new_col) <- "channelA" fr <- fr_append_cols(fr, new_col) write.FCS(fr, files[2]) cqc_data[[2]] <- load_cytoframe_from_fcs(thisfile) #typo cf <- cqc_data[[2]] colnames(cf)[2] <- "SSC1-H" #both case and typo cf <- cqc_data[[3]] colnames(cf)[1:2] <- c("fsc-h", "SSC1-H") #order cf <- cqc_data[[4]] cf_swap_colnames(cf, "FL1-H", "FL2-H")
groups <- cqc_check(cqc_data, "channel") groups
match_result <- cqc_match(groups, ref = 3, select = c(1, 4)) match_result
cqc_fix(match_result)
groups <- cqc_check(cqc_data, "channel") groups
groups <- cqc_drop_groups(groups, 1) cqc_data <- cqc_get_data(groups) length(cqc_data)
#simulate channel discrepancy cf <- cqc_data[[1]] cf_rename_marker(cf, "CD15 FITC", "cd15") cf_rename_marker(cf, "CD33 APC", "apc cd33") #redundant cf <- cqc_data[[2]] markernames(cf) <- c(`FL2-A` = "markerA")
#summarise marker groups groups <- cqc_check(cqc_data, "marker") groups
solution <- cqc_match(groups, ref = 3) solution
solution <- cqc_match_update(solution, map = c("apc cd33" = "CD33 APC")) solution
cqc_fix(solution) groups <- cqc_check(cqc_data, "marker") groups
data_list <- split(groups) data_list
# second data set is already clean cqc_check(data_list[[2]], "panel")
cleaned <- data_list[[2]]
out <- tempfile() cqc_write_fcs(cleaned, out)
cytoset
(zero-copying)cs <- cytoset(cleaned) cs
grps <- cqc_check(data_list[[3]], "panel") grps split(grps)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.