cytoset: 'cytoset': a reference class for efficiently managing the...

Description Details Creating Objects Methods

View source: R/cytoset.R

Description

This class is a container for a set of cytoframe objects, analagous to a flowSet.

Details

Similar to the distinction between the cytoframe and flowFrame classes, the primary difference between the cytoset and flowSet classes is in the underlying representation of the data. Because cytoset is a reference class, copying or subsetting a cytoset object will return a cytoset pointing to the same underlying data. A deep copy of the data can be obtained via the realize_view method.

There is one notable exception to the typical behavior of most methods returning a cytoframe. The standard extraction operator ([[]]) will by default perform a deep copy of the subset being extracted and return a flowFrame. This is for the sake of compatibility with existing user scripts.

Creating Objects

Objects can be created using cytoset() and then adding samples by providing a cytoframe and sample name to cs_add_cytoframe:

1
2
cs <- cytoset()
cs_add_cytoframe(cs, "Sample Name", cytoframe)

The safest and easiest way to create cytosets directly from FCS files is via the load_cytoset_from_fcs function, and there are alternative ways to specify the files to read. See the separate documentation for details.

Methods

[, [[

Subsetting. x[i] where i is a scalar, returns a cytoset object, and x[[i]] a flowFrame object. In this respect the semantics are similar to the behavior of the subsetting operators for lists. x[i, j] returns a cytoset for which the parameters of each cytoframe have been subset according to j, x[[i,j]] returns the subset of a single flowFrame for all parameters in j.

The reason for the default behavior of the extraction operator [[]] returning a flowFrame rather than cytoframe is for backwards compatibility with existing user scripts. This behavior can be overridden to instead return a cytoframe with the additional returnType argument.

Usage:

cytoset[i]

cytoset[i,j]

cytoset[[i]]

cytoset[[i, returnType = "cytoframe"]]

get_cytoframe_from_cs

Extract a cytoframe from a cytoset by supplying either a sample name or index and optionally supplying a subset of columns.

The cytoframe to be extracted (i argument) can be specified using its sample name (character) or index in the cytoset (int/numeric). Columns (j argument) can be specified using channel name (character), index (int/numeric), or logical vector. If this argument is missing, all columns will be selected.

Usage:

(Assuming cs is a cytoset and cf is the extracted cytoframe) cf <- get_cytoframe_from_cs(cs, i, j) cf <- get_cytoframe_from_cs(cs, i)

$

Subsetting by frame name. This will return a single cytoframe object. Note that names may have to be quoted if they are not valid R symbols (e.g. cytoset$"sample 1").

colnames, colnames<-

Extract or replace the character object with the (common) column names of all the data matrices in the cytoframes.

Usage:

colnames(cytoset)

colnames(cytoset) <- value

identifier, identifier<-

Extract or replace the name item from the environment.

Usage:

identifier(cytoset)

identifier(cytoset) <- value

phenoData, phenoData<-

Extract or replace the AnnotatedDataFrame containing the phenotypic data for the whole data set. Each row corresponds to one of the cytoframes. The sampleNames of phenoData (see below) must match the names of the cytoframes in the frames environment.

Usage:

phenoData(cytoset)

phenoData(cytoset) <- value

pData, pData<-

Extract or replace the data frame (or columns thereof) containing actual phenotypic information from the phenoData of the underlying data.

Usage:

pData(cytoset)

pData(cytoset)$someColumn <- value

varLabels, varLabels<-

Not yet implemented.
Extract and set varLabels in the AnnotatedDataFrame of the phenoData of the underyling data.

Usage:

varLabels(cytoset)

varLabels(cytoset) <- value

sampleNames

Extract and replace sample names from the phenoData. Sample names correspond to frame identifiers, and replacing them will also replace the GUID for each cytoframe. Note that each sample name needs to be unique.

Usage:

sampleNames(cytoset)

sampleNames(cytoset) <- value

keyword

Extract or replace keywords specified in a character vector or a list from the description slot of each frame. See keyword for details.

Usage:

keyword(cytoset, list(keywords))

keyword(cytoset, keywords)

keyword(cytoset) <- list(foo="bar")

length

The number of cytoframe objects in the set.

Usage:

length(cytoset)

show

display object summary.

summary

Return descriptive statistical summary (min, max, mean and quantile) for each channel of each cytoframe.

Usage:

summary(cytoset)

fsApply

Apply a function on all frames in a cytoset object. Similar to sapply, but with additional parameters. See fsApply for details.

Usage:

fsApply(cytoset, function, ...)

fsApply(cytoset, function, use.exprs=TRUE, ...)

compensate

Apply a compensation matrix on all frames in a cytoset object. See compensate for details.

Usage:

compensate(cytoset, matrix)

transform

Apply a transformation function on all frames of a cytoset object. See transform for details.

Usage:

transform(cytoset, ...)

filter

Apply a filter on a cytoset object. There are methods for filter objects, and lists of filter objects. The latter has to be a named list, where names of the list items are matching the sampleNames of the cytoset. See filter for details.

Usage:

filter(cytoset, filter)

filter(cytoset, list(filters))

split

Split all cytoframe objects according to a filter, filterResult or a list of such objects, where the length of the list has to be the same as the length of the cytoset. This returns a list of cytoframes or an object of class cytoset if the flowSet argument is set to TRUE. Alternatively, a cytoset can be split into separate subsets according to a factor (or any vector that can be coerced into a factor), similar to the behaviour of split for lists. This will return a list of cytosets. See split for details.

Usage:

split(cytoset, filter)

split(cytoset, filterResult)

split(cytoset, list(filters))

split(cytoset, factor)

Subset

Returns a cytoset of cytoframes that have been subset according to a filter or filterResult, or according to a list of such items of equal length as the cytoset. See Subset for details.

Usage:

Subset(cytoset, filter)

Subset(cytoset, filterResult)

Subset(cytoset, list(filters))

rbind2

Not yet implemented.
Combine two cytoset objects, or one cytoset and one cytoframe object.

Usage:

rbind2(cytoset, cytoset)

rbind2(cytoset, cytoframe)

spillover

Compute spillover matrix from a compensation set. See spillover for details.

realize_view

Returns a new cytoset with its own copy of the underlying data (a deep copy). The optional filepath argument accepts a string to specify a full directory name for storing the new copies of the data from the FCS files in h5 format.

Usage:

realize_view(cytoset, filepath)

cs_add_cytoframe

Adds a cytoframe to the cytoset with sample name given by a string.

Usage:

cs_add_cytoframe(cytoset, "SampleName", cytoframe)


RGLab/flowWorkspace documentation built on June 30, 2020, 3 a.m.