sce2fcs: SCE to 'flowFrame/Set'

Description Usage Arguments Value Author(s) Examples

View source: R/sce2fcs.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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))

CATALYST documentation built on Nov. 8, 2020, 6:53 p.m.