Skip to contents

Renames a given network to these column names: .source, .target, .mor, If .mor is not provided, then the function sets them to default values.

Usage

rename_net(
  network,
  .source,
  .target,
  .mor = NULL,
  .likelihood = NULL,
  def_mor = 1
)

Arguments

network

Tibble or dataframe with edges and it's associated metadata.

.source

Column with source nodes.

.target

Column with target nodes.

.mor

Column with edge mode of regulation (i.e. mor).

.likelihood

Deprecated argument. Now it will always be set to 1.

def_mor

Default value for .mor when not provided.

Examples

inputs_dir <- system.file("testdata", "inputs", package = "decoupleR")
mat <- readRDS(file.path(inputs_dir, "mat.rds"))
net <- readRDS(file.path(inputs_dir, "net.rds"))
rename_net(net, source, target, mor)
#> # A tibble: 10 × 4
#>    source target   mor likelihood
#>    <chr>  <chr>  <dbl>      <dbl>
#>  1 T1     G01      1            1
#>  2 T1     G02      1            1
#>  3 T1     G03      0.7          1
#>  4 T2     G06      1            1
#>  5 T2     G07      0.5          1
#>  6 T2     G08      1            1
#>  7 T3     G06     -0.5          1
#>  8 T3     G07     -3            1
#>  9 T3     G08     -1            1
#> 10 T3     G11      1            1