Switch network table to matrix

table_to_matrix(network_table, regulators = NULL, targets = NULL)

Arguments

network_table

The weight data table of network.

regulators

Regulators list.

targets

Targets list.

Value

Weight matrix

Examples

data("example_matrix")
network_table <- inferCSN(example_matrix)
#>  Running for <dense matrix>.
#>  Checking input parameters.
#>  Using L0 sparse regression model.
#>  Using 1 core.
#>  Run done.
head(network_table)
#>   regulator target     weight
#> 1       g17    g18  0.5443805
#> 2       g18     g1 -0.5390453
#> 3       g16    g15  0.4818454
#> 4       g17    g16  0.4599054
#> 5       g15    g14  0.4516497
#> 6       g14    g13  0.4483912

table_to_matrix(network_table)[1:6, 1:6]
#>              g1           g2            g3          g4          g5
#> g1  0.000000000  0.338137767  0.0092681907 -0.01975279 0.022905010
#> g2  0.208240363  0.000000000  0.2814299337  0.01135446 0.006973898
#> g3  0.007219557  0.357707045  0.0000000000  0.36993781 0.062181513
#> g4 -0.016931373  0.016194043  0.4151977047  0.00000000 0.334764758
#> g5  0.022599496  0.011010652  0.0788459511  0.38034320 0.000000000
#> g6 -0.017414505 -0.006287723 -0.0002596662  0.08075083 0.371229345
#>               g6
#> g1 -0.0159799588
#> g2 -0.0039367559
#> g3 -0.0006236106
#> g4  0.0658743327
#> g5  0.3460084473
#> g6  0.0000000000

table_to_matrix(
  network_table,
  regulators = c("g1", "g2"),
  targets = c("g3", "g4")
)
#>             g3          g4
#> g1 0.009268191 -0.01975279
#> g2 0.281429934  0.01135446