cytoqc checks and standardizes channels, markers, keywords, gates of the cytodata .
remotes::install_github("RGLab/cytoqc")
library(flowCore)
library(flowWorkspace)
library(cytoqc)
files <- list.files(data_dir, ".fcs", full.names = TRUE)
cqc_data <- cqc_load_fcs(files)
cqc_data
## cytoqc data:
## 21 samples
- check
The consistency of markers, keywords and gating schemes.
- match
Inconsistent annotations to their nearest correct samples.
- fix
The inconsistent samples.
check_results <- cqc_check(cqc_data, type = "channel")
check_results
group_id |
nFCS |
channel |
---|---|---|
3 |
18 |
FL1-H, FL2-A, FL2-H, FL3-H, FL4-H, FSC-H, SSC-H, Time |
1 |
1 |
channelA, FL1-H, FL2-A, FL2-H, FL3-H, FL4-H, FSC-H, SSC1-H, Time |
2 |
1 |
FL1-H, FL2-A, FL2-H, FL3-H, FL4-H, fsc-h, SSC-H |
4 |
1 |
FL1-H, FL2-A, FL2-H, FL3-H, FL4-H, fsc-h, SSC1-H, Time |
res <- cqc_match(check_results, ref = 3)
res
## Ref 1 2 4
## 1 FL1-H ✓ ✓ ✓
## 2 FL2-A ✓ ✓ ✓
## 3 FL2-H ✓ ✓ ✓
## 4 FL3-H ✓ ✓ ✓
## 5 FL4-H ✓ ✓ ✓
## 6 FSC-H ✓ fsc-h fsc-h
## 7 SSC-H SSC1-H ✓ SSC1-H
## 8 Time ✓ <NA> ✓
## 10 To Delete Time channelA,Time Time
cqc_fix(res)
check_results <- cqc_check(cqc_data, type = "channel")
check_results
group_id |
nFCS |
channel |
---|---|---|
1 |
21 |
FL1-H, FL2-A, FL2-H, FL3-H, FL4-H, FSC-H, SSC-H |
cqc_data <- cqc_get_data(check_results)
cqc_data
## cytoqc data:
## 21 samples
cytoset(cqc_data)
## A cytoset with 21 samples.
##
## column names:
## FSC-H, SSC-H, FL1-H, FL2-H, FL3-H, FL2-A, FL4-H
cqc_write_fcs(cqc_data, outdir)