make_connection: Specify connection between two individual layers

Description Usage Arguments Details Value Examples

View source: R/pipeline_functions.R

Description

Helper function to transform input data to a required pipeline input format. This helper function creates a list that specifies the connection between two layers.

Usage

1
make_connection(from, to, connect_on, weight = 1, group = "both")

Arguments

from

Character string referring to the name of the layer **from** which the connection should be established

to

Character string referring to the name of the layer **to** which the connection should be established

connect_on

Specifies how the two layers should be connected. This can be based on a mutual ID or a table specifying interactions: * __Mutual ID__: Character string specifying the name of an identifier that is present in both layers (e.g., 'NCBI ID' to connect proteins and mRNA). * __Interaction table__: A table mapping two identifiers of two layers. The columns have exactly the same names as the identifiers of the layers. Has to contain an additional column specifying the weight between two components/nodes (see 'weight' argument)

weight

Specifies the edge weight between the layers. This can be supplied as a number applied to every connection or a column of the interaction table: * __Fixed weight__: number specifying the weight of every connection between the layers. * __Based on interaction table__: Character string specifying the name of a column in the table passed as the 'by' parameter which is used as edge weight.

group

Group for which to apply the connection. One of 'both', '1' or '2'.

Details

The connection can be based on IDs present in the identifiers of both layer or an interaction table containing mapping the connections and edge weights. Additionally, the supplied input is checked. Allows easy conversion of raw data into the structure accepted by start_pipeline.

__IMPORTANT:__ if a connection is established based on id this ID has to be present in the identifiers of both layers, have to be named identically and IDs have to be formatted identically as these are matched by an inner join operation (refer to make_layer).

Value

A named list (i.e., an inter-layer connection), that can be supplied to start_pipeline.

Examples

1
2
3
4
5
6
7
data(metabolite_protein_interaction)
inter_layer_connections = list(
make_connection(from = 'mrna', to = 'protein', connect_on = 'gene_name'),
make_connection(from = 'protein', to = 'phosphoprotein', connect_on = 'gene_name'),
make_connection(from = 'protein', to = 'metabolite',
connect_on = metabolite_protein_interaction,
weight = 'combined_score'))

molnet-org/molnet documentation built on Dec. 21, 2021, 8:59 p.m.