diff --git a/src/pyobo/sources/famplex.py b/src/pyobo/sources/famplex.py index 29011bf7..d0441815 100644 --- a/src/pyobo/sources/famplex.py +++ b/src/pyobo/sources/famplex.py @@ -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 ] diff --git a/src/pyobo/struct/struct.py b/src/pyobo/struct/struct.py index c318848b..03c79f80 100644 --- a/src/pyobo/struct/struct.py +++ b/src/pyobo/struct/struct.py @@ -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 @@ -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):