RandomF_predict: Predict cell labels based on a model constructed using...

Description Usage Arguments Examples

View source: R/RandomF_predict.R

Description

Predict cell labels based on a model constructed using RandomF_FCS function.

Usage

1
2
3
4
5
6
7
8
RandomF_predict(
  x,
  new_data,
  cleanFCS = FALSE,
  param = c("FL1-H", "FL3-H", "FSC-H", "SSC-H"),
  timesplit = 0.1,
  TimeChannel = "Time"
)

Arguments

x

Random forest model outputted from the RandomF_FCS function.

new_data

flowSet containing the data to be predicted.

cleanFCS

Indicate whether outlier removal should be conducted prior to model prediction. Defaults to FALSE. I would recommend to make sure samples have > 500 cells. Will denoise based on the parameters specified in 'param'.

param

Parameters required to denoise the new_data

timesplit

Fraction of timestep used in flowAI for denoising. Please consult the 'flowAI::flow_auto_qc' function for more information.

TimeChannel

Name of time channel in the FCS files. This can differ between flow cytometers. Defaults to "Time". You can check this by: colnames(flowSet).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Load raw data (imported using flowCore)
data(flowData)

# Format necessary metadata
metadata <- data.frame(names = flowCore::sampleNames(flowData), 
do.call(rbind, lapply(strsplit(flowCore::sampleNames(flowData),"_"), rbind)))
colnames(metadata) <- c("name", "Cycle_nr", "Location", "day", 
"timepoint", "Staining", "Reactor_phase", "replicate")

# Run Random Forest classifier to predict the Reactor phase based on the
# single-cell FCM data
model_rf <- RandomF_FCS(flowData, sample_info = metadata, target_label = "Reactor_phase",
downsample = 10)

# Make a model prediction on new data and report contigency table of predictions
model_pred <- RandomF_predict(x = model_rf[[1]], new_data =  flowData[1], cleanFCS = FALSE)

rprops/Phenoflow_package documentation built on Sept. 22, 2020, 5:43 p.m.