Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for DKG build #187

Merged
merged 2 commits into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions mira/dkg/construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ def construct(
property_values="",
xref_types="", # TODO
synonym_types=";".join(
synonym.type.curie for synonym in term.synonyms or []
synonym.type.curie if synonym.type is not None else "skos:exactMatch"
for synonym in term.synonyms or []
),
)
for parent in term.parents:
Expand Down Expand Up @@ -761,7 +762,11 @@ def _get_edge_name(curie_: str, strict: bool = False) -> str:
# intfmt=",",
)
)
edge_counter = Counter(edge.pred for edge in graph.edges)
edge_counter = Counter(
edge.predicate.curie
for edge in graph.edges
if edge.predicate is not None
)
tqdm.write(
"\n"
+ tabulate(
Expand All @@ -778,7 +783,7 @@ def _get_edge_name(curie_: str, strict: bool = False) -> str:

unstandardized_nodes.extend(node.id for node in graph.nodes if not node.reference)
unstandardized_edges.extend(
edge.pred for edge in graph.edges if edge.pred.startswith("http")
edge.pred for edge in graph.edges if edge.predicate is None
)

clean_edges = (
Expand All @@ -793,10 +798,10 @@ def _get_edge_name(curie_: str, strict: bool = False) -> str:
)
edges.extend(
(
edge.sub,
edge.obj,
_get_edge_name(edge.pred).lower().replace(" ", "_").replace("-", "_"),
edge.pred,
edge.subject.curie,
edge.object.curie,
_get_edge_name(edge.predicate.curie).lower().replace(" ", "_").replace("-", "_"),
edge.predicate.curie,
prefix,
graph_id,
version or "",
Expand Down Expand Up @@ -979,7 +984,8 @@ def get_node_info(term: pyobo.Term, type: EntityType = "class"):
property_values="",
xref_types="",
synonym_types=";".join(
synonym.type.curie for synonym in term.synonyms or []
synonym.type.curie if synonym.type is not None else "skos:exactMatch"
for synonym in term.synonyms or []
),
)

Expand Down