Skip to contents

Runs COSMOS from signaling to metabolism. This function uses CARNIVAL to find a subset of the prior knowledge network based on optimisation that (1) includes the most measured and input nodes and (2) which is in agreement with the data. Use preprocess_COSMOS_signaling_to_metabolism to prepare inputs, measurements and prior knowledge network.

Usage

run_COSMOS_signaling_to_metabolism(
  data,
  CARNIVAL_options = default_CARNIVAL_options("lpSolve")
)

Arguments

data

cosmos_data object. Use the preprocess_COSMOS_signaling_to_metabolism function to create an instance.

CARNIVAL_options

List that controls the options of CARNIVAL. See details in default_CARNIVAL_options.

Value

List with the following elements:

weightedSIF

The averaged networks found by optimization in a format of a Simple Interaction network, i.e. each row codes an edge

N_networks

Number of solutions found by the optimization

nodesAttributes

Estimated node properties

individual_networks

List of optimial networks found

individual_networks_node_attributes

Node activity in each network

Examples

data(toy_network)
data(toy_signaling_input)
data(toy_metabolic_input)
data(toy_RNA)
test_for <- preprocess_COSMOS_signaling_to_metabolism(meta_network = toy_network,
                             signaling_data = toy_signaling_input,
                             metabolic_data = toy_metabolic_input,
                             diff_expression_data = toy_RNA,
                             maximum_network_depth = 15,
                             remove_unexpressed_nodes = TRUE,
                             CARNIVAL_options = default_CARNIVAL_options("lpSolve"))
#> [1] "COSMOS: all 3 signaling nodes from data were found in the meta PKN"
#> [1] "COSMOS: all 2 metabolic nodes from data were found in the meta PKN"
#> [1] "COSMOS: 2975 of the 9300 genes in expression data were found as transcription factor target"
#> [1] "COSMOS: 2975 of the 5321 transcription factor targets were found in expression data"
#> [1] "COSMOS: removing unexpressed nodes from PKN..."
#> [1] "COSMOS: 0 interactions removed"
#> [1] "COSMOS: removing nodes that are not reachable from inputs within 15 steps"
#> [1] "COSMOS: 0 from  101 interactions are removed from the PKN"
#> [1] "COSMOS: removing nodes that are not observable by measurements within 15 steps"
#> [1] "COSMOS: 52 from  101 interactions are removed from the PKN"
#> [1] "COSMOS: 2 input/measured nodes are not in PKN any more: USF1, SRF and 0 more."
#> [1] "COSMOS:  0 interactions are removed from the PKN based on consistency check between TF activity and gene expression"
#> [1] "lpSolve does not scale well with large PKNs. This solver is mainly for testing purposes. To run COSMSO, we recommend using cplex, or cbc solvers."
#> [1] "lpSolve does not scale well with large PKNs. This solver is mainly for testing purposes. To run COSMSO, we recommend using cplex, or cbc solvers."
#> --- Start of the CARNIVAL pipeline ---
#> 09:22:13 15.09.2023 Carnival flavour: vanilla
#> 09:22:13 15.09.2023 Generating variables for lp problem
#> 09:22:13 15.09.2023 Done: generating variables for lp problem
#> Saving preprocessed data.
#> Done: saving parsed data: /tmp/RtmpHtZXaF/file15761f3df371/reference//parsedData_t09_22_13d15_09_2023n5.RData
#> 09:22:13 15.09.2023 Generating formulation for LP problem
#> 09:22:13 15.09.2023 Done: generating formulation for LP problem.
#> Saving LP file
#> Done: Saving LP file: /tmp/RtmpHtZXaF/file15761f3df371/reference//lpFile_t09_22_13d15_09_2023n5.lp
#> 09:22:13 15.09.2023 Solving LP problem
#> Parsing .lp file for lpSolve
#> Rows: 882 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): X1
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Done: parsing .lp file for lpSolve
#> 09:22:13 15.09.2023 Done: solving LP problem.
#> 09:22:13 15.09.2023 Getting the solution matrix
#> 09:22:13 15.09.2023 Done: getting the solution matrix.
#> 09:22:13 15.09.2023 Exporting solution matrix
#> 09:22:13 15.09.2023 Done: exporting solution matrix.
#> Cleaning intermediate files
#> Done: cleaning
#> 09:22:13 15.09.2023 All tasks finished.
#> 
#> --- End of the CARNIVAL pipeline --- 
#> [1] "COSMOS:  0 interactions are removed from the PKN based on consistency check between TF activity and gene expression"
#> [1] "COSMOS: all 1 signaling nodes from data were found in the meta PKN"
#> [1] "COSMOS: all 2 metabolic nodes from data were found in the meta PKN"
#> [1] "COSMOS: 2975 of the 9300 genes in expression data were found as transcription factor target"
#> [1] "COSMOS: 2975 of the 5321 transcription factor targets were found in expression data"

test_result_for <- run_COSMOS_signaling_to_metabolism(data = test_for,
                             CARNIVAL_options = default_CARNIVAL_options("lpSolve"))
#> [1] "lpSolve does not scale well with large PKNs. This solver is mainly for testing purposes. To run COSMSO, we recommend using cplex, or cbc solvers."
#> Input nodes should have values from {-1, 0, 1}. We discretize your input with sign().
#> [1] "lpSolve does not scale well with large PKNs. This solver is mainly for testing purposes. To run COSMSO, we recommend using cplex, or cbc solvers."
#> --- Start of the CARNIVAL pipeline ---
#> 09:22:13 15.09.2023 Carnival flavour: vanilla
#> 09:22:13 15.09.2023 Generating variables for lp problem
#> 09:22:13 15.09.2023 Done: generating variables for lp problem
#> Saving preprocessed data.
#> Done: saving parsed data: /tmp/RtmpHtZXaF/file15761f3df371/reference//parsedData_t09_22_13d15_09_2023n75.RData
#> 09:22:13 15.09.2023 Generating formulation for LP problem
#> 09:22:13 15.09.2023 Done: generating formulation for LP problem.
#> Saving LP file
#> Done: Saving LP file: /tmp/RtmpHtZXaF/file15761f3df371/reference//lpFile_t09_22_13d15_09_2023n75.lp
#> 09:22:13 15.09.2023 Solving LP problem
#> Parsing .lp file for lpSolve
#> Rows: 882 Columns: 1
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): X1
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> Done: parsing .lp file for lpSolve
#> 09:22:14 15.09.2023 Done: solving LP problem.
#> 09:22:14 15.09.2023 Getting the solution matrix
#> 09:22:14 15.09.2023 Done: getting the solution matrix.
#> 09:22:14 15.09.2023 Exporting solution matrix
#> 09:22:14 15.09.2023 Done: exporting solution matrix.
#> Cleaning intermediate files
#> Done: cleaning
#> 09:22:14 15.09.2023 All tasks finished.
#> 
#> --- End of the CARNIVAL pipeline ---