cfList-class: Class cfList

cfList-classR Documentation

Class cfList

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

### 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$map$mapping[,1])
levels(clusterID) <- fSOM$metaclustering

# retrieve samples (As example, we assume each FCS file is its own sample)
sampleID <- lapply(fSOM$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$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)


KoenAStam/cytofast documentation built on June 1, 2022, 1:15 a.m.