Skip to content

Commit

Permalink
Merge pull request #1180 from griffithlab/links
Browse files Browse the repository at this point in the history
Update short links to allow doid, ncit_id, and hpo_id
  • Loading branch information
acoffman authored Jan 28, 2025
2 parents 1a01daf + 9695afb commit 0c25c17
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
11 changes: 11 additions & 0 deletions server/app/lib/link_adaptors/phenotype.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module LinkAdaptors
class Phenotype < Base
def display_name
obj.name
end

def base_path
"/phenotypes/#{obj.id}"
end
end
end
26 changes: 21 additions & 5 deletions server/app/models/frontend_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ def url
def query_info
case id_type
when /genes?/
[
Feature.where(feature_instance_type: "Features::Gene"), :feature_instance_id,
[
Feature.where(feature_instance_type: "Features::Gene"), :id,
]
when /fusions?/
[
Feature.where(feature_instance_type: "Features::Fusion"), :id,
]
when /factors?/
[
Feature.where(feature_instance_type: "Features::Factor"), :id,
]
when /features?/
[ Feature, :id, ]
Expand All @@ -38,7 +46,7 @@ def query_info
when /entrez_id/
[ Features::Gene, :entrez_id ]
when /entrez_name/
[
[
Feature.where(feature_instance_type: "Features::Gene"), :name, -> { _1.upcase }
]
when /variant_groups?/
Expand All @@ -47,10 +55,18 @@ def query_info
[ Revision, :id ]
when /diseases?/
[ Disease, :id ]
when /doid/
[ Disease.where(deprecated: false), :doid, ]
when /drugs?/
[ Therapy, :id ]
when /therapies?/
[ Therapy, :id ]
when /ncit_id/
[ Therapy.where(deprecated: false), :ncit_id, ]
when /phenotypes?/
[ Phenotype, :id ]
when /hpo_id/
[ Phenotype, :hpo_id ]
when /assertions?/
[ Assertion, :id ]
when /sources?/
Expand All @@ -62,8 +78,8 @@ def query_info
when "AID"
[ Assertion, :id ]
when "GID"
[
Feature.where(feature_instance_type: "Features::Gene"), :feature_instance_id,
[
Feature.where(feature_instance_type: "Features::Gene"), :id,
]
when "FID"
[ Feature, :id ]
Expand Down

0 comments on commit 0c25c17

Please sign in to comment.