Skip to contents

This function runs an ensemble of different classification models to predict cluster assignments for test data, considering consensus among the models.

Usage

RunEnsemble(
  data.test,
  data.train,
  cluster.data,
  cluster.markers,
  surdata = NULL,
  time = "time",
  event = "event",
  methods = NULL,
  sur.trend.rank = NULL,
  cutoff.P = 0.05
)

Arguments

data.test

A numeric matrix or data frame of test data. Rows represent genes, and columns represent samples.

data.train

A numeric matrix or data frame of training data. Rows represent genes, and columns represent samples.

cluster.data

A data frame where the first column must be the sample IDs and the second column must be the cluster assignments. The sample IDs must match the column names of the training data.

cluster.markers

A list of data frames, each containing markers for a specific cluster, with columns 'Gene' indicating gene names.

surdata

A data frame containing survival information for the samples. The first column must be sample IDs.

time

A character string specifying the column name in `surdata` representing survival time (default: "time").

event

A character string specifying the column name in `surdata` representing the event status (default: "event").

methods

A character vector specifying which classifiers to use in the ensemble. If NULL, all available methods will be used (default: NULL).

sur.trend.rank

A character vector specifying the desired order of survival trends (e.g., c("C2", "C3", "C1")) to filter the models (default: NULL). Note: the order should be from risk to protective.

cutoff.P

Numeric value for the p-value cutoff for survival analysis (default: 0.05).

Value

A list containing the ensemble prediction results and optional survival analysis.

Details

This function runs an ensemble of classifiers, checks the consistency among classifiers, and optionally performs survival analysis to filter models based on trends in clinical outcomes.

Author

Zaoqu Liu; Email: liuzaoqu@163.com

Examples

# Example usage:
data.test <- matrix(rnorm(1000), nrow = 100, ncol = 10)
data.train <- matrix(rnorm(1000), nrow = 100, ncol = 10)
cluster.data <- data.frame(Sample = paste0("Sample", 1:10), Cluster = rep(1:2, each = 5))
cluster.markers <- setNames(lapply(unique(cluster.data$Cluster), function(c) data.frame(Gene = paste0("Gene", sample(1:30, 10)), OR = runif(10, 0.5, 2), AUC = runif(10))), unique(cluster.data$Cluster))
surdata <- data.frame(ID = paste0("Sample", 1:10), time = runif(10, 1, 1000), event = sample(0:1, 10, replace = TRUE))
result <- RunEnsemble(data.test, data.train, cluster.data, cluster.markers, surdata, time = "time", event = "event", methods = c("rf", "xgboost"), sur.trend.rank = c("C1", "C3", "C2"))