Switch matrix to network table

matrix_to_table(
  network_matrix,
  regulators = NULL,
  targets = NULL,
  threshold = 0
)

Arguments

network_matrix

The matrix of network weight.

regulators

Character vector of regulator names to filter by.

targets

Character vector of target names to filter by.

threshold

The threshold for filtering weights based on absolute values, defaults to 0.

Value

Network table

Examples

data("example_matrix")
network_table <- inferCSN(example_matrix)
#>  [2025-04-22 07:40:11] Running for <dense matrix>.
#>  [2025-04-22 07:40:11] Checking input parameters.
#>  [2025-04-22 07:40:11] Using L0 sparse regression model.
#>  [2025-04-22 07:40:11] Using 1 core
#>  [2025-04-22 07:40:11] Run done.
network_matrix <- table_to_matrix(network_table)
network_table_new <- matrix_to_table(network_matrix)
head(network_table)
#>   regulator target     weight
#> 1       g18     g1 -0.9223177
#> 2       g17    g18  0.8770468
#> 3        g4     g3  0.8103065
#> 4       g16    g15  0.7659245
#> 5       g17    g16  0.7558764
#> 6       g12    g11  0.7444053
head(network_table_new)
#>   regulator target     weight
#> 1       g18     g1 -0.9223177
#> 2       g17    g18  0.8770468
#> 3        g4     g3  0.8103065
#> 4       g16    g15  0.7659245
#> 5       g17    g16  0.7558764
#> 6       g12    g11  0.7444053
identical(
  network_table,
  network_table_new
)
#> [1] TRUE

matrix_to_table(
  network_matrix,
  threshold = 0.8
)
#>   regulator target     weight
#> 1       g18     g1 -0.9223177
#> 2       g17    g18  0.8770468
#> 3        g4     g3  0.8103065

matrix_to_table(
  network_matrix,
  regulators = c("g1", "g2"),
  targets = c("g3", "g4")
)
#>   regulator target      weight
#> 1        g2     g3  0.54924316
#> 2        g1     g4 -0.03658957
#> 3        g2     g4  0.02103272
#> 4        g1     g3  0.01808795