Canonicalizer

class pyobo.Canonicalizer(graph, priority=None, cutoff=5)[source]

Bases: object

Wraps a graph and priority list to allow getting the best identifier.

Attributes Summary

cutoff

Longest length paths allowed

priority

A list of prefixes.

Methods Summary

all_shortest_paths(source_curie, target_curie)

Get all shortest paths between the two entities.

canonicalize(curie)

Get the best CURIE from the given CURIE.

from_df(df)

Instantiate from a dataframe.

get_default([priority])

Get the default canonicalizer.

get_flat_mapping([use_tqdm])

Get a canonical mapping from all nodes to their canonical CURIEs.

iterate_flat_mapping([use_tqdm])

Iterate over the canonical mapping from all nodes to their canonical CURIEs.

single_source_shortest_path(curie[, cutoff])

Get all shortest paths between given entity and its equivalent entities.

Attributes Documentation

cutoff: int = 5

Longest length paths allowed

priority: Optional[List[str]] = None

A list of prefixes. The ones with the lower index are higher priority

Methods Documentation

all_shortest_paths(source_curie, target_curie)[source]

Get all shortest paths between the two entities.

Return type:

List[List[Mapping[str, str]]]

canonicalize(curie)[source]

Get the best CURIE from the given CURIE.

Return type:

str

classmethod from_df(df)[source]

Instantiate from a dataframe.

Return type:

Canonicalizer

classmethod get_default(priority=None)[source]

Get the default canonicalizer.

Return type:

Canonicalizer

get_flat_mapping(use_tqdm=True)[source]

Get a canonical mapping from all nodes to their canonical CURIEs.

Return type:

Mapping[str, str]

iterate_flat_mapping(use_tqdm=True)[source]

Iterate over the canonical mapping from all nodes to their canonical CURIEs.

Return type:

Iterable[Tuple[str, str]]

single_source_shortest_path(curie, cutoff=None)[source]

Get all shortest paths between given entity and its equivalent entities.

Return type:

Optional[Mapping[str, List[Mapping[str, str]]]]