| Title: | Parse FlowJo V11 Workspace Files and Export to FlowJo V10 |
|---|---|
| Description: | Provides functions to parse FlowJo v11 workspace files (.flowjo) and extract gating information, populations, and associated FCS files. Includes utilities for exporting data to FlowJo v10 workspace format. The package enables bidirectional data flow between FlowJo and R/Bioconductor, facilitating reproducible analysis workflows. |
| Authors: | Bernd Jagla [aut, cre] (ORCID: <https://orcid.org/0000-0002-7696-0484>, affiliation: Institut Pasteur, scBiomarkers UTechS & Bioinformatics & Biostatistics Hub), Slobodan Culina [aut] (affiliation: Institut Pasteur, scBiomarkers UTechS), Francois Le Guerroue [aut] (affiliation: Institut Pasteur, scBiomarkers UTechS), Esma Karkeni [aut] (affiliation: Institut Pasteur, scBiomarkers UTechS), Milena Hasan [aut] (affiliation: Institut Pasteur, scBiomarkers UTechS) |
| Maintainer: | Bernd Jagla <bernd.jagla@pasteur.fr> |
| License: | MIT + file LICENSE |
| Version: | 0.99.113 |
| Built: | 2026-10-09 09:22:34 UTC |
| Source: | https://github.com/bioc/CyFj11 |
Export GatingSet to FlowJo v10 Workspace
export_flowjo10_workspace( gating_set, output_path, workspace_name = NULL, fcs_root = NULL, overwrite = FALSE )export_flowjo10_workspace( gating_set, output_path, workspace_name = NULL, fcs_root = NULL, overwrite = FALSE )
gating_set |
A GatingSet object to export. A named list of GatingSets,
as returned by |
output_path |
Path where the .xml file should be created |
workspace_name |
Optional name for the workspace |
fcs_root |
Optional base directory for FCS files. If provided, FCS files will be written there and URIs in the WSP will reference that location. If NULL, uses the actual paths found in the GatingSet. |
overwrite |
Logical. When |
Logical indicating success
# Export a GatingSet to FlowJo v10 XML format ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") fcs_path <- system.file("extdata", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) gs <- fj11_to_gatingset(ws, group_name = 1, path = fcs_path) out_file <- tempfile(fileext = ".xml") export_flowjo10_workspace(gs, out_file) file.exists(out_file)# Export a GatingSet to FlowJo v10 XML format ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") fcs_path <- system.file("extdata", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) gs <- fj11_to_gatingset(ws, group_name = 1, path = fcs_path) out_file <- tempfile(fileext = ".xml") export_flowjo10_workspace(gs, out_file) file.exists(out_file)
Parses a FlowJo v11 workspace and creates a GatingSet object with gating hierarchy, compensation, and transformations. Supports biexponential (Biex) transformations which are mapped to logicle transforms.
fj11_to_gatingset( fj11_workspace, group_name = NULL, subset = list(), execute = TRUE, path = NULL, cytoset = NULL, backend_dir = tempdir(), backend = c("h5", "tile"), include_gates = TRUE, compensation = NULL, additional.keys = "$TOT", additional.sampleID = FALSE, keywords = character(), keyword.ignore.case = FALSE, channel.ignore.case = FALSE, extend_val = 0, extend_to = -4000, leaf.bool = TRUE, include_empty_tree = FALSE, correct_faulty_gate = 0, transform = TRUE, use_transformed_coords = transform, max_search_depth = 5, stop_on_multiple = TRUE, mc.cores = 1, strip_comp_prefix = TRUE, sanitize_slashes = TRUE, ... )fj11_to_gatingset( fj11_workspace, group_name = NULL, subset = list(), execute = TRUE, path = NULL, cytoset = NULL, backend_dir = tempdir(), backend = c("h5", "tile"), include_gates = TRUE, compensation = NULL, additional.keys = "$TOT", additional.sampleID = FALSE, keywords = character(), keyword.ignore.case = FALSE, channel.ignore.case = FALSE, extend_val = 0, extend_to = -4000, leaf.bool = TRUE, include_empty_tree = FALSE, correct_faulty_gate = 0, transform = TRUE, use_transformed_coords = transform, max_search_depth = 5, stop_on_multiple = TRUE, mc.cores = 1, strip_comp_prefix = TRUE, sanitize_slashes = TRUE, ... )
fj11_workspace |
List returned by |
group_name |
Character or numeric. Name or index of the sample group to import. If NULL, will list available groups interactively. |
subset |
Numeric vector, character vector of FCS filenames, or expression to filter samples. See Details. |
execute |
Logical. Should gates be executed immediately? Default TRUE. If FALSE, creates GatingSet structure without computing cell counts. |
path |
Character. Root directory to search for FCS files. Required if FCS files are not in workspace location. |
cytoset |
A cytoset object providing alternative data source (instead of FCS files). Useful for preprocessed data. |
backend_dir |
Directory for storing h5 backend data. Default is tempdir(). |
backend |
Character. Storage backend, either "h5" or "tile". Default "h5". |
include_gates |
Logical. Should gates be imported? Default TRUE. |
compensation |
Compensation object, matrix, data.frame, or named list of these. Overrides workspace compensation. Names should match sample GUIDs. |
additional.keys |
Character vector of FCS keywords to include in sample GUID (concatenated with filename). Default is "$TOT". |
additional.sampleID |
Logical. Include FlowJo sample ID in GUID? Default FALSE. |
keywords |
Character vector of keywords to extract as pData. |
keyword.ignore.case |
Logical. Case-insensitive keyword matching? Default FALSE. |
channel.ignore.case |
Logical. Case-insensitive channel matching? Default FALSE. |
extend_val |
Numeric. Threshold for extending gate coordinates. Default 0. |
extend_to |
Numeric. Value to extend gates to. Default -4000. |
leaf.bool |
Logical. Compute leaf boolean gates? Default TRUE. |
include_empty_tree |
Logical. Include samples without gates? Default FALSE. |
correct_faulty_gate |
Numerical, zero = don't correct, otherwise use this value as transformation max value and Try to correct faulty gates instead of erroring? Default TRUE. |
transform |
Logical. Apply transformations? Default TRUE. |
use_transformed_coords |
Logical. Keep gate coordinates in FlowJo display
(transformed) space rather than raw space? Default is the value of
|
max_search_depth |
Integer. Maximum directory depth when searching for FCS files. Default 5. |
stop_on_multiple |
Logical. Stop if multiple FCS files match a sample? When TRUE, stops on both missing files and multiple matches. When FALSE, only stops on missing files and continues with multiple matches. Default TRUE. |
mc.cores |
Integer. Number of cores for parallel processing. Default 1. |
strip_comp_prefix |
Logical. Strip "Comp-" prefix from gate parameter names when adding populations? Default TRUE. Set to FALSE if compensation has already been applied and gate names should match the compensated parameter names. |
sanitize_slashes |
Logical. Replace "/" with "_" in parameter names? Default TRUE (matches flowCore behavior). Set to FALSE if you want to preserve "/" in marker names (e.g., "CD3/CD4" stays as-is). |
... |
Additional arguments passed to FCS parser. |
The subset argument can be:
Sample indices to import
FCS filenames to import
Logical expression to filter pData (requires keywords
argument)
FlowJo v11 stores data differently than v10:
Master gate definitions
Per-sample gate variations (tailored gates)
Sample groupings
FCS file references
A named list of GatingSet objects, one per sample. Each element
contains the full gating hierarchy, gates, compensation, and transformations for
that sample. To obtain a single merged GatingSet for downstream analysis,
call flowWorkspace::merge_list_to_gs(gsList) on the returned list.
ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") fcs_path <- system.file("extdata", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) gsList <- fj11_to_gatingset(ws, group_name = 1, path = fcs_path) length(gsList) # Number of GatingSets createdws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") fcs_path <- system.file("extdata", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) gsList <- fj11_to_gatingset(ws, group_name = 1, path = fcs_path) length(gsList) # Number of GatingSets created
Check whether "/" characters in parameter names are being replaced with "_".
get_sanitize_slashes()get_sanitize_slashes()
Logical. TRUE if "/" is replaced with "_", FALSE if preserved
# Check current setting is_sanitize_slashes <- get_sanitize_slashes()# Check current setting is_sanitize_slashes <- get_sanitize_slashes()
Check whether verbose output is currently enabled.
get_verbose()get_verbose()
Logical. TRUE if verbose output is enabled, FALSE otherwise
# Check current verbose setting is_verbose <- get_verbose() is_verbose # Should be FALSE by default# Check current verbose setting is_verbose <- get_verbose() is_verbose # Should be FALSE by default
Loads the example FlowJo v11 workspace from inst/extdata/min_test.flowjo for use in tests and examples. This workspace contains a simple gating hierarchy (Ungated -> Lymphocytes -> CD8, CD3 subset) and references sample04.fcs.
load_example_workspace()load_example_workspace()
A flowjo11_workspace object
ws <- load_example_workspace() length(ws$samples) # Number of samplesws <- load_example_workspace() length(ws$samples) # Number of samples
This function takes a FlowJo v11 workspace file (.flowjo) and extracts the JSON content, then pretty prints it to a text file with "_pretty.json" suffix.
pretty_print_flowjo(flowjo_file)pretty_print_flowjo(flowjo_file)
flowjo_file |
Path to the FlowJo workspace file (.flowjo) |
Path to the created pretty printed JSON file
# Pretty print a FlowJo workspace to readable JSON ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") out_file <- pretty_print_flowjo(ws_path) file.exists(out_file) # Verify output was created # Clean up unlink(out_file)# Pretty print a FlowJo workspace to readable JSON ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") out_file <- pretty_print_flowjo(ws_path) file.exists(out_file) # Verify output was created # Clean up unlink(out_file)
Main wrapper function to read and parse FlowJo v11 workspace files.
read_flowjo11_workspace(workspace_path)read_flowjo11_workspace(workspace_path)
workspace_path |
Path to the FlowJo workspace file (.flowjo) |
Parsed workspace object containing manifest and JSON data
ws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) length(ws$samples) # Number of samples in workspace names(ws$groups) # Group namesws_path <- system.file("extdata", "min_test.flowjo", package = "CyFj11") ws <- read_flowjo11_workspace(ws_path) length(ws$samples) # Number of samples in workspace names(ws$groups) # Group names
Control whether "/" characters in parameter/marker names are automatically replaced with "". This is important because flowCore sanitizes parameter names by replacing "/" with "" when reading FCS files.
set_sanitize_slashes(v)set_sanitize_slashes(v)
v |
Logical. TRUE to replace "/" with "_" (default), FALSE to preserve "/" |
By default, this is TRUE to match flowCore's behavior, ensuring that gate parameter names match the flowFrame column names. Set to FALSE if you want to preserve "/" in marker names (e.g., "CD3/CD4" stays as-is).
Invisible NULL. Called for side effects.
# Preserve "/" in marker names set_sanitize_slashes(FALSE) # Use default behavior (replace "/" with "_") set_sanitize_slashes(TRUE)# Preserve "/" in marker names set_sanitize_slashes(FALSE) # Use default behavior (replace "/" with "_") set_sanitize_slashes(TRUE)
Enable or disable verbose output for debugging and monitoring package operations. When enabled, the package will print detailed information about its operations, including file processing, gate conversion, and data extraction steps.
set_verbose(v)set_verbose(v)
v |
Logical. TRUE to enable verbose output, FALSE to disable it |
Invisible NULL. Called for side effects.
set_verbose(TRUE) set_verbose(FALSE)set_verbose(TRUE) set_verbose(FALSE)