Summary¶
Summary functions for BEL graphs.
-
pybel.struct.summary.get_syntax_errors(graph)[source]¶ List the syntax errors encountered during compilation of a BEL script.
-
pybel.struct.summary.count_error_types(graph)[source]¶ Count the occurrence of each type of error in a graph.
-
pybel.struct.summary.count_naked_names(graph)[source]¶ Count the frequency of each naked name (names without namespaces).
-
pybel.struct.summary.calculate_incorrect_name_dict(graph)[source]¶ Get missing names grouped by namespace.
-
pybel.struct.summary.calculate_error_by_annotation(graph, annotation)[source]¶ Group error names by a given annotation.
-
pybel.struct.summary.get_functions(graph)[source]¶ Get the set of all functions used in this graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of functions
-
pybel.struct.summary.count_functions(graph)[source]¶ Count the frequency of each function present in a graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A Counter from {function: frequency}
-
pybel.struct.summary.count_namespaces(graph)[source]¶ Count the frequency of each namespace across all nodes (that have namespaces).
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Returns
A Counter from {namespace: frequency}
- Return type
-
pybel.struct.summary.get_namespaces(graph)[source]¶ Get the set of all namespaces used in this graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of namespaces
-
pybel.struct.summary.count_names_by_namespace(graph, namespace)[source]¶ Get the set of all of the names in a given namespace that are in the graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
namespace (
str) – A namespace keyword
- Return type
- Returns
A counter from {name: frequency}
- Raises
IndexError – if the namespace is not defined in the graph.
-
pybel.struct.summary.get_names_by_namespace(graph, namespace)[source]¶ Get the set of all of the names in a given namespace that are in the graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
namespace (
str) – A namespace keyword
- Return type
- Returns
A set of names belonging to the given namespace that are in the given graph
- Raises
IndexError – if the namespace is not defined in the graph.
-
pybel.struct.summary.get_unused_namespaces(graph)[source]¶ Get the set of all namespaces that are defined in a graph, but are never used.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of namespaces that are included but not used
-
pybel.struct.summary.count_variants(graph)[source]¶ Count how many of each type of variant a graph has.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
-
pybel.struct.summary.count_pathologies(graph)[source]¶ Count the number of edges in which each pathology is incident.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
Counter[BaseEntity]
-
pybel.struct.summary.get_top_pathologies(graph, n=15)[source]¶ Get the top highest relationship-having edges in the graph by BEL.
-
pybel.struct.summary.iterate_pubmed_identifiers(graph)[source]¶ Iterate over all PubMed identifiers in a graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
An iterator over the PubMed identifiers in the graph
-
pybel.struct.summary.get_pubmed_identifiers(graph)[source]¶ Get the set of all PubMed identifiers cited in the construction of a graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of all PubMed identifiers cited in the construction of this graph
-
pybel.struct.summary.iter_annotation_value_pairs(graph)[source]¶ Iterate over the key/value pairs, with duplicates, for each annotation used in a BEL graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
-
pybel.struct.summary.iter_annotation_values(graph, annotation)[source]¶ Iterate over all of the values for an annotation used in the graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
annotation (str) – The annotation to grab
- Return type
-
pybel.struct.summary.get_annotation_values_by_annotation(graph)[source]¶ Get the set of values for each annotation used in a BEL graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A dictionary of {annotation key: set of annotation values}
-
pybel.struct.summary.get_annotation_values(graph, annotation)[source]¶ Get all values for the given annotation.
- Parameters
graph (pybel.BELGraph) – A BEL graph
annotation (
str) – The annotation to summarize
- Return type
- Returns
A set of all annotation values
-
pybel.struct.summary.count_relations(graph)[source]¶ Return a histogram over all relationships in a graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A Counter from {relation type: frequency}
-
pybel.struct.summary.get_annotations(graph)[source]¶ Get the set of annotations used in the graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of annotation keys
-
pybel.struct.summary.count_annotations(graph)[source]¶ Count how many times each annotation is used in the graph.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A Counter from {annotation key: frequency}
-
pybel.struct.summary.get_unused_annotations(graph)[source]¶ Get the set of all annotations that are defined in a graph, but are never used.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A set of annotations
-
pybel.struct.summary.get_unused_list_annotation_values(graph)[source]¶ Get all of the unused values for list annotations.
- Parameters
graph (pybel.BELGraph) – A BEL graph
- Return type
- Returns
A dictionary of {str annotation: set of str values that aren’t used}