Skip to content

Commit

Permalink
Fix ORCID formatting
Browse files Browse the repository at this point in the history
See issue pointed out by Damien: obophenotype/uberon#2950 (comment)
  • Loading branch information
cthoyt committed Aug 23, 2023
1 parent f8bd305 commit 7d60d79
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/biomappings/contribute/obo.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,18 @@ def update_obo(prefix: str, path: Union[str, Path], *, uppercase_prefix: bool =
if uppercase_prefix:
target_prefix = target_prefix.upper()

source_curie = mapping["source"]
if not source_curie.startswith("orcid:"):
continue

# FIXME be careful about assumption about identifier. currently
# assumes that OBO all have bananas.
lines = add_xref(
lines,
mapping["source identifier"],
curie_to_str(target_prefix, target_identifier),
mapping["target name"],
mapping["source"],
source_curie.removeprefix("orcid:"),
)

with open(path, "w") as fh:
Expand Down Expand Up @@ -80,7 +84,7 @@ def add_xref(lines, node, xref, xref_name, author_orcid: str):
xref_entries.append(xref)
xref_entries = sorted(xref_entries)
xr_idx = xref_entries.index(xref)
line = f'xref: {xref} {{{CONTRIBUTOR_URL}="https://orcid.org/{author_orcid}"}} ! {xref_name}\n'
line = f'xref: {xref} {{dcterms:contributor="https://orcid.org/{author_orcid}"}} ! {xref_name}\n'
lines.insert(start_xref_idx + xr_idx, line)
return lines

Expand Down

0 comments on commit 7d60d79

Please sign in to comment.