napistu.network.paths

Functions

find_all_shortest_reaction_paths(...[, ...])

Shortest Reaction Paths

find_shortest_reaction_paths(napistu_graph, ...)

Shortest Reaction Paths

plot_shortest_paths(napistu_graph)

Plot a shortest paths graph.

napistu.network.paths._calculate_net_polarity(link_polarity_series: Series) str

Determine whether a path implies activation, inhbition, or an ambiguous regulatory relationship.

napistu.network.paths._filter_paths_by_precomputed_distances(all_species_pairs: DataFrame, precomputed_distances: DataFrame | None = None) DataFrame

Filter source -> destination pairs based on precomputed distances if they were provided.

napistu.network.paths._label_path_reactions(sbml_dfs: SBML_dfs, paths_df: DataFrame)

Create labels for reactions in a shortest path.

napistu.network.paths._patch(x: Any)
napistu.network.paths._terminal_net_polarity(link_polarity_series: Series) str

Figure out the net polarity for the vertex at the end of a path.

napistu.network.paths.find_all_shortest_reaction_paths(napistu_graph: NapistuGraph, sbml_dfs: SBML_dfs, target_species_paths: DataFrame, weight_var: str = 'weight', precomputed_distances: DataFrame | None = None, min_pw_size: int = 3, source_total_counts: Series | DataFrame | None = None, verbose: bool = False)

Shortest Reaction Paths

Find all shortest paths between a source and destination entity

Parameters:
  • napistu_graph (NapistuGraph) – A network interconnecting molecular species and reactions (subclass of igraph.Graph)

  • sbml_dfs (SBML_dfs) – A model formed by aggregating pathways

  • target_species_paths (pd.DataFrame) – Pairs of source and destination compartmentalized species; produced by compartmentalize_species_pairs()

  • weight_var (str) – An edge attribute to use when forming a weighted shortest path

  • precomputed_distances (pd.DataFrame | None) – A table containing precalculated path summaries between pairs of compartmentalized species

  • min_pw_size (int) – the minimum size of a pathway to be considered

  • source_total_counts (pd.Series | pd.DataFrame | None) – A pd.Series of the total counts of each source or a pd.DataFrame with two columns: pathway_id and total_counts. As produced by source.get_source_total_counts(). If None, pathways will be selected by size rather than statistical enrichment.

  • verbose (bool) – Whether to print verbose output

  • Returns

  • ----------

  • all_shortest_reaction_paths_df (pd.DataFrame) – Nodes in all shortest paths

  • all_shortest_reaction_path_edges_df (pd.DataFrame) – Edges in all shortest paths

  • reaction_sources (pd.DataFrame) – Sources of reactions identifying the models where they originated

  • paths_graph (igraph.Graph) – Network formed by all shortest paths

napistu.network.paths.find_shortest_reaction_paths(napistu_graph: NapistuGraph, sbml_dfs: SBML_dfs, origin: str, dest: str | list, weight_var: str) tuple[DataFrame, DataFrame] | None

Shortest Reaction Paths

Find all shortest paths between an origin and destination entity

Parameters:
  • napistu_graph (NapistuGraph) – A network of molecular species and reactions (subclass of igraph.Graph)

  • sbml_dfs (sbml_dfs_core.SBML_dfs) – A model formed by aggregating pathways

  • origin (str) – A node to start at

  • dest (str | list) – Node(s) to reach

  • weight_var (str) – An edge attribute to use when forming a weighted shortest path

  • Returns

  • ----------

  • pd.DataFrames (Node paths and edges)

napistu.network.paths.plot_shortest_paths(napistu_graph: NapistuGraph) NapistuGraph.plot

Plot a shortest paths graph.