From bd5ad8c3f01bf5c6895d5771b4f45835860cc2c9 Mon Sep 17 00:00:00 2001 From: MarvinDo Date: Sun, 1 Dec 2024 15:21:29 +0100 Subject: [PATCH] fixed bug where the automatic classification did not consider assays & fixed no_proxy setting for requests --- .../automatic_classification_job.py | 17 +++---- src/annotation_service/main.py | 46 +++++++++---------- src/common/models.py | 5 ++ src/frontend_celery/config.py | 1 + src/frontend_celery/start_celery.sh | 1 + src/frontend_celery/start_herediclass.sh | 2 +- src/frontend_celery/start_keycloak.sh | 2 +- src/frontend_celery/start_redis.sh | 1 + src/frontend_celery/start_webapp.sh | 1 + .../webapp/templates/index.html | 8 ++++ 10 files changed, 51 insertions(+), 33 deletions(-) diff --git a/src/annotation_service/annotation_jobs/automatic_classification_job.py b/src/annotation_service/annotation_jobs/automatic_classification_job.py index a41d9194..723c0533 100644 --- a/src/annotation_service/annotation_jobs/automatic_classification_job.py +++ b/src/annotation_service/annotation_jobs/automatic_classification_job.py @@ -306,14 +306,16 @@ def get_autoclass_json(self, variant_id, conn: Connection) -> str: splicing_assays = assays_dict.get("splicing") + #print(splicing_assays) + all_splicing_assays = [] if splicing_assays is not None: - for assay in all_splicing_assays: + for assay in splicing_assays: if assay.metadata.get("minigene") is None or assay.metadata.get("patient_rna") is None or assay.metadata.get("allele_specific") is None: # skip legacy assays continue - minigene = assay.metadata.get("minigene", "") == "True" - patient_rna = assay.metadata.get("patient_rna", "") == "True" - allelic = assay.metadata.get("allele_specific", "False") + minigene = assay.get_metadata_value("minigene", "False") == "True" + patient_rna = assay.get_metadata_value("patient_rna", "False") == "True" + allelic = assay.get_metadata_value("allele_specific", "False") quantification = functions.percent_to_decimal(assay.metadata.get("minimal_percentage", None)) all_splicing_assays.append({"minigene": minigene, "patient_rna": patient_rna, @@ -339,8 +341,8 @@ def get_autoclass_json(self, variant_id, conn: Connection) -> str: for assay in functional_assays: if assay.metadata.get("functional_category") is None or assay.metadata.get("functional_category") is None: # skip legacy assays continue - is_pathogenic = assay.metadata.get("functional_category", "") == "pathogenic" - is_benign = assay.metadata.get("functional_category", "") == "benign" + is_pathogenic = assay.get_metadata_value("functional_category", "") == "pathogenic" + is_benign = assay.get_metadata_value("functional_category", "") == "benign" all_functional_assays.append({"pathogenic": is_pathogenic, "benign": is_benign}) result["functional_data"] = all_functional_assays @@ -391,8 +393,7 @@ def get_autoclass_json(self, variant_id, conn: Connection) -> str: result_json = json.dumps(result) - with open("/var/www/html/heredivar-demo/logs/herediclassify_jsons/test.json", "w") as f: - f.write(result_json) + #print(result_json) return result_json diff --git a/src/annotation_service/main.py b/src/annotation_service/main.py index 7eea3be2..c55f71fa 100644 --- a/src/annotation_service/main.py +++ b/src/annotation_service/main.py @@ -14,40 +14,40 @@ def get_default_job_config(): job_config = { # heredicare annotations - 'do_heredicare': True, + 'do_heredicare': False, # external programs - 'do_phylop': True, - 'do_spliceai': True, - 'do_hexplorer': True, - 'do_maxentscan': True, + 'do_phylop': False, + 'do_spliceai': False, + 'do_hexplorer': False, + 'do_maxentscan': False, # consequences - 'do_consequence': True, - 'do_vep': True, + 'do_consequence': False, + 'do_vep': False, #vcf annotate from vcf - 'do_dbsnp': True, - 'do_revel': True, - 'do_cadd': True, - 'do_clinvar': True, - 'do_gnomad': True, - 'do_brca_exchange': True, - 'do_flossies': True, + 'do_dbsnp': False, + 'do_revel': False, + 'do_cadd': False, + 'do_clinvar': False, + 'do_gnomad': False, + 'do_brca_exchange': False, + 'do_flossies': False, - 'do_tp53_database': True, - 'do_priors': True, - 'do_bayesdel': True, - 'do_cosmic': True, + 'do_tp53_database': False, + 'do_priors': False, + 'do_bayesdel': False, + 'do_cosmic': False, # assays - 'do_cspec_brca_assays': True, + 'do_cspec_brca_assays': False, # additional annotations - 'do_cancerhotspots': True, - 'do_taskforce_domains': True, - 'do_coldspots': True, - 'do_litvar': True, + 'do_cancerhotspots': False, + 'do_taskforce_domains': False, + 'do_coldspots': False, + 'do_litvar': False, 'do_auto_class': True # outdated diff --git a/src/common/models.py b/src/common/models.py index 959d041e..a0a8f808 100644 --- a/src/common/models.py +++ b/src/common/models.py @@ -734,6 +734,11 @@ class Assay: metadata: Any # dict of Assay Metadata + def get_metadata_value(self, metadata_type, default): + if metadata_type in self.metadata: + return self.metadata.get(metadata_type).value + return default + def get_header(self): ## Separator-symbol-hierarchy: ; -> & -> | -> $ -> + header = {'assays': '##INFO=\n'} diff --git a/src/frontend_celery/config.py b/src/frontend_celery/config.py index 4224bd24..8e451a4d 100644 --- a/src/frontend_celery/config.py +++ b/src/frontend_celery/config.py @@ -29,6 +29,7 @@ class Config(object): HOST = os.environ.get('HOST') PORT = os.environ.get('PORT') + os.environ["no_proxy"] = os.environ.get("NO_PROXY", "") LOGIN_REQUIRED = os.environ.get('LOGIN_REQUIRED', "True").lower() in ["true"] diff --git a/src/frontend_celery/start_celery.sh b/src/frontend_celery/start_celery.sh index 6f0f8cb3..2dd4ceb5 100755 --- a/src/frontend_celery/start_celery.sh +++ b/src/frontend_celery/start_celery.sh @@ -55,6 +55,7 @@ export WEBAPP_ENV=$we vep_install_dir=$ROOT/tools/ensembl-vep-release-107.0 cpan_dir=$vep_install_dir/cpan export PERL5LIB=$vep_install_dir/Bio/:$cpan_dir/lib/perl5/:$PERL5LIB +export no_proxy=$NO_PROXY if [ -z "${WEBAPP_ENV}" ] diff --git a/src/frontend_celery/start_herediclass.sh b/src/frontend_celery/start_herediclass.sh index 2f903b76..eaf14461 100755 --- a/src/frontend_celery/start_herediclass.sh +++ b/src/frontend_celery/start_herediclass.sh @@ -51,7 +51,7 @@ set -o allexport extension=env_ source $ROOT/.$extension$WEBAPP_ENV set +o allexport - +export no_proxy=$NO_PROXY autoclass_path=$ROOT/tools/herediclass cd $autoclass_path diff --git a/src/frontend_celery/start_keycloak.sh b/src/frontend_celery/start_keycloak.sh index feeb6f33..4a1c131f 100755 --- a/src/frontend_celery/start_keycloak.sh +++ b/src/frontend_celery/start_keycloak.sh @@ -58,7 +58,7 @@ set -o allexport extension=env_ source $ROOT/.$extension$WEBAPP_ENV set +o allexport - +export no_proxy=$NO_PROXY if [ "${WEBAPP_ENV}" == "dev" ] diff --git a/src/frontend_celery/start_redis.sh b/src/frontend_celery/start_redis.sh index 5b826d46..e1929873 100755 --- a/src/frontend_celery/start_redis.sh +++ b/src/frontend_celery/start_redis.sh @@ -56,6 +56,7 @@ set -o allexport extension=env_ source $ROOT/.$extension$WEBAPP_ENV set +o allexport +export no_proxy=$NO_PROXY cd tools/redis-stable src/redis-server --port $REDIS_PORT diff --git a/src/frontend_celery/start_webapp.sh b/src/frontend_celery/start_webapp.sh index 9cd8edb8..25f22d80 100755 --- a/src/frontend_celery/start_webapp.sh +++ b/src/frontend_celery/start_webapp.sh @@ -65,6 +65,7 @@ then extension=env_ source $ROOT/.$extension$WEBAPP_ENV set +o allexport + export no_proxy=$NO_PROXY logsdir=$ROOT/logs mkdir -p $logsdir/gunicorn-access-logs diff --git a/src/frontend_celery/webapp/templates/index.html b/src/frontend_celery/webapp/templates/index.html index abed0e6d..3ce78963 100644 --- a/src/frontend_celery/webapp/templates/index.html +++ b/src/frontend_celery/webapp/templates/index.html @@ -93,6 +93,14 @@

Overview

Changelog

+
v 1.14.5 ()
+
+ Bugfixes: +
    +
  • Fixed a bug where assay annotations would not be considered for automatic classification
  • +
+
+
v 1.14.4 (03.11.2024)
General changes: