Skip to content

Commit

Permalink
Dev (#483) (#484)
Browse files Browse the repository at this point in the history
* Dev (#483)

* switch multiple drug matching to use left anchored, case insensitive search

* Update citations with V5 citation (#477)

* update citations for v5

* fixed link

* prettier

* rudimentary support for querying current data_version

* implement ga4gh service service info spec

* update griffith lab affiliation

* run prettier

* fix: categories.tsv was downloading interactions (#475)

* fix: categories.tsv was downloading interactions

* feat: change top row of data downloads to latest

* feat: change top row of data downloads to latest

---------

Co-authored-by: Adam Coffman <[email protected]>
Co-authored-by: Matthew Cannon <[email protected]>
Co-authored-by: Adam Coffman <[email protected]>

* Automated frontend build

* Automated frontend build

---------

Co-authored-by: Adam Coffman <[email protected]>
Co-authored-by: Matthew Cannon <[email protected]>
Co-authored-by: Adam Coffman <[email protected]>
Co-authored-by: katiestahl <[email protected]>
  • Loading branch information
5 people authored Feb 16, 2024
1 parent 3592cb8 commit fa2180e
Show file tree
Hide file tree
Showing 16 changed files with 180 additions and 81 deletions.
16 changes: 6 additions & 10 deletions client/src/pages/About/SubSections/Contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const Contact = () => {
<div className="contact-section-container doc-section">
<div>
<p>
DGIdb was developed at The McDonnell Genome Institute, Washington
University School of Medicine. If you have a source of information
related to the druggable genome you would like us to incorporate,
please contact us at{' '}
DGIdb was initially developed at The McDonnell Genome Institute,
Washington University School of Medicine. If you have a source of
information related to the druggable genome you would like us to
incorporate, please contact us at{' '}
<Link href="mailto:[email protected]">[email protected].</Link>
</p>
<p>
Expand All @@ -24,12 +24,8 @@ export const Contact = () => {

<div className="left-section">
<h4>
<Link
href="http://genome.wustl.edu/"
target="_blank"
rel="noreferrer"
>
The McDonnell Genome Institute
<Link href="https://griffithlab.org" target="_blank" rel="noreferrer">
The Griffith Laboratory
</Link>
</h4>
<p>Washington University</p>
Expand Down
10 changes: 10 additions & 0 deletions client/src/pages/About/SubSections/Publications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import { Link } from '@mui/material';
export const Publications = () => {
return (
<div className="publications-section-container">
<div className="about-pub-item">
<Link href="https://pubmed.ncbi.nlm.nih.gov/37953380/" target="_blank">
DGIdb 5.0: rebuilding the drug-gene interaction database for precision
medicine and drug discovery platforms.
</Link>{' '}
Cannon M, Stevenson J, Stahl K, Basu R, Coffman A, Kiwala S, McMichael
JF, Kuzma K, Morrisey D, Cotto KC, Mardis ER, Griffith OL, Griffith M,
Wagner AH. Nucleic Acids Research. 2024 Jan 5; doi:
https://doi.org/10.1093/nar/gkad1040. PMID: 37953380.
</div>
<div className="about-pub-item">
<Link href="https://pubmed.ncbi.nlm.nih.gov/33237278/" target="_blank">
Integration of the Drug–Gene Interaction Database (DGIdb 4.0) with
Expand Down
77 changes: 16 additions & 61 deletions client/src/pages/Downloads/Files/Files.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,66 +13,24 @@ import Paper from '@mui/material/Paper';
// style
import './Files.scss';

function createData(
date: string,
interactions: string,
genes: string,
drugs: string,
categories: string
) {
return { date, interactions, genes, drugs, categories };
function getDataObj(date: string) {
return {
date,
interactions: 'interactions.tsv',
genes: 'genes.tsv',
drugs: 'drugs.tsv',
categories: 'categories.tsv',
};
}

const rows = [
createData(
'2023-Dec',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2022-Feb',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2021-May',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2021-Jan',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2020-Nov',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2020-Oct',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
createData(
'2020-Sep',
'interactions.tsv',
'genes.tsv',
'drugs.tsv',
'categories.tsv'
),
getDataObj('latest'),
getDataObj('2022-Feb'),
getDataObj('2021-May'),
getDataObj('2021-Jan'),
getDataObj('2020-Nov'),
getDataObj('2020-Oct'),
getDataObj('2020-Sep'),
];

export const Files = () => {
Expand Down Expand Up @@ -123,10 +81,7 @@ export const Files = () => {
</a>
</TableCell>
<TableCell align="center">
<a
download
href={'data/' + row.date + '/' + row.interactions}
>
<a download href={'data/' + row.date + '/' + row.categories}>
{row.categories}
</a>
</TableCell>
Expand Down
6 changes: 4 additions & 2 deletions server/app/graphql/resolvers/drugs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ class Resolvers::Drugs < GraphQL::Schema::Resolver
scope.where(id: value)
end

option(:names, type: [String], description: 'Substring filtering on a list of drug names.') do |scope, value|
scope.where(name: value.map(&:upcase))
option(:names, type: [String], description: 'Left anchored filtering on a list of drug names.') do |scope, value|
text = 'name ILIKE ?'
clause = Array.new(value.size, text).join(" OR ")
scope.where(clause, *value.map {|v| "#{v}%"})
end

option(:name, type: String, description: 'Left anchored string search on drug name') do |scope, value|
Expand Down
70 changes: 70 additions & 0 deletions server/app/graphql/types/meta_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module Types
class MetaType < Types::BaseObject
field :id, String, null: false, description: 'Unique identifier for service.'
field :data_version, String, null: false, description: 'Version of the data being served by DGIdb'
field :name, String, null: false, description: 'Human readable name of the service'
field :type, Types::ServiceType, null: false
field :description, String, null: false
field :organization, Types::OrganizationType, null: false
field :contact_url, String, null: false, description: 'URL of the contact for the provider of this service'
field :documentation_url, String, null: false, description: 'URL of the documentation of this service'
field :created_at, GraphQL::Types::ISO8601DateTime, null: false, description: 'Timestamp describing when the service was first deployed and available'
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false, description: 'Timestamp describing when the service was last updated'
field :environment, String, null: false, description: 'Environment the service is running in'
field :version, String, null: false, description: 'Version of the service being described'

def id
'org.dgidb.graphql'
end

def data_version
DATA_VERSION
end

def name
'DGIdb'
end

def type
{}
end

def description
"An open-source search engine for drug-gene interactions and the druggable genome."
end

def organization
{}
end

def contact_url
"mailto:[email protected]"
end

def documentation_url
'https://dgidb.org/api/graphiql'
end

def created_at
#version 5.0.0 initial release on GitHub
DateTime.parse("October 20, 2023 8:51 AM CDT")
end

def updated_at
DateTime.parse(github_release&.dig("published_at"))
end

def environment
Rails.env
end

def version
github_release&.dig("tag_name")
end

private
def github_release
@rel ||= GithubRelease.current
end
end
end
14 changes: 14 additions & 0 deletions server/app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Types
class OrganizationType < Types::BaseObject
field :name, String, null: false, description: 'Name of the organization responsible for the service'
field :url, String, null: false, description: 'URL of the website of the organization'

def name
'Wagner and Griffith laboratories'
end

def url
'https://dgidb.org/about#contact'
end
end
end
6 changes: 6 additions & 0 deletions server/app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class QueryType < Types::BaseObject
field :categories, resolver: Resolvers::Categories
field :interaction_claim_types, resolver: Resolvers::InteractionClaimTypes

field :service_info, Types::MetaType, null: false

field :drug_suggestions, [Types::DrugSuggestionType], null: true do
description "A searchable drug name or alias that can be completed from the supplied term"
argument :term, String, required: true
Expand Down Expand Up @@ -331,5 +333,9 @@ def interaction(id:)
def publication(id:)
Publication.find_by(id: id)
end

def service_info
{}
end
end
end
19 changes: 19 additions & 0 deletions server/app/graphql/types/service_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Types
class ServiceType < Types::BaseObject
field :group, String, null: false, description: 'Namespace in reverse domain name format.'
field :artifact, String, null: false, description: 'Name of the API or GA4GH specification implemented.'
field :version, String, null: false, description: 'API Version (semantic)'

def group
'org.dgidb'
end

def artifact
'DGIdb GraphQL'
end

def version
GithubRelease.current&.dig("tag_name")
end
end
end
18 changes: 18 additions & 0 deletions server/app/models/github_release.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class GithubRelease
def self.current
Rails.cache.fetch("current_github_release", expires_in: 12.hours) do
fetch_release
end
end

private
def self.fetch_release
uri = URI.parse('https://api.github.com/repos/dgidb/dgidb-v5/releases?per_page=1')
resp = Net::HTTP.get_response(uri)
if resp.code == '200'
JSON.parse(resp.body).first
else
nil
end
end
end
8 changes: 8 additions & 0 deletions server/config/initializers/dataset_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file = File.join(Rails.root, 'data_version.yml')
data = YAML.load_file(file)

DATA_VERSION = data.dig('version')

if DATA_VERSION.nil?
raise StandardError.new("Missing or malformed data_version.yml. Expect file at Rails.root with a version: key")
end
1 change: 1 addition & 0 deletions server/data_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: Dec-2023
6 changes: 3 additions & 3 deletions server/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.090445a8.css",
"main.js": "/static/js/main.4948a2ff.js",
"main.js": "/static/js/main.5c213655.js",
"static/js/461.86214142.chunk.js": "/static/js/461.86214142.chunk.js",
"static/js/80.a852d8b5.chunk.js": "/static/js/80.a852d8b5.chunk.js",
"static/js/990.d59bee53.chunk.js": "/static/js/990.d59bee53.chunk.js",
Expand All @@ -28,7 +28,7 @@
"static/js/925.a41f4405.chunk.js": "/static/js/925.a41f4405.chunk.js",
"index.html": "/index.html",
"main.090445a8.css.map": "/static/css/main.090445a8.css.map",
"main.4948a2ff.js.map": "/static/js/main.4948a2ff.js.map",
"main.5c213655.js.map": "/static/js/main.5c213655.js.map",
"461.86214142.chunk.js.map": "/static/js/461.86214142.chunk.js.map",
"80.a852d8b5.chunk.js.map": "/static/js/80.a852d8b5.chunk.js.map",
"990.d59bee53.chunk.js.map": "/static/js/990.d59bee53.chunk.js.map",
Expand Down Expand Up @@ -56,6 +56,6 @@
},
"entrypoints": [
"static/css/main.090445a8.css",
"static/js/main.4948a2ff.js"
"static/js/main.5c213655.js"
]
}
2 changes: 1 addition & 1 deletion server/public/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.4948a2ff.js"></script><link href="/static/css/main.090445a8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="DGIdb, The Drug Gene Interaction Database, is a research resource that can be used to search candidate genes or drugs against the known and potentially druggable genome."/><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;350;400;500;700;800&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;350;400;700&display=swap" rel="stylesheet"><link href="https://fonts.googleapis.com/css2?family=Work+Sans:wght@200;300;350;400;500;600&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/dgidb-icon_48.png"/><link rel="manifest" href="/manifest.json"/><title>DGIdb</title><script defer="defer" src="/static/js/main.5c213655.js"></script><link href="/static/css/main.090445a8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit fa2180e

Please sign in to comment.