From b25d7fcd8e86753f952945a5dc74f4ccdf65b68b Mon Sep 17 00:00:00 2001 From: Alexander Ott Date: Mon, 23 Oct 2023 11:53:39 +0200 Subject: [PATCH] add vicc classification result to NGSD table somatic_vicc_interpretation --- src/cppNGSD-TEST/NGSD_Test.h | 13 +++++++++---- src/cppNGSD-TEST/data_in/NGSD_in1.sql | 10 +++++----- src/cppNGSD/NGSD.cpp | 15 ++++++++------- src/cppNGSD/resources/NGSD_schema.sql | 1 + 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/cppNGSD-TEST/NGSD_Test.h b/src/cppNGSD-TEST/NGSD_Test.h index c80a5da22..d9013950d 100644 --- a/src/cppNGSD-TEST/NGSD_Test.h +++ b/src/cppNGSD-TEST/NGSD_Test.h @@ -5,6 +5,7 @@ #include "SomaticXmlReportGenerator.h" #include "SomaticReportSettings.h" #include "SomaticReportHelper.h" +#include "SomaticVariantInterpreter.h" #include "GermlineReportGenerator.h" #include "TumorOnlyReportWorker.h" #include "StatisticsServiceLocal.h" @@ -2264,9 +2265,6 @@ private slots: IS_TRUE(res2.exclude_other_reason); S_EQUAL(res2.comment, "This test somatic cnv shall be excluded."); - - - //Delete a somatic report configuration I_EQUAL(db.getValue("SELECT count(*) FROM somatic_report_configuration").toInt(), 3); I_EQUAL(db.getValue("SELECT count(*) FROM somatic_report_configuration_cnv").toInt(), 2); //one CNV is already inserted by NGSD init. @@ -2346,8 +2344,10 @@ private slots: IS_THROWN(DatabaseException, db.getSomaticViccData(Variant("chr1", 112175770, 112175770, "C", "A")) ); + //somatic Variant Interpretation for Cancer Consortium SomaticViccData vicc_data1 = db.getSomaticViccData(Variant("chr13", 32929387, 32929387, "T", "C")); + I_EQUAL(vicc_data1.null_mutation_in_tsg, SomaticViccData::State::VICC_TRUE); I_EQUAL(vicc_data1.known_oncogenic_aa, SomaticViccData::State::VICC_FALSE); I_EQUAL(vicc_data1.strong_cancerhotspot, SomaticViccData::State::VICC_FALSE); @@ -2365,6 +2365,9 @@ private slots: I_EQUAL(vicc_data1.benign_computational_evidence, SomaticViccData::State::VICC_FALSE); I_EQUAL(vicc_data1.synonymous_mutation, SomaticViccData::State::NOT_APPLICABLE); S_EQUAL(vicc_data1.comment, "this variant was evaluated as an oncogenic variant"); + S_EQUAL(db.getValue("SELECT classification FROM somatic_vicc_interpretation WHERE id=" + QString::number(db.getSomaticViccId(Variant("chr13", 32929387, 32929387, "T", "C")))).toString(), "ONCOGENIC"); + S_EQUAL(db.getValue("SELECT classification FROM somatic_vicc_interpretation WHERE id=" + QString::number(db.getSomaticViccId(Variant("chr13", 32929387, 32929387, "T", "C")))).toString(), SomaticVariantInterpreter::viccScoreAsString(vicc_data1)); + S_EQUAL(vicc_data1.created_by, "ahmustm1"); S_EQUAL(vicc_data1.created_at.toString("yyyy-MM-dd hh:mm:ss"), "2020-11-05 13:06:13"); @@ -2375,6 +2378,8 @@ private slots: S_EQUAL(vicc_data2.comment, "this variant was evaluated as variant of unclear significance"); S_EQUAL(vicc_data2.last_updated_by, "ahkerra1"); S_EQUAL(vicc_data2.last_updated_at.toString("yyyy-MM-dd hh:mm:ss"), "2020-12-08 13:45:11"); + S_EQUAL(db.getValue("SELECT classification FROM somatic_vicc_interpretation WHERE id=" + QString::number(db.getSomaticViccId(Variant("chr15", 43707808, 43707808, "A", "T")))).toString(), "UNCERTAIN_SIGNIFICANCE"); + //Update somatic VICC data in NGSD SomaticViccData vicc_update = vicc_data2; @@ -2412,9 +2417,9 @@ private slots: I_EQUAL(vicc_data2.benign_computational_evidence, SomaticViccData::State::VICC_FALSE); I_EQUAL(vicc_data2.synonymous_mutation, SomaticViccData::State::VICC_FALSE); S_EQUAL(vicc_data2.comment, "This variant was reevaluated as oncogenic!"); + S_EQUAL(db.getValue("SELECT classification FROM somatic_vicc_interpretation WHERE id=" + QString::number(db.getSomaticViccId(Variant("chr15", 43707808, 43707808, "A", "T")))).toString(), "ONCOGENIC"); S_EQUAL(vicc_data2.last_updated_by, "ahmustm1"); IS_TRUE(vicc_data2.last_updated_at.toString("yyyy-MM-dd hh:mm:ss") != "2020-12-08 13:45:11"); - //Insert new somatic VICC interpretation SomaticViccData new_vicc_data; new_vicc_data.null_mutation_in_tsg = SomaticViccData::State::VICC_FALSE; diff --git a/src/cppNGSD-TEST/data_in/NGSD_in1.sql b/src/cppNGSD-TEST/data_in/NGSD_in1.sql index 9d7604498..1d1d1fd8b 100644 --- a/src/cppNGSD-TEST/data_in/NGSD_in1.sql +++ b/src/cppNGSD-TEST/data_in/NGSD_in1.sql @@ -577,11 +577,11 @@ INSERT INTO `somatic_report_configuration_cnv` (`somatic_report_configuration_id (3, 4, true, false, false, false, false, ""); -- somatic_vicc -INSERT INTO `somatic_vicc_interpretation` (`id`, `variant_id`, `null_mutation_in_tsg`, `known_oncogenic_aa`, `strong_cancerhotspot`, `located_in_canerhotspot`, `absent_from_controls`, `protein_length_change`, `other_aa_known_oncogenic`, `weak_cancerhotspot`, `computational_evidence`, `mutation_in_gene_with_etiology`, `very_weak_cancerhotspot`, `very_high_maf`, `benign_functional_studies`, `high_maf`, `benign_computational_evidence`, `synonymous_mutation`, `comment`, `created_by`, `created_date`, `last_edit_by`, `last_edit_date`) VALUES -(1, 210585, true, false, false, true, true, null, true, false, null, false, true, false, false, false, false, null, 'this variant was evaluated as an oncogenic variant', 99, '2020-11-05 13:06:13', 101, '2020-12-07 11:06:10'), -(2, 213346, false, true, false, true, true, null, true, false, null, false, true, true, true, true, true, true, 'this variant was evaluated as variant of unclear significance', 99, '2020-12-05 12:07:11', 101, '2020-12-08 13:45:11'), -(3, 2407600, true, false, false, true, true, null, true, false, null, false, true, false, false, false, false, null, 'this variant was evaluated as an oncogenic variant', 99, '2021-01-05 13:06:13', 101, '2021-02-07 11:06:10'), -(4, 2407601, false, false, false, false, true, null, true, false, null, false, true, true, true, false, false, null, 'this variant was evaluated as an oncogenic variant', 99, '2021-02-06 11:06:14', 101, '2021-02-08 13:06:10'); +INSERT INTO `somatic_vicc_interpretation` (`id`, `variant_id`, `null_mutation_in_tsg`, `known_oncogenic_aa`, `strong_cancerhotspot`, `located_in_canerhotspot`, `absent_from_controls`, `protein_length_change`, `other_aa_known_oncogenic`, `weak_cancerhotspot`, `computational_evidence`, `mutation_in_gene_with_etiology`, `very_weak_cancerhotspot`, `very_high_maf`, `benign_functional_studies`, `high_maf`, `benign_computational_evidence`, `synonymous_mutation`, `classification`, `comment`, `created_by`, `created_date`, `last_edit_by`, `last_edit_date`) VALUES +(1, 210585, true, false, false, true, true, null, true, false, null, false, true, false, false, false, false, null, 'ONCOGENIC', 'this variant was evaluated as an oncogenic variant', 99, '2020-11-05 13:06:13', 101, '2020-12-07 11:06:10'), +(2, 213346, false, true, false, true, true, null, true, false, null, false, true, true, true, true, true, true, 'UNCERTAIN_SIGNIFICANCE', 'this variant was evaluated as variant of unclear significance', 99, '2020-12-05 12:07:11', 101, '2020-12-08 13:45:11'), +(3, 2407600, true, false, false, true, true, null, true, false, null, false, true, false, false, false, false, null, 'ONCOGENIC', 'this variant was evaluated as an oncogenic variant', 99, '2021-01-05 13:06:13', 101, '2021-02-07 11:06:10'), +(4, 2407601, false, false, false, false, true, null, true, false, null, false, true, true, true, false, false, null, 'BENIGN', 'this variant was evaluated as an benign variant', 99, '2021-02-06 11:06:14', 101, '2021-02-08 13:06:10'); -- somatic_pathway INSERT INTO `somatic_pathway` (`id`, `name`) VALUES diff --git a/src/cppNGSD/NGSD.cpp b/src/cppNGSD/NGSD.cpp index 560a67dae..bc047bbfd 100644 --- a/src/cppNGSD/NGSD.cpp +++ b/src/cppNGSD/NGSD.cpp @@ -4042,7 +4042,6 @@ void NGSD::setSomaticViccData(const Variant& variant, const SomaticViccData& vic } QString variant_id = variantId(variant); - SqlQuery query = getQuery(); //this lambda binds all values needed for both inserting and updating @@ -4072,23 +4071,25 @@ void NGSD::setSomaticViccData(const Variant& variant, const SomaticViccData& vic query.bindValue(14 , stateToVar( vicc_data.high_maf ) ); query.bindValue(15 , stateToVar( vicc_data.benign_computational_evidence ) ); query.bindValue(16 , stateToVar( vicc_data.synonymous_mutation ) ); - query.bindValue(17 , vicc_data.comment ); - query.bindValue(18 , userId(user_name) ); + query.bindValue(17 , SomaticVariantInterpreter::viccScoreAsString(vicc_data)); //set classification by interpreter to make sure it fits with the states + query.bindValue(18 , vicc_data.comment ); + query.bindValue(19 , userId(user_name) ); + }; int vicc_id = getSomaticViccId(variant); if(vicc_id != -1) //update data set { - query.prepare("UPDATE `somatic_vicc_interpretation` SET `null_mutation_in_tsg`=:0, `known_oncogenic_aa`=:1, `oncogenic_funtional_studies`=:2, `strong_cancerhotspot`=:3, `located_in_canerhotspot`=:4, `absent_from_controls`=:5, `protein_length_change`=:6, `other_aa_known_oncogenic`=:7, `weak_cancerhotspot`=:8, `computational_evidence`=:9, `mutation_in_gene_with_etiology`=:10, `very_weak_cancerhotspot`=:11, `very_high_maf`=:12, `benign_functional_studies`=:13, `high_maf`=:14, `benign_computational_evidence`=:15, `synonymous_mutation`=:16, `comment`=:17, `last_edit_by`=:18, `last_edit_date`= CURRENT_TIMESTAMP WHERE `id`=" + QByteArray::number(vicc_id) ); + query.prepare("UPDATE `somatic_vicc_interpretation` SET `null_mutation_in_tsg`=:0, `known_oncogenic_aa`=:1, `oncogenic_funtional_studies`=:2, `strong_cancerhotspot`=:3, `located_in_canerhotspot`=:4, `absent_from_controls`=:5, `protein_length_change`=:6, `other_aa_known_oncogenic`=:7, `weak_cancerhotspot`=:8, `computational_evidence`=:9, `mutation_in_gene_with_etiology`=:10, `very_weak_cancerhotspot`=:11, `very_high_maf`=:12, `benign_functional_studies`=:13, `high_maf`=:14, `benign_computational_evidence`=:15, `synonymous_mutation`=:16, `classification`=:17, `comment`=:18, `last_edit_by`=:19, `last_edit_date`= CURRENT_TIMESTAMP WHERE `id`=" + QByteArray::number(vicc_id)); bind(); query.exec(); } else //insert new data set { - query.prepare("INSERT INTO `somatic_vicc_interpretation` (`null_mutation_in_tsg`, `known_oncogenic_aa`, `oncogenic_funtional_studies`, `strong_cancerhotspot`, `located_in_canerhotspot`, `absent_from_controls`, `protein_length_change`, `other_aa_known_oncogenic`, `weak_cancerhotspot`, `computational_evidence`, `mutation_in_gene_with_etiology`, `very_weak_cancerhotspot`, `very_high_maf`, `benign_functional_studies`, `high_maf`, `benign_computational_evidence`, `synonymous_mutation`, `comment`, `last_edit_by`, `last_edit_date`, `created_by`, `created_date`, `variant_id`) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, CURRENT_TIMESTAMP, :19, CURRENT_TIMESTAMP, :20)"); + query.prepare("INSERT INTO `somatic_vicc_interpretation` (`null_mutation_in_tsg`, `known_oncogenic_aa`, `oncogenic_funtional_studies`, `strong_cancerhotspot`, `located_in_canerhotspot`, `absent_from_controls`, `protein_length_change`, `other_aa_known_oncogenic`, `weak_cancerhotspot`, `computational_evidence`, `mutation_in_gene_with_etiology`, `very_weak_cancerhotspot`, `very_high_maf`, `benign_functional_studies`, `high_maf`, `benign_computational_evidence`, `synonymous_mutation`, `classification`, `comment`, `last_edit_by`, `last_edit_date`, `created_by`, `created_date`, `variant_id`) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, :18, :19, CURRENT_TIMESTAMP, :20, CURRENT_TIMESTAMP, :21)"); bind(); - query.bindValue(19, userId(user_name) ); - query.bindValue(20, variant_id); + query.bindValue(20, userId(user_name) ); + query.bindValue(21, variant_id); query.exec(); } } diff --git a/src/cppNGSD/resources/NGSD_schema.sql b/src/cppNGSD/resources/NGSD_schema.sql index 47802a13b..6e416ef32 100644 --- a/src/cppNGSD/resources/NGSD_schema.sql +++ b/src/cppNGSD/resources/NGSD_schema.sql @@ -720,6 +720,7 @@ CREATE TABLE IF NOT EXISTS `somatic_vicc_interpretation` `high_maf` BOOLEAN NULL DEFAULT NULL, `benign_computational_evidence` BOOLEAN NULL DEFAULT NULL, `synonymous_mutation` BOOLEAN NULL DEFAULT NULL, + `classification` ENUM('ONCOGENIC', 'LIKELY_ONCOGENIC', 'BENIGN', 'LIKELY_BENIGN', 'UNCERTAIN_SIGNIFICANCE') NULL DEFAULT NULL, `comment` TEXT NULL DEFAULT NULL, `created_by` int(11) DEFAULT NULL, `created_date` DATETIME NOT NULL,