From b6c78bc803ffc0f24f2241be1bce61dc374bc83d Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Mon, 25 Nov 2024 10:54:30 -0500 Subject: [PATCH] feat: add NCBO BioPortal link (#2654) --- _layouts/ontology_detail.html | 29 ++++++++++++++++------------- _plugins/bioportal_identifier.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 _plugins/bioportal_identifier.rb diff --git a/_layouts/ontology_detail.html b/_layouts/ontology_detail.html index ce3ce1289..8bdc6d2f3 100644 --- a/_layouts/ontology_detail.html +++ b/_layouts/ontology_detail.html @@ -55,31 +55,34 @@

- + OntoBee {% if page.aberowl_id %} - - AberOWL - + + AberOWL + {% else %} - - AberOWL - + + AberOWL + {% endif %} - + OLS - {% for b in page.browsers %} - - {{b.label}} + + BioPortal + {% for b in page.browsers %} + + {{b.label}} + {% endfor %} - + Bioregistry {% if stripped_content_size > 0 %} -

{{ content }}

+

{{ content }}

{% endif %}
diff --git a/_plugins/bioportal_identifier.rb b/_plugins/bioportal_identifier.rb new file mode 100644 index 000000000..7c37d23e9 --- /dev/null +++ b/_plugins/bioportal_identifier.rb @@ -0,0 +1,28 @@ +module CustomFilter + def make_bioportal_id(obo_id) + return obo_id unless obo_id.is_a?(String) + + # ID requirements should be locked down moving forward, so additions to this table + # should be rare + special_cases = { + 'fbbt' => 'FB-BT', + 'ro' => 'OBOREL', + 'apollo_sv' => 'APOLLO-SV', + 'trans' => 'PTRANS', + 'wbls' => 'WB-LS', + 'fbdv' => 'FB-DV', + 'wbbt' => 'WB-BT', + 'wbphenotype' => 'WB-PHENOTYPE', + 'to' => 'PTO', + 'fbcv' => 'FB-CV', + 'mod' => 'PSIMOD', + 'pso' => 'PLANTSO' + } + + return special_cases[obo_id] if special_cases.key? obo_id + + obo_id == obo_id.downcase ? obo_id.upcase : obo_id + end +end + +Liquid::Template.register_filter(CustomFilter)