Skip to content

Commit

Permalink
feat: add NCBO BioPortal link (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Nov 25, 2024
1 parent bb3a3ca commit b6c78bc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 13 deletions.
29 changes: 16 additions & 13 deletions _layouts/ontology_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,34 @@ <h1>
<div class="card" style="margin-bottom: 1.5em;">
<div class="card-body">
<!-- TODO: each ontology should configure which browsers to be exposed in -->
<a href="https://ontobee.org/ontology/{{page.id}}" class="btn btn-outline-primary">
<a href="https://ontobee.org/ontology/{{page.id}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
OntoBee
</a>
{% if page.aberowl_id %}
<a href="http://aber-owl.net/ontology/{{page.aberowl_id | upcase}}" class="btn btn-outline-primary">
AberOWL
</a>
<a href="http://aber-owl.net/ontology/{{page.aberowl_id | upcase}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
AberOWL
</a>
{% else %}
<a href="http://aber-owl.net/ontology/{{page.id | upcase}}" class="btn btn-outline-primary">
AberOWL
</a>
<a href="http://aber-owl.net/ontology/{{page.id | upcase}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
AberOWL
</a>
{% endif %}
<a href="http://www.ebi.ac.uk/ols/ontologies/{{page.id}}" class="btn btn-outline-primary">
<a href="http://www.ebi.ac.uk/ols/ontologies/{{page.id}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
OLS
</a>
{% for b in page.browsers %}
<a href="{{b.url}}" class="btn btn-outline-primary">
{{b.label}}
<a href="https://bioportal.bioontology.org/ontologies/{{ page.id | make_bioportal_id }}" class="btn btn-outline-primary" target="_blank" rel="noopener">
BioPortal
</a>
{% for b in page.browsers %}
<a href="{{b.url}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
{{b.label}}
</a>
{% endfor %}
<a href="https://bioregistry.io/metaregistry/obofoundry/{{page.id}}" class="btn btn-outline-primary">
<a href="https://bioregistry.io/metaregistry/obofoundry/{{page.id}}" class="btn btn-outline-primary" target="_blank" rel="noopener">
Bioregistry
</a>
{% if stripped_content_size > 0 %}
<p class="card-text">{{ content }}</p>
<p class="card-text">{{ content }}</p>
{% endif %}
</div>
</div>
Expand Down
28 changes: 28 additions & 0 deletions _plugins/bioportal_identifier.rb
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b6c78bc

Please sign in to comment.