qc.and.removeDoublets: Perform quality control and remove doublets

View source: R/qc.and.removeDoublets.R

qc.and.removeDoubletsR Documentation

Perform quality control and remove doublets

Description

This function performs a quality control based on a double-step procedure in all FCS files contained within a fcs.SCE object or a folder specified by user:

  1. It executes a quality control based in flowAI::flow_auto_qc(),

  2. Remove doublets according criteria described here.

Usage

qc.and.removeDoublets(
  fcs.SCE = NULL,
  filelist = NULL,
  directory = getwd(),
  pattern = "fcs",
  physical.markers,
  output.folder = directory,
  output.suffix = "qc",
  return.idx = FALSE,
  return.fcs = FALSE,
  keep.QCfile = F
)

Arguments

fcs.SCE

A fcs.SCE object generated through FlowCT::fcs.SCE(). If NULL (default), this function will search for FCS files within current working directory.

filelist

A vector with full path of FCS files to be read, commonly generated through base::list.files(). If NULL, this file list will be generated as indicated below.

directory

If filelist = NULL, those files stored in this location will be read. Default = getwd() (current directory).

pattern

Pattern for reading files within directory. Default = "fcs".

physical.markers

Vector with physical markers (i.e., FCS-A, SSC-H, etc.). Mandatory for perfoming quality control.

output.folder

Folder name for storing final FCS files. Default, the same of directory.

output.suffix

Suffix added to new generated FCS files (in case not being working with a fcs.SCE object). Default = qc.

return.idx

Logical indicating whether output is a new fcs.SCE object without low-quality events or an index with this positions (without removing them from original fcs.SCE). This option is only available if the input is a fcs.SCE object. Default = FALSE (fcs.SCE output).

return.fcs

Logical indicating whether new FCS file should be generated without low quality events. They will stored in specified output.folder with the corresponding output.suffix.

keep.QCfile

Final QC text report should be kept? Attention, this file does not contain removed doublets but only those events removed through flowAI::flow_auto_qc(), all events are showed trough terminal output. Default = FALSE.

Value

Final output is a new fcs.SCE object (if fcs.SCE input) without these events that do not pass the quality control or new FCS files with the suffix "qc" with these low quality events removed. If user specifies return.idx = TRUE, output would be a vector with all low-quality events positions.

A table with percentaje of removed events for each FCS will be also shown in the terminal (those files with more than 30

Examples

## Not run: 
# option 1: output a new fcs.SCE object with low-quality events removed.
fcs.SCE_qc <- qc.and.removeDoublets(fcs.SCE = fcs, 
     physical.markers = c("FSC_A", "FSC_H", "SSC_A", "SSC_H"))

# option 2: output an index with low quality events
idx_qc <- qc.and.removeDoublets(fcs.SCE = fcs, 
     physical.markers = c("FSC_A", "FSC_H", "SSC_A", "SSC_H"), return.idx = T)

# option 3: working with all FCS files within a folder
idx_qc <- qc.and.removeDoublets(directory = "../data/", output.folder = "HQ_files",
     physical.markers = c("FSC_A", "FSC_H", "SSC_A", "SSC_H"))

## End(Not run)

jgarces02/FlowCT documentation built on March 28, 2023, 12:42 p.m.