Get ligand importances based on target gene value prediction performance of single ligands (regression).
Source:R/evaluate_model_ligand_prediction.R
get_single_ligand_importances_regression.Rdget_single_ligand_importances_regression Get ligand importance measures for ligands based on how well a single, individual, ligand can predict an observed response. Assess how well every ligand of interest is able to predict the observed transcriptional response in a particular dataset, according to the ligand-target model. It can be assumed that the ligand that best predicts the observed response, is more likely to be the true ligand. Response: continuous values associated to a gene, e.g. a log fold change value.
Usage
get_single_ligand_importances_regression(setting,ligand_target_matrix, ligands_position = "cols", known = TRUE)Arguments
- setting
A list containing the following elements: .$name: name of the setting; .$from: name(s) of the ligand(s) of which the predictve performance need to be assessed; .$response: the observed target response: indicate for a gene whether it was a target or not in the setting of interest. $ligand: NULL or the name of the ligand(s) that are known to be active in the setting of interest.
- ligand_target_matrix
A matrix of ligand-target probabilty scores (or discrete target assignments).
- ligands_position
Indicate whether the ligands in the ligand-target matrix are in the rows ("rows") or columns ("cols"). Default: "cols"
- known
Indicate whether the true active ligand for a particular dataset is known or not. Default: TRUE. The true ligand will be extracted from the $ligand slot of the setting.
Value
A data.frame with for each ligand - data set combination, regression model fit metrics indicating how well the query ligand predicts the response in the particular dataset. Evaluation metrics are the same as in evaluate_target_prediction_regression. In addition to the metrics, the name of the particular setting ($setting), the name of the query ligand($test_ligand), the name of the true active ligand (if known: $ligand).
Examples
if (FALSE) { # \dontrun{
settings <- lapply(expression_settings_validation[1:5], convert_expression_settings_evaluation_regression)
settings_ligand_pred <- convert_settings_ligand_prediction(settings, all_ligands = unlist(extract_ligands_from_settings(settings, combination = FALSE)), validation = TRUE, single = TRUE)
weighted_networks <- construct_weighted_networks(lr_network, sig_network, gr_network, source_weights_df)
ligands <- extract_ligands_from_settings(settings_ligand_pred, combination = FALSE)
ligand_target_matrix <- construct_ligand_target_matrix(weighted_networks, lr_network, ligands)
ligand_importances <- dplyr::bind_rows(lapply(settings_ligand_pred, get_single_ligand_importances_regression, ligand_target_matrix))
print(head(ligand_importances))
} # }