Assess probability that a target gene belongs to the geneset based on a multi-ligand random forest model
Source:R/application_prediction.R
assess_rf_class_probabilities.Rdassess_rf_class_probabilities Assess probability that a target gene belongs to the geneset based on a multi-ligand random forest model (with cross-validation). Target genes and background genes will be split in different groups in a stratified way.
Usage
assess_rf_class_probabilities(round,folds,geneset,background_expressed_genes,ligands_oi,ligand_target_matrix)Arguments
- round
Integer describing which fold of the cross-validation scheme it is.
- folds
Integer describing how many folds should be used.
- geneset
Character vector of the gene symbols of genes of which the expression is potentially affected by ligands from the interacting cell.
- background_expressed_genes
Character vector of gene symbols of the background, non-affected, genes (can contain the symbols of the affected genes as well).
- ligands_oi
Character vector giving the gene symbols of the ligands you want to build the multi-ligand with.
- ligand_target_matrix
The NicheNet ligand-target matrix denoting regulatory potential scores between ligands and targets (ligands in columns).
Value
A tibble with columns: $gene, $response, $prediction. Response indicates whether the gene belongs to the geneset of interest, prediction gives the probability this gene belongs to the geneset according to the random forest model.
Examples
if (FALSE) { # \dontrun{
weighted_networks <- construct_weighted_networks(lr_network, sig_network, gr_network, source_weights_df)
ligands <- list("TNF", "BMP2", "IL4")
ligand_target_matrix <- construct_ligand_target_matrix(weighted_networks, lr_network, ligands, ltf_cutoff = 0, algorithm = "PPR", damping_factor = 0.5, secondary_targets = FALSE)
potential_ligands <- c("TNF", "BMP2", "IL4")
geneset <- c("SOCS2", "SOCS3", "IRF1")
background_expressed_genes <- c("SOCS2", "SOCS3", "IRF1", "ICAM1", "ID1", "ID2", "ID3")
fold1_rf_prob <- assess_rf_class_probabilities(round = 1, folds = 2, geneset = geneset, background_expressed_genes = background_expressed_genes, ligands_oi = potential_ligands, ligand_target_matrix = ligand_target_matrix)
} # }