sce2fcs {CATALYST} | R Documentation

## SCE to `flowFrame/Set`

### Description

If `split_by = NULL`, the input SCE is converted to a `flowFrame`. Otherwise, it is split into a `flowSet` by the specified `colData` column. Any cell metadata (`colData`) and dimension reductions available in the SCE may be dropped or propagated to the output.

### Usage

    sce2fcs(x, split_by = NULL, keep_cd = FALSE, keep_dr = FALSE, assay = "counts")

### Arguments

`x` | a `SingleCellExperiment`.
`split_by` | NULL or a character string specifying a `colData(x)` column to split by.
`keep_cd, keep_dr` | logials specifying whether cell metadata (stored in `colData(x)`) and dimension reductions (stored in `reducedDims(x)`), respectively, should be kept or dropped.
`assay` | a character string specifying which assay data to use; valid values are `assayNames(x)`. When writing out FCS files, this should correspond to count-like data!

### Value

a `flowFrame` if `split_by = NULL`; otherwise a `flowSet`.

### Author(s)

Helena L Crowell helena.crowell@uzh.ch

### Examples

    # PREPROCESSING
    data(sample_ff, sample_key)
    sce <- prepData(sample_ff, by_time = FALSE)
    sce <- assignPrelim(sce, sample_key, verbose = FALSE)

    # split SCE by barcode population
    fs <- sce2fcs(sce, split_by = "bc_id")

    # do some spot checks
    library(flowCore)
    library(SingleCellExperiment)

    length(fs) == nrow(sample_key)
    all(fsApply(fs, nrow)[, 1] == table(sce$bc_id))
    identical(t(exprs(fs[[1]])), assay(sce, "exprs")[, sce$bc_id == "A1"])

    # DIFFERENTIAL ANALYSIS
    data(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- cluster(sce, verbose = FALSE)

    # split by 20 metacluster populations
    sce$meta20 <- cluster_ids(sce, "meta20")
    fs <- sce2fcs(sce, split_by = "meta20", assay = "exprs")
    all(fsApply(fs, nrow)[, 1] == table(sce$meta20))

[Package CATALYST version 1.16.2 Index]