Unbiased Candidate Mechanism Generation

An implementation of the unbiased candidate mechanism (UCM) generation workflow.

This workflow can be used to address the inconsistency in the definitions of the boundaries of pathways, mechanisms, sub-graphs, etc. in networks and systems biology that are introduced during curation due to a variety of reasons.

A simple approach for generating unbiased candidate mechanisms is to take the upstream controllers.

This module provides functions for generating sub-graphs based around a single node, most likely a biological process.

Sub-graphs induced around biological processes should prove to be sub-graphs of the NeuroMMSig/canonical mechanisms and provide an even more rich mechanism inventory.

This method has been applied in the following Jupyter Notebooks:

pybel_tools.generation.remove_unweighted_leaves(graph, key=None)[source]

Remove nodes that are leaves and that don’t have a weight (or other key) attribute set.

Parameters
  • graph (BELGraph) – A BEL graph

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data. Defaults to pybel_tools.constants.WEIGHT.

Return type

None

pybel_tools.generation.is_unweighted_source(graph, node, key)[source]

Check if the node is both a source and also has an annotation.

Parameters
  • graph (BELGraph) – A BEL graph

  • node (BaseEntity) – A BEL node

  • key (str) – The key in the node data dictionary representing the experimental data

Return type

bool

pybel_tools.generation.get_unweighted_sources(graph, key=None)[source]

Get nodes on the periphery of the sub-graph that do not have a annotation for the given key.

Parameters
  • graph (BELGraph) – A BEL graph

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data

Return type

Iterable[BaseEntity]

Returns

An iterator over BEL nodes that are unannotated and on the periphery of this subgraph

pybel_tools.generation.remove_unweighted_sources(graph, key=None)[source]

Prune unannotated nodes on the periphery of the sub-graph.

Parameters
  • graph (BELGraph) – A BEL graph

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data. Defaults to pybel_tools.constants.WEIGHT.

Return type

None

pybel_tools.generation.prune_mechanism_by_data(graph, key=None)[source]

Remove all leaves and source nodes that don’t have weights.

Is a thin wrapper around remove_unweighted_leaves() and remove_unweighted_sources()

Parameters
  • graph – A BEL graph

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data. Defaults to pybel_tools.constants.WEIGHT.

Equivalent to:

>>> remove_unweighted_leaves(graph)
>>> remove_unweighted_sources(graph)
Return type

None

pybel_tools.generation.generate_mechanism(graph, node, key=None)[source]

Generate a mechanistic sub-graph upstream of the given node.

Parameters
  • graph (BELGraph) – A BEL graph

  • node (BaseEntity) – A BEL node

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data.

Return type

BELGraph

Returns

A sub-graph grown around the target BEL node

pybel_tools.generation.generate_bioprocess_mechanisms(graph, key=None)[source]

Generate a mechanistic sub-graph for each biological process in the graph using generate_mechanism().

Parameters
  • graph – A BEL graph

  • key (Optional[str]) – The key in the node data dictionary representing the experimental data.

Return type

Mapping[BiologicalProcess, BELGraph]