Skip to content

Commit

Permalink
More cleanuo
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Jan 30, 2024
1 parent 9bd9e79 commit 837ecb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/pyobo/sources/famplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ def _get_xref_df(version: str) -> Mapping[str, List[Reference]]:
}
xrefs_df[0] = xrefs_df[0].map(lambda s: ns_remapping.get(s, s))
xrefs_df[1] = [
bioregistry.standardize_identifier(xref_prefix, xref_identifier)
if xref_prefix != "nextprot.family"
else xref_identifier[len("FA:") :]
(
bioregistry.standardize_identifier(xref_prefix, xref_identifier)
if xref_prefix != "nextprot.family"
else xref_identifier[len("FA:") :]
)
for xref_prefix, xref_identifier in xrefs_df[[0, 1]].values
]

Expand Down
6 changes: 2 additions & 4 deletions src/pyobo/struct/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,7 @@ def _definition_fp(self) -> str:

def iterate_relations(self) -> Iterable[Tuple[TypeDef, Reference]]:
"""Iterate over pairs of typedefs and targets."""
for typedef, targets in sorted(
self.relationships.items(), key=lambda pair: pair[0].preferred_curie
):
for typedef, targets in sorted(self.relationships.items(), key=_sort_relations):
for target in sorted(targets, key=lambda ref: ref.preferred_curie):
yield typedef, target

Expand Down Expand Up @@ -468,7 +466,7 @@ def _escape(s) -> str:

def _sort_relations(r):
typedef, _references = r
return typedef.reference.name or typedef.reference.identifier
return typedef.preferred_curie


def _sort_properties(r):
Expand Down

0 comments on commit 837ecb0

Please sign in to comment.