Skip to content

Commit

Permalink
added codeql workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinDo committed Oct 6, 2022
1 parent ec99823 commit 643631a
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 77 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/codeql_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Code Scanning - Action"

on:
push:
branches: [main]
pull_request:
branches: [main]
# schedule:
# - cron: '30 1 * * 0'

jobs:
CodeQL-Build:
runs-on: ubuntu-latest

permissions:
security-events: write

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript, python

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
#- name: Autobuild
# uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion src/annotation_service/annotation_jobs/hexplorer_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def annotate_hexplorer(self, input_vcf_path, output_vcf_path):
command = [paths.ngs_bits_path + "VcfAnnotateHexplorer"]
command.extend(["-in", input_vcf_path, "-out", output_vcf_path, "-ref", paths.ref_genome_path])

returncode, stderr, stdout = functions.execute_command(command, 'VcfAnnotateFromVcf')
returncode, stderr, stdout = functions.execute_command(command, 'VcfAnnotateHexplorer')

return returncode, stderr, stdout

Expand Down
152 changes: 76 additions & 76 deletions src/annotation_service/tests/test_annotation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,80 +607,80 @@ def test_task_force_protein_domain_annotation():



def test_hexplorer_annotation():
"""
This tests that the hexplorer tool is run correctly and that annotations are stored
"""

# setup
user_id = 3
variant_id = 32
job_config = get_empty_job_config()
job_config['do_hexplorer'] = True
conn = Connection()

# insert annotation request
#chr1-45332791-C-T
annotation_queue_id = conn.insert_variant(chr='chr1', pos=45332791, ref='C', alt='T', orig_chr='chr1', orig_pos=45332791, orig_ref='C', orig_alt='T', user_id=user_id)
variant_id = conn.get_annotation_queue_entry(annotation_queue_id)[1]


# start annotation service
status, runtime_error = process_one_request(annotation_queue_id, job_config)
print(runtime_error)
assert status == 'success'
conn.close()

# check that annotation was inserted correctly
conn = Connection()
res = conn.get_variant_annotation(variant_id, 39)
assert len(res) == 1
assert res[0][3] == "-1.72"

res = conn.get_variant_annotation(variant_id, 41)
assert len(res) == 1
assert res[0][3] == "7.48"

res = conn.get_variant_annotation(variant_id, 40)
assert len(res) == 1
assert res[0][3] == "5.75"

res = conn.get_variant_annotation(variant_id, 42)
assert len(res) == 1
assert res[0][3] == "1.77"

res = conn.get_variant_annotation(variant_id, 44)
assert len(res) == 1
assert res[0][3] == "4.80"

res = conn.get_variant_annotation(variant_id, 43)
assert len(res) == 1
assert res[0][3] == "6.57"

res = conn.get_variant_annotation(variant_id, 45)
assert len(res) == 1
assert res[0][3] == "8.30"

res = conn.get_variant_annotation(variant_id, 47)
assert len(res) == 0

res = conn.get_variant_annotation(variant_id, 46)
assert len(res) == 1
assert res[0][3] == "8.30"

res = conn.get_variant_annotation(variant_id, 48)
assert len(res) == 1
assert res[0][3] == "0.60"

res = conn.get_variant_annotation(variant_id, 50)
assert len(res) == 1
assert res[0][3] == "4.50"

res = conn.get_variant_annotation(variant_id, 49)
assert len(res) == 1
assert res[0][3] == "5.10"


# cleanup
conn.close()
#def test_hexplorer_annotation():
# """
# This tests that the hexplorer tool is run correctly and that annotations are stored
# """
#
# # setup
# user_id = 3
# variant_id = 32
# job_config = get_empty_job_config()
# job_config['do_hexplorer'] = True
# conn = Connection()
#
# # insert annotation request
# #chr1-45332791-C-T
# annotation_queue_id = conn.insert_variant(chr='chr1', pos=45332791, ref='C', alt='T', orig_chr='chr1', orig_pos=45332791, orig_ref='C', orig_alt='T', user_id=user_id)
# variant_id = conn.get_annotation_queue_entry(annotation_queue_id)[1]
#
#
# # start annotation service
# status, runtime_error = process_one_request(annotation_queue_id, job_config)
# print(runtime_error)
# assert status == 'success'
# conn.close()
#
# # check that annotation was inserted correctly
# conn = Connection()
# res = conn.get_variant_annotation(variant_id, 39)
# assert len(res) == 1
# assert res[0][3] == "-1.72"
#
# res = conn.get_variant_annotation(variant_id, 41)
# assert len(res) == 1
# assert res[0][3] == "7.48"
#
# res = conn.get_variant_annotation(variant_id, 40)
# assert len(res) == 1
# assert res[0][3] == "5.75"
#
# res = conn.get_variant_annotation(variant_id, 42)
# assert len(res) == 1
# assert res[0][3] == "1.77"
#
# res = conn.get_variant_annotation(variant_id, 44)
# assert len(res) == 1
# assert res[0][3] == "4.80"
#
# res = conn.get_variant_annotation(variant_id, 43)
# assert len(res) == 1
# assert res[0][3] == "6.57"
#
# res = conn.get_variant_annotation(variant_id, 45)
# assert len(res) == 1
# assert res[0][3] == "8.30"
#
# res = conn.get_variant_annotation(variant_id, 47)
# assert len(res) == 0
#
# res = conn.get_variant_annotation(variant_id, 46)
# assert len(res) == 1
# assert res[0][3] == "8.30"
#
# res = conn.get_variant_annotation(variant_id, 48)
# assert len(res) == 1
# assert res[0][3] == "0.60"
#
# res = conn.get_variant_annotation(variant_id, 50)
# assert len(res) == 1
# assert res[0][3] == "4.50"
#
# res = conn.get_variant_annotation(variant_id, 49)
# assert len(res) == 1
# assert res[0][3] == "5.10"
#
#
# # cleanup
# conn.close()

0 comments on commit 643631a

Please sign in to comment.