Skip to contents

Plot One Component

Usage

plot_one_component(
  napistu_list,
  component_list,
  score_overlay = NULL,
  score_label = NULL,
  score_palette = NULL,
  join_scores_on = "name",
  max_labeled_species = 20,
  network_layout = "fr",
  edge_width = 0.1
)

Arguments

napistu_list

A list containing loaded assets and bindings to Python modules.

sbml_dfs

SBML_dfs - the core pathway representation of the Napistu Python library

napistu_graph

Network graph - a Python igraph subclass with Napistu-specific attributes and methods

species_identifiers

Species identifier mappings

precomputed_distances

optional, distances between species nodes

species_names

A tibble containing the names of all genes, proteins, molecules, etc

identifiers_nest

A tibble with one row per ontology and a nested tibble containing all the identifiers and their corresponding molecular species

python_modules

A named list of Python modules: `napistu`

python_environment

See validate_python_environment

napistu_config

A `napistu_config` object dictating how the `napistu_list` was initialized

loaded_at

A date-time object indicating when `napistu_list` was initialized

component_list

a list produced by define_subgraphs containing the `component_graph` and `reaction_sources`

score_overlay

optional, vertex-level scores containing `score` and the merging attribute specified in `join_on`

score_label

optional, name of disease being overlaid

score_palette

optional, color palette for scores

join_scores_on

variable to use when merging vertices and score

max_labeled_species

the number of vertices to try to label. Some labels may be dropped to improve clarity.

network_layout

method to used for creating a network layout (e.g., `fr`, `kk`, `drl`)

edge_width

width of edges on graph

Examples

suppressPackageStartupMessages(library(dplyr))
setup_napistu_list(create_napistu_config())
#> 
#> ── Setting up Napistu environment ──────────────────────────────────────────────
#> No Python configuration specified, setting up conda environment
#> Using existing conda environment "napistu-env"
#> Python version 3.11 meets requirements
#> No assets configuration specified, loading bundled package data
#> Loading sbml_dfs from sbml_dfs.pkl
#> Error in value[[3L]](cond): Failed to load sbml_dfs from
#> /home/runner/work/_temp/Library/napistu.r/extdata/test_pathway/sbml_dfs.pkl:
#> ImportError: /usr/lib/x86_64-linux-gnu/libcrypto.so.3: version `OPENSSL_3.3.0'
#> not found (required by
#> /usr/share/miniconda/envs/napistu-env/lib/python3.11/lib-dynload/_ssl.cpython-311-x86_64-linux-gnu.so)
#> Run `reticulate::py_last_error()` for details.
subgraph_vertices <- sample(napistu_list$napistu_graph$vs["name"], 100)
#> Error: object 'napistu_list' not found
subgraph_list <- define_subgraphs(napistu_list, subgraph_vertices, max_components = 2)
#> Error: object 'napistu_list' not found
component_list <- subgraph_list[[1]]
#> Error: object 'subgraph_list' not found
score_overlay <- tibble::tibble(name = sample(subgraph_vertices, 20)) %>%
    dplyr::mutate(score = abs(stats::rnorm(dplyr::n())))
#> Error: object 'subgraph_vertices' not found
plot_one_component(
    napistu_list,
    component_list,
    score_overlay = score_overlay,
    score_palette = "log2 fold-change"
)
#> Error: object 'napistu_list' not found