unify.FCSheaders: Unify all FCS header for multiple FCS

View source: R/unify.FCSheaders.R

unify.FCSheadersR Documentation

Unify all FCS header for multiple FCS

Description

It checks if FCS files within a specific folder, or indicated in a vector, have the same header (i.e., same channels:markers nomenclature and order) and offer the possibility to unify them creating new ones.

Usage

unify.FCSheaders(
  filelist = NULL,
  directory = getwd(),
  pattern = ".fcs$",
  dataset = 1,
  fix = T,
  select.freq = 1,
  events = "all",
  view = F
)

Arguments

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".

dataset

Specify data segment to be read in the FCS file (same behaviour as flowCcre::read.FCS()). Default = 1.

fix

Logical indicating if user wants to perform the unification of FCS's headers or only display header frecuencies. If TRUE (default value), you should to specify the chosen frequency.

select.freq

Of diplayed frequencies (row-numered), indicate which is your option for unifiying FCS files. Default = 1 (i.e., the more frequent).

events

Numeric vector indicating how many events to read in each FCS file (same behaviour as flowCcre::read.FCS()), those are the number of events for new and unified generated FCS files. Default = NULL (i.e., all events will be read).

view

Logical indicating whether table with frequencies should be displayed in the terminal or in a external table. Default = FALSE.

Value

The final output if fix = F is a table with three columns: names for channels, freq for frequency of apparition of these channel names and length for number of channels within that frequency.

If fix = TRUE, those FCS files with a distinct header from selected frequency will be renamed/reordered, added with the suffix fixed.fcs and the original ones (unchanged) will be stored in a new original_files folder. In the case a FCS would have a different number of channels, it will moved to a new folder called discarded_files_because_diffs and dicarded from downstream analysis (this will be changed in the future).

Examples

## Not run: 
## detect header's frequencies
unify.FCSheaders(directory = "../data/", pattern = "fcs", fix = F)
 #                                                                            names freq length
 # 1 FSC-H, SSC-H, FITC-A, PE-A, PerCP-Cy5-5-A, APC-A, APC-H7-A, V500-A, V450-A       12     10
 # 2 FSC-H, SSC-H, FITC-A, PE-A, PerCP-C5-A, APC-A, APC-H7-A, Pac-Orange, Pac-Blue    10     10
## unify FCS's headers
unify.FCSheaders(directory = "../data/", pattern = "fcs", fix = T, select.freq = 2)

## End(Not run)

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