diff --git a/src/annotation_service/annotation_jobs/automatic_classification_job.py b/src/annotation_service/annotation_jobs/automatic_classification_job.py index a85d5c39..7beefb60 100644 --- a/src/annotation_service/annotation_jobs/automatic_classification_job.py +++ b/src/annotation_service/annotation_jobs/automatic_classification_job.py @@ -262,37 +262,46 @@ def get_autoclass_json(self, variant_id, conn: Connection) -> str: # mRNA analyses: currently missing """ - "mRNA_analysis" : + "mRNA_analysis" : [ {"performed": true, - "pathogenic": true, - "benign": true}, + "minigene": true, + "patient_rna": false, + "allelic" : "Construct", + "quantification": null} + ], """ assays_dict = variant.order_assays_by_type() - splicing_assays = assays_dict.get("splicing") - splicing_assay_performed = False - pathogenic_splicing_assay = False - benign_splicing_assay = False - if splicing_assays is not None and len(splicing_assays) > 0: - splicing_assay_performed = True - for splicing_assay in splicing_assays: - if splicing_assay.metadata.get("functional_category", "") == "pathogenic": - pathogenic_splicing_assay = True - if splicing_assay.metadata.get("functional_category", "") == "benign": - benign_splicing_assay = True - result["mRNA_analysis"] = {"performed": splicing_assay_performed, - "pathogenic": pathogenic_splicing_assay, - "benign": benign_splicing_assay} + + # functional data: currently missing """ - "functional_data": + "functional_data": [ {"performed": true, - "pathogenic": true, + "pathogenic": false, "benign": true}, + {"performed": true, + "pathogenic": false, + "benign": true} + ] """ - result["functional_data"] = {"performed": False, - "pathogenic": False, - "benign": False} + functional_assays = assays_dict.get("functional") + + all_functional_assays = [] + if functional_assays is not None and len(functional_assays) > 0: + for assay in functional_assays: + is_performed = True + is_pathogenic = False + is_benign = False + if assay.metadata.get("functional_category", "") == "pathogenic": + is_pathogenic = True + if assay.metadata.get("functional_category", "") == "benign": + is_benign = True + all_functional_assays.append({"performed": is_performed, + "pathogenic": is_pathogenic, + "benign": is_benign}) + result["functional_data"] = all_functional_assays + # heredicare computed scores: currently missing """ diff --git a/src/annotation_service/annotation_jobs/heredicare_job.py b/src/annotation_service/annotation_jobs/heredicare_job.py index 108197f3..0c605de0 100644 --- a/src/annotation_service/annotation_jobs/heredicare_job.py +++ b/src/annotation_service/annotation_jobs/heredicare_job.py @@ -79,8 +79,17 @@ def save_to_db(self, info, variant_id, conn): err_msg += "The date could not be saved in the database. Format should be dd.mm.yyyy, but was: " + str(classification_date) status_code = 1 + heredicare_annotation_id = None if status_code == 0: - conn.insert_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment, lr_cooc, lr_coseg, lr_family) + heredicare_annotation_id = conn.insert_heredicare_annotation(variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment, lr_cooc, lr_coseg, lr_family) + + for key in heredicare_variant: + if key.startswith("PATH_Z") and heredicare_variant[key] is not None: + zid = int(key[6:]) + print(zid) + classification = heredicare_variant[key] if heredicare_variant[key] != "-1" else None + conn.insert_heredicare_center_classification(heredicare_annotation_id, zid, classification, comment = None) # TODO! COMMENT! + return status_code, err_msg diff --git a/src/common/db_IO.py b/src/common/db_IO.py index 1828ce89..1b30fe94 100644 --- a/src/common/db_IO.py +++ b/src/common/db_IO.py @@ -1376,9 +1376,9 @@ def invalidate_previous_consensus_classifications(self, variant_id): self.cursor.execute(command, (variant_id,)) self.conn.commit() - def insert_heredicare_center_classification(self, variant_id, classification, center_name, comment, date): - command = "INSERT INTO heredicare_center_classification (variant_id, classification, center_name, comment, date) VALUES (%s, %s, %s, %s, %s)" - self.cursor.execute(command, (variant_id, classification, center_name, comment, date)) + def insert_heredicare_center_classification(self, heredicare_annotation_id, zid, classification, comment): + command = "INSERT INTO heredicare_center_classification (variant_heredicare_annotation_id, heredicare_ZID, classification, comment) VALUES (%s, %s, %s, %s)" + self.cursor.execute(command, (heredicare_annotation_id, zid, classification, comment)) self.conn.commit() def check_heredicare_center_classification(self, variant_id, classification, center_name, comment, date): # this returns true if this classification is already in there and fals if it is not @@ -1618,6 +1618,7 @@ def insert_user_classification(self, variant_id, classification, user_id, commen def update_user_classification(self, user_classification_id, classification, comment, date, scheme_class): command = "UPDATE user_classification SET classification = %s, comment = %s, date = %s, scheme_class = %s WHERE id = %s" + print(command % (str(classification), comment, date, str(scheme_class), user_classification_id)) self.cursor.execute(command, (str(classification), comment, date, str(scheme_class), user_classification_id)) self.conn.commit() @@ -1885,9 +1886,9 @@ def get_import_request(self, import_queue_id = '', date = ''): return None """ - def get_heredicare_center_classifications(self, variant_id): - command = 'SELECT * FROM heredicare_center_classification WHERE variant_id = %s' - self.cursor.execute(command, (variant_id, )) + def get_heredicare_center_classifications(self, heredicare_annotation_id): + command = 'SELECT id, heredicare_ZID, (SELECT name FROM heredicare_ZID WHERE heredicare_ZID.ZID = heredicare_center_classification.heredicare_ZID) as center_name, classification, comment FROM heredicare_center_classification WHERE variant_heredicare_annotation_id = %s' + self.cursor.execute(command, (heredicare_annotation_id, )) result = self.cursor.fetchall() if len(result) == 0: return None @@ -2382,21 +2383,8 @@ def get_variant(self, variant_id, automatic_classification = models.AutomaticClassification(id = automatic_classification_id, scheme_id = scheme_id, scheme_display_title = scheme_display_title, classification_splicing = classification_splicing, classification_protein = classification_protein, date = date, criteria = all_criteria) - heredicare_classifications = None all_heredicare_annotations = None if include_heredicare_classifications: - heredicare_classifications_raw = self.get_heredicare_center_classifications(variant_id) - if heredicare_classifications_raw is not None: - heredicare_classifications = [] - for cl_raw in heredicare_classifications_raw: - id = int(cl_raw[0]) - selected_class = cl_raw[1] - comment = cl_raw[4] - center = cl_raw[3] - date = cl_raw[5].strftime('%Y-%m-%d') - new_heredicare_classification = models.HeredicareClassification(id = id, selected_class = selected_class, comment = comment, center = center, classification_date = date, vid="") - heredicare_classifications.append(new_heredicare_classification) - heredicare_annotations_raw = self.get_heredicare_annotations(variant_id) all_heredicare_annotations = [] @@ -2407,14 +2395,31 @@ def get_variant(self, variant_id, n_fam = annot[2] n_pat = annot[3] consensus_class = annot[4] - comment = annot[5] + consensus_comment = annot[5] classification_date = annot[6] lr_cooc = annot[7] lr_coseg = annot[8] lr_family = annot[9] - - classification = models.HeredicareClassification(id = heredicare_annotation_id, selected_class = consensus_class, comment = comment, classification_date = classification_date, center = "VUSTF", vid = vid) - new_heredicare_annotation = models.HeredicareAnnotation(id = heredicare_annotation_id, vid = vid, n_fam = n_fam, n_pat = n_pat, vustf_classification = classification, lr_cooc = lr_cooc, lr_coseg = lr_coseg, lr_family = lr_family) + consensus_classification = models.HeredicareConsensusClassification(id = heredicare_annotation_id, selected_class = consensus_class, comment = consensus_comment, classification_date = classification_date) + + + heredicare_classifications_raw = self.get_heredicare_center_classifications(heredicare_annotation_id) + heredicare_center_classifications = None + if heredicare_classifications_raw is not None: + heredicare_center_classifications = [] + for cl_raw in heredicare_classifications_raw: + #id, heredicare_ZID, center_name, classification, comment + id = int(cl_raw[0]) + zid = cl_raw[1] + center_name = cl_raw[2] + selected_class = cl_raw[3] + comment = cl_raw[4] + #date = cl_raw[5].strftime('%Y-%m-%d') + new_heredicare_classification = models.HeredicareCenterClassification(id = id, selected_class = selected_class, comment = comment, center_name = center_name, zid = zid) + heredicare_center_classifications.append(new_heredicare_classification) + + + new_heredicare_annotation = models.HeredicareAnnotation(id = heredicare_annotation_id, vid = vid, n_fam = n_fam, n_pat = n_pat, consensus_classification = consensus_classification, lr_cooc = lr_cooc, lr_coseg = lr_coseg, lr_family = lr_family, center_classifications = heredicare_center_classifications) all_heredicare_annotations.append(new_heredicare_annotation) # add clinvar annotation @@ -2527,7 +2532,6 @@ def get_variant(self, variant_id, annotations = annotations, consensus_classifications = consensus_classifications, user_classifications = user_classifications, - heredicare_classifications = heredicare_classifications, automatic_classification = automatic_classification, heredicare_annotations = all_heredicare_annotations, cancerhotspots_annotations = cancerhotspots_annotations, @@ -2557,7 +2561,6 @@ def get_variant(self, variant_id, annotations = annotations, consensus_classifications = consensus_classifications, user_classifications = user_classifications, - heredicare_classifications = heredicare_classifications, automatic_classification = automatic_classification, heredicare_annotations = all_heredicare_annotations, cancerhotspots_annotations = cancerhotspots_annotations, @@ -2838,9 +2841,11 @@ def get_selected_literature(self, is_user, classification_id): def insert_update_heredivar_clinvar_submission(self, variant_id, submission_id, accession_id, status, message, last_updated, previous_clinvar_accession): if previous_clinvar_accession is None: command = "INSERT INTO heredivar_clinvar_submissions (variant_id, submission_id, accession_id, status, message, last_updated) VALUES (%s, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE submission_id=VALUES(submission_id), accession_id=VALUES(accession_id), status=VALUES(status),message=VALUES(message), last_updated=VALUES(last_updated)" + actual_information = (variant_id, submission_id, accession_id, status, message, last_updated) else: # do not reset the accession id - this one is stable once it was created by clinvar - command = "INSERT INTO heredivar_clinvar_submissions (variant_id, submission_id, status, message, last_updated) VALUES (%s, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE submission_id=VALUES(submission_id), status=VALUES(status),message=VALUES(message), last_updated=VALUES(last_updated)" - self.cursor.execute(command, (variant_id, submission_id, accession_id, status, message, last_updated)) + command = "INSERT INTO heredivar_clinvar_submissions (variant_id, submission_id, status, message, last_updated) VALUES (%s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE submission_id=VALUES(submission_id), status=VALUES(status),message=VALUES(message), last_updated=VALUES(last_updated)" + actual_information = (variant_id, submission_id, status, message, last_updated) + self.cursor.execute(command, actual_information) self.conn.commit() def get_heredivar_clinvar_submission(self, variant_id): @@ -2981,6 +2986,7 @@ def insert_heredicare_annotation(self, variant_id, vid, n_fam, n_pat, consensus_ command = "INSERT INTO variant_heredicare_annotation (variant_id, vid, n_fam, n_pat, consensus_class, date, comment, lr_cooc, lr_coseg, lr_family) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)" self.cursor.execute(command, (variant_id, vid, n_fam, n_pat, consensus_class, classification_date, comment, lr_cooc, lr_coseg, lr_family)) self.conn.commit() + return self.get_last_insert_id() def clear_heredicare_annotation(self, variant_id): command = "DELETE FROM variant_heredicare_annotation WHERE variant_id = %s" diff --git a/src/common/models.py b/src/common/models.py index 18aa70cc..47645060 100644 --- a/src/common/models.py +++ b/src/common/models.py @@ -716,13 +716,11 @@ def to_vcf(self, prefix = True): @dataclass -class HeredicareClassification: +class AbstractHeredicareClassification(AbstractDataclass): id: int selected_class: int comment: str - classification_date: str - center: str - vid: str + def selected_class_to_text(self): if self.selected_class is None: @@ -765,13 +763,29 @@ def selected_class_to_num(self): "-1": "-" } return class2text[str(self.selected_class)] + + @abstractmethod + def to_vcf(self): + pass + + @abstractmethod + def get_header(self): + pass + + + +@dataclass +class HeredicareConsensusClassification(AbstractHeredicareClassification): + classification_date: str def to_vcf(self, prefix = True, simple = False): if not simple: - info = '~7C'.join([self.selected_class_to_num(), self.center, self.comment, self.classification_date]) + comment = "" if self.comment is None else self.comment + date = "" if self.classification_date is None else self.classification_date.strftime('%Y-%m-%d') + info = '~2B'.join([self.selected_class_to_num(), comment, date]) info = info if prefix: - info = 'heredicare_center_classifications~1Y' + info + info = 'heredicare_consensus_classifications~1Y' + info else: info = ['classification~1Y' + self.selected_class_to_num(), #'comment~1Y' + self.comment, @@ -784,7 +798,7 @@ def to_vcf(self, prefix = True, simple = False): def get_header(self, simple = False): if not simple: - header = {'heredicare_center_classifications': '##INFO=\n'} + header = {'heredicare_consensus_classifications': '##INFO=\n'} else: header = {'classification': '##INFO=\n', #'comment': '##INFO=\n', @@ -792,34 +806,62 @@ def get_header(self, simple = False): 'source': '##INFO=\n'} return header +@dataclass +class HeredicareCenterClassification(AbstractHeredicareClassification): + center_name: str + zid: int + + def to_vcf(self, prefix = True): + ## Separator-symbol-hierarchy: ; -> & -> | -> $ -> + + comment = "" if self.comment is None else comment + info = "~2B".join([self.center_name, str(self.zid), self.selected_class_to_num(), comment]) + if prefix: + info = "heredicare_center_classifications~1Y" + info + return info + + def get_header(self): + header = {'heredicare_center_classifications': '##INFO=\n'} + return header + + + @dataclass class HeredicareAnnotation: id: int vid: str n_fam: int n_pat: int - vustf_classification: HeredicareClassification # kind of ugly to use that here because to_vcf can not be used as this is used for the center classifications... + consensus_classification: HeredicareConsensusClassification # kind of ugly to use that here because to_vcf can not be used as this is used for the center classifications... lr_cooc: float lr_coseg: float lr_family: float + center_classifications: Any # list of HerediCareCenterClassification objects + + def get_centers_with_classifications(self): + center_classifications = self.center_classifications + result = None + if center_classifications is not None: + result = [] + for center_classification in center_classifications: + if center_classification.selected_class is not None: + result.append(center_classification.center_name) + return result + def to_vcf(self, prefix = True): - vustf_class = self.vustf_classification.selected_class if self.vustf_classification.selected_class is not None else "" - vustf_comment = self.vustf_classification.comment if self.vustf_classification.comment is not None else "" - vustf_date = self.vustf_classification.classification_date if self.vustf_classification.classification_date is not None else "" - data = [self.vid, self.n_fam, self.n_pat, vustf_class, vustf_comment, vustf_date, self.lr_cooc, self.lr_coseg, self.lr_family] - data = [str(x) for x in data] - info = '~7C'.join(data) - info = info + consensus_comment = "" if self.consensus_classification.comment is None else self.consensus_classification.comment + consensus_date = "" if self.consensus_classification.classification_date is None else self.consensus_classification.classification_date.strftime('%Y-%m-%d') + center_specific_vcf = functions.process_multiple(self.center_classifications, sep="~24", do_prefix = False) + heredicare_annotation_vcf = "~7C".join([str(x) for x in [self.vid, self.n_fam, self.n_pat, self.lr_cooc, self.lr_coseg, self.lr_family, self.consensus_classification.selected_class_to_num(), consensus_comment, consensus_date, center_specific_vcf]]) if prefix: - info = 'heredicare_annotation~1Y' + info - return info + heredicare_annotation_vcf = "heredicare_annotation~1Y" + heredicare_annotation_vcf + return heredicare_annotation_vcf # Separator-symbol-hierarchy: ; -> & -> | -> $ -> + def get_header(self): - header = {'heredicare_annotation': '##INFO=\n'} + header = {'heredicare_annotation': '##INFO=\n'} return header @@ -839,7 +881,6 @@ class AbstractVariant(AbstractDataclass): consensus_classifications: Any = None # list of classifications user_classifications: Any = None # list of classifications - heredicare_classifications: Any = None # list of heredicare center classifications automatic_classification: AutomaticClassification = None heredicare_annotations: Any = None # list of heredicare annotatins clinvar: Any = None # a clinvar object @@ -879,8 +920,8 @@ def group_external_ids(self): def get_heredicare_consensus_classifications(self): result = [] for heredicare_annotation in self.heredicare_annotations: - if heredicare_annotation.vustf_classification.selected_class is not None: - result.append(heredicare_annotation.vustf_classification) + if heredicare_annotation.consensus_classification.selected_class is not None: + result.append(heredicare_annotation.consensus_classification) return result def get_total_heredicare_counts(self): @@ -928,7 +969,7 @@ def get_most_recent_heredicare_consensus_classification(self): return None maxdate = datetime.date.min for heredicare_annotation in self.heredicare_annotations: - current_classification = heredicare_annotation.vustf_classification + current_classification = heredicare_annotation.consensus_classification if current_classification.selected_class is not None: if result is None: result = current_classification @@ -1127,7 +1168,6 @@ def to_vcf(self, simple = False): annotations_oi = [self.user_classifications, [self.get_recent_consensus_classification()], [self.automatic_classification], - self.heredicare_classifications, [self.clinvar], self.heredicare_annotations, self.consequences, @@ -1237,7 +1277,6 @@ def to_vcf(self, simple = False): annotations_oi = [self.user_classifications, [self.get_recent_consensus_classification()], [self.automatic_classification], - self.heredicare_classifications, [self.clinvar], self.heredicare_annotations, self.consequences, diff --git a/src/frontend_celery/webapp/io/download_routes.py b/src/frontend_celery/webapp/io/download_routes.py index 85794e00..7114aa13 100644 --- a/src/frontend_celery/webapp/io/download_routes.py +++ b/src/frontend_celery/webapp/io/download_routes.py @@ -725,7 +725,7 @@ def get_possible_classes_enigma_brca2(class_counts): possible_classes.add(2) if class_counts['bp'] >= 2: # 2 possible_classes.add(2) - if class_counts['bs'] == 1: # 2 + if class_counts['bp1_bs'] == 1: # 2 possible_classes.add(2) if class_counts['bs'] == 1 and class_counts['bm'] == 1: # 1 possible_classes.add(2) @@ -790,7 +790,7 @@ def get_possible_classes_enigma_brca1(class_counts): possible_classes.add(2) if class_counts['bp'] >= 2: # 2 possible_classes.add(2) - if class_counts['bs'] == 1: # 2 + if class_counts['bp1_bs'] == 1: # 2 possible_classes.add(2) if class_counts['bs'] == 1 and class_counts['bm'] == 1: # 1 possible_classes.add(2) @@ -826,7 +826,7 @@ def decide_for_class_task_force(selected_classes): def get_class_counts(data): - result = {'pvs':0, 'ps':0, 'pm':0, 'pp':0, 'bp':0, 'bs':0, 'bm':0, 'ba':0, 'pm2_pp':0} # pm2_pp is special case for ATM scheme + result = {'pvs':0, 'ps':0, 'pm':0, 'pp':0, 'bp':0, 'bs':0, 'bm':0, 'ba':0, 'pm2_pp':0, 'bp1_bs': 0} # pm2_pp is special case for ATM scheme and bp1_bs is special case for brca1/2 data = [x.lower().strip('0123456789') for x in data] for key in result: key = key.lower() diff --git a/src/frontend_celery/webapp/static/css/utils.css b/src/frontend_celery/webapp/static/css/utils.css index d1e73ade..fff87ca0 100644 --- a/src/frontend_celery/webapp/static/css/utils.css +++ b/src/frontend_celery/webapp/static/css/utils.css @@ -243,7 +243,6 @@ max-width: 50em !important; } - /************** multicheck **************/ .multicheck { display: inline-grid; diff --git a/src/frontend_celery/webapp/static/js/classify.js b/src/frontend_celery/webapp/static/js/classify.js index 93d56a11..06a5c14b 100644 --- a/src/frontend_celery/webapp/static/js/classify.js +++ b/src/frontend_celery/webapp/static/js/classify.js @@ -1254,6 +1254,8 @@ function get_checked_criteria_strengths() { var new_value = document.getElementById(current_button.id + '_strength').value if (scheme_type == 'acmg-enigma-atm' && current_button.id == 'PM2') { result.push(current_button.id + "_" + new_value) + } else if ((scheme_type == 'acmg-enigma-brca1' || scheme_type == 'acmg-enigma-brca2') && current_button.id == "BP1") { + result.push(current_button.id + "_" + new_value) } else { result.push(new_value) } diff --git a/src/frontend_celery/webapp/templates/index.html b/src/frontend_celery/webapp/templates/index.html index 7ac5783e..7b0f40dd 100644 --- a/src/frontend_celery/webapp/templates/index.html +++ b/src/frontend_celery/webapp/templates/index.html @@ -101,6 +101,9 @@

Changelog

  • Added scores from likelihood ratio tests.
  • Removed BayesDel annotations from TP53 DB, because they are annotated from a dedicated BayesDel anntation anyway.
  • Improved Cancerhotspots internal representation, display & representation in the INFO column of vcfs
  • +
  • Added gnomAD non-cancer scores
  • +
  • Added HerediCaRe center specific classifications
  • +
  • Added CSpec BRCA1/2 assays to annotation algorithm
  • Bugfixes:
      @@ -110,10 +113,12 @@

      Changelog

    • Transcripts on the negative strand were shown as if they were on the positive strand in the IGV browser
    • Fixed a bug when the user clicked on logout even though the user was already logged out (for example because of inactivity)
    • The default scheme was not properly working. It would automatically select the last scheme in the list as default no matter what was selected on the admin dashboard
    • +
    • Fixed a bug when updating ClinVar submissions
    • +
    • When selecting any BP criterium the enigma BRCA1/2 schemes would instantly switch to class 2. This is now fixed and only BP1_str triggers class 2
    • +
    • Previously the class by scheme was not updated correctly when the user updated their classification
    Known issues:
      -
    • HerediCare Center specific classifications are not available
    • HerediCare priors, log likelihood, segregation & cooccurance are not available
    diff --git a/src/frontend_celery/webapp/templates/variant/variant_base.html b/src/frontend_celery/webapp/templates/variant/variant_base.html index d02d0357..ed7032d9 100644 --- a/src/frontend_celery/webapp/templates/variant/variant_base.html +++ b/src/frontend_celery/webapp/templates/variant/variant_base.html @@ -177,61 +177,68 @@

    Automatic classification

    {% endif %} - - {% set heredicare_consensus_classifications = variant.get_heredicare_consensus_classifications() %} - {% if heredicare_consensus_classifications | length > 0 %} + + {% if variant.heredicare_annotations is not none %}
    -

    HerediCare consensus classifications

    +

    HerediCare classifications

    - - - {% for heredicare_consensus_classification in heredicare_consensus_classifications %} - - - - - {% endfor %} - -
    VID {{heredicare_consensus_classification.vid}} -
      -
    • - Class: {{heredicare_consensus_classification.selected_class_to_text()}} -
    • -
    • - Date: {{heredicare_consensus_classification.classification_date}} -
    • -
    • - Comment: {{heredicare_consensus_classification.comment}} -
    • -
    -
    -
    -
    - {% endif %} - - - {% if variant.heredicare_classifications is not none %} -
    -

    HerediCare center classifications

    -
    - +
    - - - + + + + - {% for classification in variant.heredicare_classifications %} - - - - - + {% for heredicare_annot in variant.heredicare_annotations %} + {% if heredicare_annot.consensus_classification.selected_class is not none or (heredicare_annot.center_classifications is not none and heredicare_center_classifications | length > 0) %} + + + + + + + + + + + + {% endif %} {% endfor %}
    Class
    Center
    Date
    VID
    Consensus class
    Date
    Comment
    Centers with classifications
    {{ classification.selected_class }}{{ classification.center }}{{ classification.date }}{{ classification.comment }}
    {{ heredicare_annot.consensus_classification.vid }}{{ heredicare_annot.consensus_classification.selected_class_to_num() }}{{ heredicare_annot.consensus_classification.classification_date }}{{ heredicare_annot.consensus_classification.comment }} +
    +
    + {{ ", ".join(heredicare_annot.get_centers_with_classifications()) }} +
    +
    + +
    +
    +
    + + + + + + + + + + {% for center_classification in heredicare_annot.center_classifications %} + + + + + + {% endfor %} + +
    Center
    Classification
    Comment
    {{center_classification.center_name}}{{center_classification.selected_class_to_num()}}{{center_classification.comment}}
    +
    diff --git a/src/frontend_celery/webapp/variant/variant_functions.py b/src/frontend_celery/webapp/variant/variant_functions.py index 1404733f..cf987145 100644 --- a/src/frontend_celery/webapp/variant/variant_functions.py +++ b/src/frontend_celery/webapp/variant/variant_functions.py @@ -153,7 +153,7 @@ def handle_user_classification(variant, user_id, new_classification, new_comment is_new_classification = False previous_classification_oi = variant.get_recent_user_classification(user_id, scheme_id) if previous_classification_oi is not None: # user already has a classification -> he requests an update - if previous_classification_oi.comment != new_comment or previous_classification_oi.selected_class != new_classification: + if previous_classification_oi.comment != new_comment or previous_classification_oi.selected_class != new_classification or previous_classification_oi.scheme.selected_class != scheme_class: conn.update_user_classification(previous_classification_oi.id, new_classification, new_comment, date = current_datetime, scheme_class = scheme_class) received_update = True return None, received_update, is_new_classification @@ -282,7 +282,14 @@ def get_scheme_class(criteria_dict, scheme_type, version): keyval = 'criterium_name' for key in criteria_dict: if criteria_dict[key]['is_selected'] == 1: - all_criteria_strengths.append(criteria_dict[key][keyval]) + #special cases + if criteria_dict[key]["criterium_name"] == "BP1" and scheme_type in ["acmg-enigma-brca1", "acmg-enigma-brca2"]: + all_criteria_strengths.append(criteria_dict[key]["criterium_name"] + '_' + criteria_dict[key][keyval]) + elif criteria_dict[key]["criterium_name"] == "PM2" and scheme_type in ["acmg-enigma-atm"]: + all_criteria_strengths.append(criteria_dict[key]["criterium_name"] + '_' + criteria_dict[key][keyval]) + # default case + else: + all_criteria_strengths.append(criteria_dict[key][keyval]) all_criteria_string = '+'.join(all_criteria_strengths) scheme_class = calculate_class(scheme_type, version, all_criteria_string) return scheme_class