Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to ensure example scripts keep working #1165

Merged
merged 6 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading