Skip to contents

Use a trained TorchDecon model or ensemble to predict cell type fractions from bulk RNA-seq data.

Usage

PredictFractions(
  model,
  data,
  scaling = "log_min_max",
  return_all = FALSE,
  verbose = TRUE
)

Arguments

model

A trained TorchDeconModel or TorchDeconEnsemble object.

data

Matrix, data frame, or file path to bulk RNA-seq data (genes x samples). Can also be a TorchDeconProcessed object.

scaling

Character. Scaling method to apply. Default is "log_min_max". Set to NULL to skip scaling (if data is already processed).

return_all

Logical. For ensemble, return predictions from all models in addition to the average. Default is FALSE.

verbose

Logical. Print progress messages. Default is TRUE.

Value

A data frame of predicted cell type fractions with samples as rows and cell types as columns. If return_all = TRUE for ensemble, returns a list with 'average' and individual model predictions.

Details

For ensemble models, predictions are averaged across all three sub-models (m256, m512, m1024) to produce the final prediction.

The input data must contain the same genes used during training. Missing genes will cause an error.

Examples

if (FALSE) { # \dontrun{
# Predict with a trained ensemble
predictions <- PredictFractions(trained_ensemble, bulk_data)

# Get individual model predictions
all_predictions <- PredictFractions(trained_ensemble, bulk_data, return_all = TRUE)
} # }