get_active_ligand_target_df: Get active ligand-target network in data frame format.

View source: R/application_network_extraction.R

get_active_ligand_target_dfR Documentation

Get active ligand-target network in data frame format.

Description

get_active_ligand_target_df Get active ligand-target network, meaning that only target genes that are part of the response of interest will be kept as target genes. In addition, target genes with probability scores beneath a predefined cutoff will be removed from the nework.

Usage

get_active_ligand_target_df(response,ligand_target_matrix, ligands_position = "cols", cutoff = 0)

Arguments

response

A named logical vector indicating whether a gene is responding in a biological system or not (e.g. DE after cell-cell interaction)

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"

cutoff

A number indicating how high ligand-target probability scores should be in order to be kept. Default: 0. When 0 is used as cutoff and the input matrix is a discrete ligand-target assingment matrix, only TRUE interactions will be kept.

Value

A data frame representing the active ligand-target network; with variables $ligand, $target and $score.

Examples

## Not run: 
library(dplyr)
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network, source_weights_df)
setting = lapply(expression_settings_validation[1:2],convert_expression_settings_evaluation)
ligands = extract_ligands_from_settings(setting)
ligand_target_matrix = construct_ligand_target_matrix(weighted_networks, ligands)
ligand_target_matrix_discrete = make_discrete_ligand_target_matrix(ligand_target_matrix)
active_lt_df = get_active_ligand_target_df(setting[[1]] %>% .$response, ligand_target_matrix_discrete)

## End(Not run)

saeyslab/nichenetr documentation built on April 27, 2024, 9:24 p.m.