Skip to content

Commit

Permalink
Merge pull request #994 from griffithlab/entrez-links
Browse files Browse the repository at this point in the history
Support case insensitive gene symbols for entrez links
  • Loading branch information
acoffman authored Feb 8, 2024
2 parents afe9699 + f7595fa commit 1356a5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/app/models/frontend_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ def initialize(id_type, id, domain)
end

def url
(entity, query_field) = query_info
(entity, query_field, transform) = query_info
if [entity, query_field, id].any? { |i| i.blank? }
nil
else
obj = entity.find_by!(query_field => id)
#identity function if none defined
transform ||= -> {_1}
obj = entity.find_by!(query_field => transform.call(id))
adaptor = "LinkAdaptors::#{obj.class}".constantize.new(obj)
"#{domain}#{adaptor.base_path}"
end
Expand All @@ -32,7 +34,7 @@ def query_info
when /entrez_id/
[ Gene, :entrez_id, ]
when /entrez_name/
[ Gene, :name , ]
[ Gene, :name , -> { _1.upcase }]
when /variant_groups?/
[ VariantGroup, :id, ]
when /revisions?/
Expand Down

0 comments on commit 1356a5b

Please sign in to comment.