Graph
- class Graph(*, id: str | None = None, meta: ~bioontologies.obograph.Meta | None = None, nodes: list[~bioontologies.obograph.Node] = <factory>, edges: list[~bioontologies.obograph.Edge] = <factory>, equivalentNodesSets: list[~typing.Any] = <factory>, logicalDefinitionAxioms: list[~typing.Any] = <factory>, domainRangeAxioms: list[~typing.Any] = <factory>, propertyChainAxioms: list[~typing.Any] = <factory>, prefix: str | None = None, standardized: bool = False)[source]
Bases:
BaseModel,StandardizeMixinA graph corresponds to an ontology.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Attributes Summary
Get the version of the ontology.
Get the license of the ontology.
Get the license of the ontology.
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
Get the ontology root terms.
Get the title of the ontology.
Get the version of the ontology.
Get the version of the ontology.
Methods Summary
Get a mapping of primary identifiers to secondary identifiers.
Get a mapping from CURIEs to names.
get_edges_df(*[, require_labels])Get all triples as a dataframe.
get_incoming_xrefs(prefix)Get incoming xrefs.
Get a networkx multi-directional graph.
get_nodes_df([sep])Get a nodes dataframe appropriate for serialization.
Get a SSSOM dataframe of mappings.
Get all database cross-references from the ontology.
nodes_from(prefix)Iterate non-deprecated nodes whose identifiers start with the given prefix.
standardize([keep_invalid, use_tqdm, nodes, ...])Standardize the OBO graph.
Attributes Documentation
- default_namespace
Get the version of the ontology.
- description
Get the license of the ontology.
- license
Get the license of the ontology.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- roots
Get the ontology root terms.
- title
Get the title of the ontology.
- version
Get the version of the ontology.
- version_iri
Get the version of the ontology.
Methods Documentation
- get_alternative_ids() Mapping[str, list[str]][source]
Get a mapping of primary identifiers to secondary identifiers.
- get_incoming_xrefs(prefix: str) Mapping[str, str][source]
Get incoming xrefs.
- Parameters:
prefix – An external prefix.
- Returns:
A dictionary of external local unique identifiers to local unique identifiers in this ontology
- get_nodes_df(sep: str = ';') DataFrame[source]
Get a nodes dataframe appropriate for serialization.
- get_xrefs() list[tuple[Reference, Reference, Reference]][source]
Get all database cross-references from the ontology.
- nodes_from(prefix: str) Iterable[Node][source]
Iterate non-deprecated nodes whose identifiers start with the given prefix.
- standardize(keep_invalid: bool = False, use_tqdm: bool = True, nodes: bool = True, edges: bool = True, tqdm_kwargs: Mapping[str, Any] | None = None, prefix: str | None = None) Self[source]
Standardize the OBO graph.
- Parameters:
keep_invalid – Should CURIEs/IRIs that aren’t handled by the Bioregistry be kept? Defaults to false.
use_tqdm – Should a progress bar be used?
tqdm_kwargs – Arguments to pass to tqdm if used
prefix – The prefix this graph came from (used for logging purposes)
nodes – Should nodes be standardized?
edges – Should edges be standardized?
- Returns:
This OBO graph, modified in place as follows:
Convert IRIs to CURIEs (in many places) using
bioregistryAdd alternative identifiers to
Nodeobjects