cfList-class: Class cfList

Description Details Slots Methods Examples

Description

This is an S4 class that contains all the data and results for the cytofast workflow. Most functions in this package will both use and return a cfList.

Details

This class is used througout the cytofast workflow, most functions in this package will both use and return a cfList. FCS files created by Cytosplore can be easily read in with readCytosploreFCS) and will be returned as a cfList. It is also possible to manually create instances of this class if another clustering method is preferred. Below an example is shown for FlowSOM.

Slots

samples

data frame containing all meta information on each sample

expr

data frame containing the marker expression

counts

data frame containing (standardized) cell counts per cluster and per sample

results

list containing any results

Methods

samples

a method for obtaining the samples data

expr

a method for obtaining the marker expression

counts

a method for obtaining the cell counts

results

a method for obtaining any results from performed tests

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
26
27
28
29
30
31
32
33
34
### manually create instance of cfList class
library(FlowSOM)

## Cluster with FlowSOM
dirFCS <- system.file("extdata", package="cytofast")
fSOM <- FlowSOM(input = dirFCS, 
                transform = FALSE,
                scale = FALSE,
                colsToUse = c(9:11, 15:52),
                nClus = 10, # Note that this is an ambiguous choice
                seed = 123)

## expr slot
# retrieve clusters
clusterID <- as.factor(fSOM$FlowSOM$map$mapping[,1])
levels(clusterID) <- fSOM$metaclustering

# retrieve samples (As example, we assume each FCS file is its own sample)
sampleID <- lapply(fSOM$FlowSOM$metaData, function(x){rep(x[1], each = length(x[1]:x[2]))})
attr(sampleID, 'names') <- NULL
sampleID <- as.factor(unlist(sampleID)) 
levels(sampleID) <- paste("ID", 1:10, sep="_")

exprD <- data.frame(clusterID, 
                    sampleID, 
                    fSOM$FlowSOM$data[, c(9:11, 15:52)])

## samples slot
samplesD <- data.frame(sampleID = levels(sampleID), 
                       group = rep(c("group1", "group1"), each=5)) 

## create cfList
cfList(samples = samplesD,
       expr = exprD)

cytofast documentation built on Nov. 8, 2020, 5:46 p.m.