wsp_get_ff: Get (subsetted) flowFrames from one or many flowjo workspaces

View source: R/wsp_get_ff.R

wsp_get_ffR Documentation

Get (subsetted) flowFrames from one or many flowjo workspaces

Description

From a flowjo workspace with gated populations and the respective fcs files flowframes are generated. Under the hood CytoML::flowjo_to_gatingset applies the geometric gate definitions and filters relevant rows (indices) of fcs files. The compensation matrix as defined in flowjo will be used to compensate fluorescence intensities.

Usage

wsp_get_ff(
  wsp,
  FCS.file.folder = NULL,
  groups = NULL,
  population,
  invert_groups = F,
  samples = NULL,
  invert_samples = F,
  return_untransformed = T,
  return_transformed = T,
  downsample = 1,
  remove_redundant_channels = F,
  lapply_fun = lapply,
  seed = 42,
  channels = NULL,
  leverage_score_for_sampling = F,
  ...
)

Arguments

wsp

vector of paths to flowjo workspaces

FCS.file.folder

path to folder(s) of FCS files; may be one path for all wsp or a vector of paths, one for each wsp; if not provided fcs file paths are derived individually from the wsp (xml). If the workspace was generated and saved on another computer you will have to provide the path to FCS files on the current computer.

groups

vector or list of groups in flowjo to consider; if a list, each index corresponds to the same index in wsp; if NULL samples from all groups are read

population

which population (=node, =gate) to subset flowFrames on; use fcexpr::wsx_get_poppaths to get paths

invert_groups

logical whether to invert group selection

samples

vector or list of samples to select (names of FCS files), each index corresponds to the index in wsp; if NULL all samples (from selected groups) are read

invert_samples

logical whether to invert sample selection

return_untransformed

logical; do return untransformed (inverse) data

return_transformed

logical; do return transformed data (transformation as in flowjo?!)

downsample

numeric, if < 0 then a fraction of events is sampled, if > 0 an absolute number of events is sampled; or set to "min" which will lead to downsampling each flowframe to the number of events in the flowframe with lowest number of events; can be a single value to treat all FCS files equally or can be a vector of same length as FCS files

remove_redundant_channels

remove channels that are not part of the gating tree, mainly to reduce memory load

lapply_fun

lapply function name, unquoted; lapply, pbapply::pblapply or parallel::mclapply are suggested

seed

set a seed to reproduce downsampling

channels

channels to use for leverage score calculation; use wsx_get_keywords to retrieve channel names/descriptions

leverage_score_for_sampling

logical whether to use leverage scores for downsampling

...

additional argument to the lapply function; mainly mc.cores when parallel::mclapply is chosen

Details

If it is intended to pass flowframes to fcexpr::dr_to_fcs, it is recommended to have transformed and untransformed expression values returned.

Value

a list of (subsetted) flowframes with events that are within the gated population only

Examples

## Not run: 
ff_list <- fcexpr::wsp_get_ff(wsp = "mypath/my.wsp", population = "CD8+")
# ff.list[[1]] may be passed to fcexpr::dr_to_fcs for instance

## End(Not run)

Close-your-eyes/fcexpr documentation built on Sept. 29, 2023, 12:27 a.m.