Skip to content

RGLab/cytoqc

Repository files navigation

cytoqc – A standardization tool for openCyto

check and build

cytoqc checks and standardizes channels, markers, keywords, gates of the cytodata .

Installation

remotes::install_github("RGLab/cytoqc")

Get started

library(flowCore)
library(flowWorkspace)
library(cytoqc)

Load the FCS

files <- list.files(data_dir, ".fcs", full.names = TRUE)
cqc_data <- cqc_load_fcs(files)
cqc_data
## cytoqc data: 
## 21 samples

The basic workflow can be summarised as three steps:

  1. check

The consistency of markers, keywords and gating schemes.

  1. match

Inconsistent annotations to their nearest correct samples.

  1. fix

The inconsistent samples.

1. Check the consistency across 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

2. Match the reference

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

3. Apply the fix

cqc_fix(res)

Update check report

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

Return the cleaned data

cqc_data <- cqc_get_data(check_results)
cqc_data
## cytoqc data: 
## 21 samples

Coerce it inot cytoset

cytoset(cqc_data)
## A cytoset with 21 samples.
## 
##   column names:
##     FSC-H, SSC-H, FL1-H, FL2-H, FL3-H, FL2-A, FL4-H

Or output to FCS

cqc_write_fcs(cqc_data, outdir)