Skip to content

Commit

Permalink
Highlight metadata package in genomes
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Jan 9, 2024
1 parent 65ac2ea commit 41d4394
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
3 changes: 2 additions & 1 deletion app/models/genome.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def important_sample_attributes
env_broad_scale env_local_scale env_medium
environment_biome environment_feature
],
other: %i[host ph depth temp temperature rel_to_oxygen]
other: %i[host ph depth temp temperature rel_to_oxygen],
package: %i[ena_checklist ncbi_submission_package biosamplemodel]
}
end
end
Expand Down
31 changes: 19 additions & 12 deletions app/views/genomes/_samples.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%
attributes_icon = {
date: 'calendar', location: 'map-marked', toponym: 'map-signs',
environment: 'leaf', other: 'binoculars'
environment: 'leaf', other: 'binoculars', package: 'cubes'
}
%>
<% attributes_icon.each do |group, icon| %>
Expand All @@ -15,23 +15,30 @@
<% @genome.source_attribute_groups[group].each do |k, v| %>
<div>
<b><%= k.to_s.tr('_', ' ').titleize %>:</b>
<% case group %>
<% when :environment %>
<%
<%
case group
when :environment
osl4 = 'https://www.ebi.ac.uk/ols4/ontologies/envo/classes/'
purl = 'http://purl.obolibrary.org/obo/ENVO_'
envo = osl4 + ERB::Util.u(purl) + '\\1'

envo = osl4 + ERB::Util.u(purl)
v.map! do |i|
i.gsub(
sanitize(i).gsub(
/ENVO:(\d{8})/,
"<a href='#{envo}' target='_blank'>ENVO:\\1</a>"
"<a href='#{envo}\\1' target='_blank'>ENVO:\\1</a>"
)
end
%>
<% else %>
<% v.map! { |i| sanitize(i) } %>
<% end %>
when :ena_checklist
ena = 'https://www.ebi.ac.uk/ena/browser/view/'
v.map! do |i|
sanitize(i).gsub(
/(ERC\d{6})/,
"<a href='#{ena}\\1' target='_blank'>\\1</a>"
)
end
else
v.map! { |i| sanitize(i) }
end
%>
<%= v.join(' • ').html_safe %>
</div>
<% end %>
Expand Down

0 comments on commit 41d4394

Please sign in to comment.