Skip to contents

Predict Lund Taxonomy subtypes based on rule-based Random Forest classifiers.

Usage

classify_samples(
  this_data = NULL,
  gene_id = "hgnc_symbol",
  threshold_progression = 0.58,
  threshold_grade = 0.5,
  log_transform = FALSE,
  adjust = TRUE,
  adj_factor = 5.1431,
  impute = TRUE,
  impute_reject = 0.67,
  impute_kNN = 5,
  subtype_only = FALSE,
  include_data = FALSE,
  include_pred_scores = TRUE,
  verbose = TRUE
)

Arguments

this_data

Required parameter. Data frame or matrix with expression values.

gene_id

Specify the type of gene identifier used in this_data. Accepted values are; hgnc_symbol (default) or ensembl_gene_id. The function expects the incoming expression data to have gene identifiers as row names. If Ensembl IDs are selected, the function also expects them to be non-versioned for a successful conversion to HGNC symbols.

threshold_progression

Threshold to flag a sample as high risk of progression, default is 0.58.

threshold_grade

Threshold to flag a sample as high grade, default is 0.5.

log_transform

Boolean parameter. If TRUE, the function log transforms the incoming expression values. Default is FALSE.

adjust

Boolean parameter. If TRUE (default), the function will proceed with adjusting the scores based on stable genes. If FALSE, no adjustment will be made and the original score values will be retained.

adj_factor

Only applicable if adjust is set to TRUE. Allows users to apply a proportional adjustment to the normalized scores, enabling finer control over the final output values. After dividing each score by the mean expression of stable genes, the result is multiplied by this factor.

impute

From multiclassPairs::predict_RF(). Boolean. To determine if missed genes and NA values should be imputed or not. The non missed rules will be used to determine the closest samples in the training binary matrix (i.e. which is stored in the classifier object). For each sample, the mode value for nearest samples in the training data will be assigned to the missed rules. Default is TRUE

impute_reject

From multiclassPairs::predict_RF(). A number between 0 and 1 indicating the threshold of the missed rules in the sample. Based on this threshold the sample will be rejected (i.e. skipped if higher than the impute_reject threshold) and the missed rules will not be imputed in this sample. Default is 0.67. NOTE, The results object will not have any results for this sample.

impute_kNN

From multiclassPairs::predict_RF(). Integer determines the number of the nearest samples in the training data to be used in the imputation. Default is 5. It is not recommended to use large number (i.e. >10).

subtype_only

Boolean parameter. Set to TRUE to return subtypes and nothing else. Default is FALSE.

include_data

Boolean parameter. Set to TRUE to include data in output, FALSE is default.

include_pred_scores

Boolean parameter. Set to TRUE (default) to include prediction scores for each sample and class in output.

verbose

A logical value indicating whether processing messages will be printed or not. Default is TRUE.

Value

Returns a list object including: Data (optional, not included by default), Prediction scores for all classes (optional, included by default), Predicted LundTax class for 7-class system, Predicted LundTax class for 5-class system, as well a data frame with missing genes information.

Details

This function uses 2 classifiers to classify the samples: 5-class classifier first classifies samples into Uro, GU, BaSq, Mes or ScNE. Samples classified as Uro receive a second classification as UroA, B or C by the second classifier. This function internally calls int_calc_signatures() for retrieving signature scores.

Examples

#load your gene expression data, genes as rows, samples as columns
data("sjodahl_2017")

#classify samples
sjodahl_classes = classify_samples(this_data = sjodahl_2017,
                                   log_transform = FALSE,
                                   adjust = TRUE,
                                   impute = TRUE,
                                   include_data = TRUE,
                                   verbose = FALSE)

#view data
summary(sjodahl_classes)
#>                      Length Class      Mode     
#> data                  267   data.frame list     
#> subtype_scores       2937   -none-     numeric  
#> predictions_7classes  267   -none-     character
#> predictions_5classes  267   -none-     character
#> scores                 35   data.frame list     
#> na_genes                3   data.frame list