cqc_write_fcs: Write out tidied flow data ('cqc_cf_list') back to fcs or h5

View source: R/cqc_io.R

cqc_write_fcsR Documentation

Write out tidied flow data (cqc_cf_list) back to fcs or h5

Description

Write out tidied flow data (cqc_cf_list) back to fcs or h5

Usage

cqc_write_fcs(x, out, verbose = TRUE, ...)

cqc_write_cytoframe(
  x,
  out,
  verbose = TRUE,
  backend = get_default_backend(),
  ...
)

Arguments

x

cqc_cf_list

out

the output directory that the FCS or cytoframe on-disk formats will be written

verbose

whether to print each sample name during the writing process

...

other arguments passed down to 'write.FCS'

backend

either "h5" or "tile" (only relevant for cqc_write_cytoframe)

Examples

# Read in FCS files with inconsistencies
fcs_files <- list.files(system.file("extdata", "GvHD_QC", package = "cytoqc"), full.names = TRUE)
qc_cf_list <- cqc_load_fcs(fcs_files)

# Check for marker inconsitencies
groups <- cqc_check(qc_cf_list, type = "marker")

# Attempt to fix them automatically
match_result <- cqc_match(groups, ref = c("CD14 PerCP", "CD15 FITC", "CD33 APC", "CD45 PE", "FSC-Height", "SSC-Height", "Time"))

# Add a manual match that automatic matching could not find
match_result <- cqc_match_update(match_result, map = c("PTPRC PE" = "CD45 PE"))

# Apply the fix to the original cytoframes
cqc_fix(match_result)

# There is still one sample in its own group, because it is missing the Time channel entirely
# One approach is to simply drop this group.
groups <- cqc_check(qc_cf_list, type = "marker")
groups <- cqc_drop_groups(groups, 1)

qc_data <- cqc_get_data(groups)

# Write out fcs files
tmp_fcs_dir <- tempfile()
cqc_write_fcs(qc_data, tmp_fcs_dir)

# Write out h5 files
tmp_h5_dir <- tempfile()
cqc_write_cytoframe(qc_data, tmp_h5_dir)

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