Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Dec 5, 2024
2 parents 857a9b4 + 2f57e13 commit 50f021d
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 45 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/test_example_scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test Example Scripts

on:
push:
branches: [ main, staging ]
pull_request:
branches: [ main, staging]

jobs:
run-scripts:
runs-on: 'ubuntu-latest'

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'

- name: Install Ruby dependencies
run: gem install httparty

- name: Run Ruby script
run: ruby examples/fetch_variant_links.rb

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.13'

- name: Install Python dependencies
run: pip install requests

- name: Run Python script
run: python examples/fetch_all_variants.py

- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.4'

- name: Install system dependencies for R packages
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
- name: Run R script
run: Rscript examples/fetch_acmg_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<nz-select
[(ngModel)]="this.countryId"
nzAllowClear
[nzDropdownMatchSelectWidth]="false"
nzPlaceHolder="Select a Country"
nzShowSearch>
<nz-option
*ngFor="let country of countries$ | ngrxPush"
Expand Down
6 changes: 3 additions & 3 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5367,9 +5367,9 @@ [email protected]:
tslib "^2.4.0"

cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
version "7.0.6"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
Expand Down
1 change: 1 addition & 0 deletions examples/fetch_acmg_code.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
install.packages(c("ghql", "jsonlite", "dplyr"), repos="https://cloud.r-project.org")
library(ghql)
library(jsonlite)
library(dplyr)
Expand Down
42 changes: 18 additions & 24 deletions examples/fetch_all_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,28 @@ def run_query(query, variables):
id
name
variantAliases
variantBases
referenceBases
referenceBuild
clinvarIds
alleleRegistryId
ensemblVersion
gene {
name
variantTypes {
id
entrezId
soid
description
}
hgvsDescriptions
primaryCoordinates {
start
stop
chromosome
representativeTranscript
... on GeneVariant {
coordinates {
chromosome
start
stop
referenceBases
variantBases
representativeTranscript
referenceBuild
}
}
secondaryCoordinates{
start
stop
chromosome
representativeTranscript
... on FactorVariant {
name
ncitId
}
variantTypes {
id
soid
description
... on FusionVariant {
viccCompliantName
}
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/fetch_variant_links.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'httparty'
require 'json'

def call_graphql_api(url:, query:, vars:)
headers = {
Expand Down
18 changes: 9 additions & 9 deletions server/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
loofah (2.22.0)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
Expand Down Expand Up @@ -274,17 +274,17 @@ GEM
net-protocol
net-ssh (7.2.1)
nio4r (2.7.3)
nokogiri (1.16.7-aarch64-linux)
nokogiri (1.16.8-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm-linux)
nokogiri (1.16.8-arm-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
nokogiri (1.16.8-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
nokogiri (1.16.8-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
nokogiri (1.16.8-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.16.8-x86_64-linux)
racc (~> 1.4)
oauth2 (1.4.11)
faraday (>= 0.17.3, < 3.0)
Expand Down Expand Up @@ -369,9 +369,9 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (~> 1.14)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.1.4.1)
actionpack (= 7.1.4.1)
activesupport (= 7.1.4.1)
Expand Down
4 changes: 3 additions & 1 deletion server/app/graphql/resolvers/top_level_molecular_profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Resolvers::TopLevelMolecularProfiles < GraphQL::Schema::Resolver
)
ids = results.hits.map { |x| x["_id"] }

scope.where(molecular_profiles: { id: ids })
scope.left_joins(:molecular_profile_aliases).where(molecular_profiles: { id: ids })
.or(scope.where('molecular_profile_aliases.name ILIKE :query', {query: "%#{value}%"}))
.distinct
end

option(:gene_id, type: Int, description: "Filter molecular profiles to the CIViC id of the gene(s) involved.") do |scope, value|
Expand Down
6 changes: 4 additions & 2 deletions server/app/jobs/generate_tsvs.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
require 'csv'
class GenerateTsvs < ApplicationJob
def perform
ensure_downloads_directory_exists
tsvs_to_generate.each do |e|
begin
tmp_file = tmp_file(e.file_name)
tmp_file.puts(e.headers.join("\t"))
tmp_file.puts CSV.generate_line(e.headers, col_sep: "\t")
e.objects.find_each do |object|
tmp_file.puts(e.row_from_object(object).join("\t"))
row = e.row_from_object(object).map {|col| col.is_a?(String) ? col.squish : col }
tmp_file.puts CSV.generate_line(row, col_sep: "\t", quote_empty: false)
end
tmp_file.close
public_path = public_file_path(e.file_name)
Expand Down
19 changes: 16 additions & 3 deletions server/app/lib/importer/disease_ontology_mirror.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ def delete_unprocessed_diseases

unprocessed_doids.each do |doid|
d = Disease.find_by(doid: doid)
revisions = Revision.where(field_name: 'disease_id').where(current_value: d.id).or(Revision.where(field_name: 'disease_id').where(suggested_value: d.id))
if d.evidence_items.count == 0 && d.assertions.count == 0 && d.source_suggestions.count == 0 && revisions.count == 0
if is_disease_with_no_relations?(d)
d.disease_aliases.clear
d.delete
else
Expand Down Expand Up @@ -121,7 +120,7 @@ def delete_unprocessed_diseases
end
end
Disease.where(doid: nil).each do |d|
if d.evidence_items.count == 0 && d.assertions.count == 0 && d.source_suggestions.count == 0
if is_disease_with_no_relations?(d)
d.disease_aliases.clear
d.delete
elsif ['Solid Tumor', 'Ventricular Dysfunction', 'Acute Mountain Sickness', 'Glioma', 'Low Bone Mineral Density'].include? d.name
Expand All @@ -135,6 +134,20 @@ def delete_unprocessed_diseases
end
end

def is_disease_with_no_relations?(d)
d.evidence_items.count == 0 &&
d.assertions.count == 0 &&
d.source_suggestions.count == 0 &&
revisions_count(d) == 0
end

def revisions_count(disease)
Revision.where(field_name: 'disease_id')
.where(current_value: disease.id)
.or(Revision.where(field_name: 'disease_id').where(suggested_value: disease.id))
.count
end

def url_from_doid(doid)
URI.parse("https://disease-ontology.org/api/metadata/DOID:#{doid}/")
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class MaterializedViews::SourceBrowseTableRow < MaterializedViews::MaterializedView
self.primary_key = :id
has_and_belongs_to_many :clinical_trials, join_table: :clinical_trials_sources, foreign_key: :source_id

enum source_type: ['PubMed', 'ASCO', 'ASH']
Expand Down
6 changes: 3 additions & 3 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1891,9 +1891,9 @@ cosmiconfig@^7.0.0:
yaml "^1.10.0"

cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
version "7.0.6"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f"
integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==
dependencies:
path-key "^3.1.0"
shebang-command "^2.0.0"
Expand Down

0 comments on commit 50f021d

Please sign in to comment.