Summary
Summary functions for BEL graphs.
- 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.
- pybel.struct.summary.iter_annotation_values(graph, annotation)[source]
Iterate over all of the values for an annotation used in the graph.
- pybel.struct.summary.get_annotation_values_by_annotation(graph)[source]
Get the set of values for each annotation used in a BEL graph.
- pybel.struct.summary.get_annotation_values(graph, annotation)[source]
Get all values for the given annotation.
- pybel.struct.summary.count_relations(graph)[source]
Return a histogram over all relationships in a graph.
- pybel.struct.summary.count_annotations(graph)[source]
Count how many times each annotation is used in the graph.
- pybel.struct.summary.get_unused_annotations(graph)[source]
Get the set of all annotations that are defined in a graph, but are never used.
- pybel.struct.summary.get_unused_list_annotation_values(graph)[source]
Get all of the unused values for list annotations.
- 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.count_functions(graph)[source]
Count the frequency of each function present in a graph.
- pybel.struct.summary.get_namespaces(graph)[source]
Get the set of all namespaces used in this graph.
- pybel.struct.summary.count_namespaces(graph)[source]
Count the frequency of each namespace across all nodes (that have namespaces).
- pybel.struct.summary.get_unused_namespaces(graph)[source]
Get the set of all namespaces that are defined in a graph, but are never used.
- 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
- 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 prefix
- 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.iterate_node_entities(node)[source]
Iterate over all named entities that comprise a node.
This includes the node’s name, the members/reactants/products of the node, the fusion partners, the named variants, and all recursive ones too.
- Parameters
node (
BaseEntity
) – A BEL node
Entities in a simple protein:
>>> from pybel.dsl import Protein >>> from pybel.language import Entity >>> from pybel.struct.summary import iterate_entities >>> protein = Protein(namespace='hgnc', identifier='1455', name='CALR') >>> protein_entities = list(iterate_node_entities(protein)) >>> assert [Entity(namespace='hgnc', identifier='1455', name='CALR')] == protein_entities
Entities in a protein complex:
>>> from pybel.dsl import Protein, ComplexAbundance >>> from pybel.language import Entity >>> from pybel.struct.summary import iterate_entities >>> protein_1 = Protein(namespace='hgnc', identifier='1') >>> protein_2 = Protein(namespace='hgnc', identifier='2') >>> complex_1 = ComplexAbundance([protein_1, protein_2]) >>> complex_entities = list(iterate_node_entities(complex_1)) >>> assert [Entity(namespace='hgnc', identifier='1'), Entity(namespace='hgnc', identifier='2')] == complex_entities
- pybel.struct.summary.node_is_grounded(node)[source]
Check if a node is grounded.
- Parameters
node (
BaseEntity
) – A BEL node- Return type
- pybel.struct.summary.get_ungrounded_nodes(graph)[source]
Get all ungrounded nodes in the graph.
- Parameters
graph (
BELGraph
) – A BEL graph- Return type
- pybel.struct.summary.count_variants(graph)[source]
Count how many of each type of variant a graph has.
- pybel.struct.summary.count_pathologies(graph)[source]
Count the number of edges in which each pathology is incident.
- Parameters
graph (
BELGraph
) – A BEL graph- Return type
- 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.
- pybel.struct.summary.iterate_pmc_identifiers(graph)[source]
Iterate over all PMC identifiers in a graph.
- pybel.struct.summary.get_pubmed_identifiers(graph)[source]
Get the set of all PubMed identifiers cited in the construction of a graph.
- pybel.struct.summary.get_pmc_identifiers(graph)[source]
Get the set of all PMC identifiers cited in the construction of a graph.
Misc. getters.