Skip to contents

Reduces a solution network based on a decoupling analysis of upstream and downstream gene expression, by filtering out edges that do not meet a consistency threshold, and limiting the network to a certain number of steps from upstream input nodes.

Usage

reduce_solution_network(
  decoupleRnival_res,
  meta_network,
  cutoff,
  upstream_input,
  RNA_input = NULL,
  n_steps = 10
)

Arguments

decoupleRnival_res

A data frame resulting from the decoupleRnival function.

meta_network

A network data frame containing signed directed prior knowledge of molecular interactions.

cutoff

The consistency threshold for filtering edges from the solution network.

upstream_input

A named vector with up_stream nodes and their corresponding activity.

RNA_input

A named vector containing differential gene expression data.

n_steps

The maximum number of steps from upstream input nodes to include in the solution network.

Value

A list containing the solution network (SIF) and an attribute table (ATT) with gene expression data.

Examples

# Example input data
upstream_input <- c("A" = 1, "B" = -1, "C" = 0.5)
downstream_input <- c("D" = 2, "E" = -1.5)
meta_network <- data.frame(
  source = c("A", "A", "B", "C", "C", "D", "E"),
  target = c("B", "D", "D", "E", "D", "B", "A"),
  interaction = c(-1, 1, -1, 1, -1, -1, 1)
)
RNA_input <- c("A" = 1, "B" = -1, "C" = 5, "D" = 0.7, "E" = -0.3)

# Run the decoupleRnival function to get the upstream influence scores
upstream_scores <- decoupleRnival(upstream_input, downstream_input, meta_network, n_layers = 2, n_perm = 100)
#> [1] "Warning, this function is deprecated and will no longer receive futur support. Please use the 'moon' function instead"

# Reduce the solution network based on the upstream influence scores
reduced_network <- reduce_solution_network(upstream_scores, meta_network, 0.4, upstream_input, RNA_input, 3)
#> [1] "COSMOS: removing nodes that are not reachable from inputs within 3 steps"
#> [1] "COSMOS: 0 from  4 interactions are removed from the PKN"

# View the resulting solution network and attribute table
print(reduced_network$SIF)
#>   source target interaction consistency
#> 1      A      B          -1        TRUE
#> 2      A      D           1        TRUE
#> 3      B      D          -1        TRUE
#> 6      D      B          -1        TRUE
print(reduced_network$ATT)
#>   nodes    score RNA_input
#> 1     A  1.05659       1.0
#> 2     B -1.05659      -1.0
#> 3     D  2.00000       0.7