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       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

table_to_matrix(network_table)[1:6, 1:6]
#>             g1          g2            g3          g4         g5           g6
#> g1  0.00000000  0.66844490  0.0180879493 -0.03658957 0.04489503 -0.030280993
#> g2  0.35630356  0.00000000  0.5492431610  0.02103272 0.01366921 -0.007459899
#> g3  0.01235281  0.70713027  0.0000000000  0.68526346 0.12187906 -0.001181702
#> g4 -0.02896993  0.03201306  0.8103064829  0.00000000 0.65615667  0.124827620
#> g5  0.03866820  0.02176632  0.1538770195  0.70453814 0.00000000  0.655663735
#> g6 -0.02979658 -0.01242983 -0.0005067688  0.14958079 0.72762920  0.000000000

table_to_matrix(
  network_table,
  regulators = c("g1", "g2"),
  targets = c("g3", "g4")
)
#>            g3          g4
#> g1 0.01808795 -0.03658957
#> g2 0.54924316  0.02103272