Reporting explanations (indra.explanation.reporting)

class indra.explanation.reporting.PybelEdge(source, target, relation, reverse)
property relation

Alias for field number 2

property reverse

Alias for field number 3

property source

Alias for field number 0

property target

Alias for field number 1

class indra.explanation.reporting.RefEdge(source, relation, target)[source]

Refinement edge representing ontological relationship between nodes.

Parameters
  • source (indra.statements.Agent) – Source agent of the edge.

  • target (indra.statements.Agent) – Target agent of the edge.

  • relation (str) – ‘is_ref’ or ‘has_ref’ depending on the direction.

indra.explanation.reporting.stmt_from_rule(rule_name, model, stmts)[source]

Return the source INDRA Statement corresponding to a rule in a model.

Parameters
  • rule_name (str) – The name of a rule in the given PySB model.

  • model (pysb.core.Model) – A PySB model which contains the given rule.

  • stmts (list[indra.statements.Statement]) – A list of INDRA Statements from which the model was assembled.

Returns

stmt – The Statement from which the given rule in the model was obtained.

Return type

indra.statements.Statement

indra.explanation.reporting.stmts_from_indranet_path(path, model, signed, from_db=True, stmts=None)[source]

Return source Statements corresponding to a path in an IndraNet model (found by SignedGraphModelChecker or UnsignedGraphModelChecker).

Parameters
  • path (list[tuple[str, int]]) – A list of tuples where the first element of the tuple is the name of an agent, and the second is the associated polarity along a path.

  • model (nx.Digraph or nx.MultiDiGraph) – An IndraNet model flattened into an unsigned DiGraph or signed MultiDiGraph.

  • signed (bool) – Whether the model and path are signed.

  • from_db (bool) – If True, uses statement hashes to query the database. Otherwise, looks for path statements in provided stmts.

  • stmts (Optional[list[indra.statements.Statement]]) – A list of INDRA Statements from which the model was assembled. Required if from_db is set to False.

Returns

path_stmts – A list of lists of INDRA statements explaining the path (each inner corresponds to one step in the path because the flattened model can have multiple statements per edge).

Return type

list[[indra.statements.Statement]]

indra.explanation.reporting.stmts_from_pybel_path(path, model, from_db=True, stmts=None)[source]

Return source Statements corresponding to a path in a PyBEL model.

Parameters
  • path (list[tuple[str, int]]) – A list of tuples where the first element of the tuple is the name of an agent, and the second is the associated polarity along a path.

  • model (pybel.BELGraph) – A PyBEL BELGraph model.

  • from_db (bool) – If True, uses statement hashes to query the database. Otherwise, looks for path statements in provided stmts.

  • stmts (Optional[list[indra.statements.Statement]]) – A list of INDRA Statements from which the model was assembled. Required if from_db is set to False.

Returns

path_stmts – A list of lists of INDRA statements explaining the path (each inner corresponds to one step in the path because PyBEL model can have multiple edges representing multiple statements and evidences between two nodes).

Return type

list[[indra.statements.Statement]]

indra.explanation.reporting.stmts_from_pysb_path(path, model, stmts)[source]

Return source Statements corresponding to a path in a model.

Parameters
  • path (list[tuple[str, int]]) – A list of tuples where the first element of the tuple is the name of a rule, and the second is the associated polarity along a path.

  • model (pysb.core.Model) – A PySB model which contains the rules along the path.

  • stmts (list[indra.statements.Statement]) – A list of INDRA Statements from which the model was assembled.

Returns

path_stmts – The Statements from which the rules along the path were obtained.

Return type

list[indra.statements.Statement]