From 8157f38fa2ac3881079746f88056b53b5ff4c67b Mon Sep 17 00:00:00 2001
From: Oumaima Hamza <73792407+OumaimaHamza@users.noreply.github.com>
Date: Fri, 19 Apr 2024 16:54:16 -0400
Subject: [PATCH] GCGI-1318, pWGS report improvements (#374)
* first draft of changes
* add detection cutoff constant to results_dict
* Add introductory sentence
* introductory sentence tweaks
* introductory sentence tweaks
* import case overview plugins
* no message
* no message
* Add extraction step to plugin.py
* include data from different plugin to the results dictionary
* Pull parameters from full.config.ini
* get path to the workspace directory
* pull pc.results from json output file
* write data to json
* Different pattern for extracted fields
* no message
* using built in method to write to json
* Use wrapper to access configuration parameters
* Added file not found exception
* file exist check and adjusting test
* checksum update and testing for scenario when file exists
* update summary/plugin_test.py checksum
---------
Co-authored-by: Oumaima Hamza This test counted the number of sites in the patient's plasma
+ This patient has been diagnosed with ${results.get(constants.PRIMARY_CANCER)} and has been referred for the OICR Genomics ${results.get(constants.ASSAY)} assay through the ${results.get(constants.STUDY)} study.
+ This test counted the number of sites in the patient's plasma
at which variants were detected that match variants found in the patient's primary tumour
(candidate sites passing QC: ${html_builder.k_comma_format(results.get(constants.SITES_CHECKED))}).
To test for the possibility that candidate SNVs match SNVs arising from sequencing artefacts,
@@ -17,12 +18,12 @@
The number of SNVs of tumour origin
detected in this plasma sample (detected sites: ${html_builder.k_comma_format(results.get(constants.SITES_DETECTED))}) was
${results.get(constants.SIGNIFICANCE)}
- than in the control cohort (N=${results.get(constants.COHORT_N)}).
Reads Checked | Reads Detected | -Detected:Checked Reads Ratio (%) | +Detected:Checked Reads (%) |
---|---|---|
${results.get(constants.PRIMARY_CANCER)} | Site of biopsy: | -Liquid Biopsy | +Blood cell-free DNA |
Study: | ${results.get(constants.STUDY)} | diff --git a/src/lib/djerba/plugins/pwgs/case_overview/plugin.py b/src/lib/djerba/plugins/pwgs/case_overview/plugin.py index ff35d0cc7..c0a82a986 100644 --- a/src/lib/djerba/plugins/pwgs/case_overview/plugin.py +++ b/src/lib/djerba/plugins/pwgs/case_overview/plugin.py @@ -11,8 +11,8 @@ import djerba.plugins.pwgs.pwgs_tools as pwgs_tools import djerba.plugins.pwgs.constants as pc -class main(plugin_base): +class main(plugin_base): PRIORITY = 100 PLUGIN_VERSION = '1.0' @@ -20,7 +20,7 @@ def configure(self, config): config = self.apply_defaults(config) wrapper = self.get_config_wrapper(config) work_dir = self.workspace.get_work_dir() - if os.path.exists(os.path.join(work_dir,core_constants.DEFAULT_SAMPLE_INFO)): + if os.path.exists(os.path.join(work_dir, core_constants.DEFAULT_SAMPLE_INFO)): sample_info = self.workspace.read_json(core_constants.DEFAULT_SAMPLE_INFO) if wrapper.my_param_is_null(pc.DONOR): wrapper.set_my_param(pc.DONOR, sample_info[pc.DONOR]) @@ -40,24 +40,25 @@ def configure(self, config): def extract(self, config): wrapper = self.get_config_wrapper(config) data = self.get_starting_plugin_data(wrapper, self.PLUGIN_VERSION) - results = { - pc.ASSAY: "plasma Whole Genome Sequencing (pWGS) - 30X (v1.0)", - pc.PWGS_REPORT: config['core']['report_id'], - pc.PRIMARY_CANCER: config[self.identifier][pc.PRIMARY_CANCER], - pc.REQ_APPROVED: config[self.identifier][pc.REQ_APPROVED], - pc.DONOR: config[self.identifier][pc.DONOR], - pc.GROUP_ID: config[self.identifier][pc.GROUP_ID], - pc.PATIENT_ID: config[self.identifier][pc.PATIENT_ID_LOWER], - pc.STUDY: config[self.identifier][pc.STUDY], - pc.WGS_REPORT: config[self.identifier][pc.WGS_REPORT] - } + results = { + pc.ASSAY: "plasma Whole Genome Sequencing (pWGS) - 30X (v1.0)", + pc.PWGS_REPORT: config['core']['report_id'], + pc.PRIMARY_CANCER: config[self.identifier][pc.PRIMARY_CANCER], + pc.REQ_APPROVED: config[self.identifier][pc.REQ_APPROVED], + pc.DONOR: config[self.identifier][pc.DONOR], + pc.GROUP_ID: config[self.identifier][pc.GROUP_ID], + pc.PATIENT_ID: config[self.identifier][pc.PATIENT_ID_LOWER], + pc.STUDY: config[self.identifier][pc.STUDY], + pc.WGS_REPORT: config[self.identifier][pc.WGS_REPORT] + } data[pc.RESULTS] = results + self.workspace.write_json('pWGS_case_overview_output.json', data) return data - + def render(self, data): renderer = mako_renderer(self.get_module_dir()) return renderer.render_name(pc.CASE_OVERVIEW_TEMPLATE_NAME, data) - + def specify_params(self): required = [ pc.REQ_APPROVED, @@ -77,3 +78,4 @@ def specify_params(self): self.set_ini_default(core_constants.ATTRIBUTES, 'clinical') self.set_priority_defaults(self.PRIORITY) + diff --git a/src/lib/djerba/plugins/pwgs/case_overview/test/plugin_test.py b/src/lib/djerba/plugins/pwgs/case_overview/test/plugin_test.py index 6b2a2f8a7..92370a299 100755 --- a/src/lib/djerba/plugins/pwgs/case_overview/test/plugin_test.py +++ b/src/lib/djerba/plugins/pwgs/case_overview/test/plugin_test.py @@ -40,7 +40,7 @@ def testPwgsCase(self): params = { self.INI: self.INI_NAME, self.JSON: json_location, - self.MD5: '13655e31f88039cae030d374134c9438' + self.MD5: 'dcf8ea1396831a90c135f7a0936183d3' } self.run_basic_test(input_dir, params) diff --git a/src/lib/djerba/plugins/pwgs/constants.py b/src/lib/djerba/plugins/pwgs/constants.py index 7214d18b5..59c562371 100644 --- a/src/lib/djerba/plugins/pwgs/constants.py +++ b/src/lib/djerba/plugins/pwgs/constants.py @@ -6,6 +6,7 @@ COVERAGE = 'coverage' CTDNA_DETECTION = 'ctdna_detection' CTDNA_OUTCOME = 'outcome' +DATASET_DETECTION_CUTOFF = 'dataset_detection_cutoff' DETECTION_PLOT = 'detection_plot' INSERT_SIZE = 'median_insert_size' PVALUE = 'p-value' diff --git a/src/lib/djerba/plugins/pwgs/pwgs_tools.py b/src/lib/djerba/plugins/pwgs/pwgs_tools.py index 051098e0b..8ba17ad46 100644 --- a/src/lib/djerba/plugins/pwgs/pwgs_tools.py +++ b/src/lib/djerba/plugins/pwgs/pwgs_tools.py @@ -17,7 +17,8 @@ def preprocess_results(self, results_path): try: results_dict = { constants.TUMOUR_FRACTION_ZVIRAN: float('%.1E' % Decimal(row[7]))*100, - constants.PVALUE: float('%.3E' % Decimal(row[10])) + constants.PVALUE: float('%.3E' % Decimal(row[10])), + constants.DATASET_DETECTION_CUTOFF: float(row[11]) } except IndexError as err: msg = "Incorrect number of columns in vaf row: '{0}' ".format(row)+\ diff --git a/src/lib/djerba/plugins/pwgs/summary/summary_template.html b/src/lib/djerba/plugins/pwgs/summary/summary_template.html index e09588a88..6e5441576 100644 --- a/src/lib/djerba/plugins/pwgs/summary/summary_template.html +++ b/src/lib/djerba/plugins/pwgs/summary/summary_template.html @@ -8,10 +8,10 @@
Mutational sampling analysis: | diff --git a/src/lib/djerba/plugins/pwgs/summary/test/plugin_test.py b/src/lib/djerba/plugins/pwgs/summary/test/plugin_test.py index a7b2ff80d..ec6dc3afa 100755 --- a/src/lib/djerba/plugins/pwgs/summary/test/plugin_test.py +++ b/src/lib/djerba/plugins/pwgs/summary/test/plugin_test.py @@ -41,7 +41,7 @@ def testPwgsSummary(self): params = { self.INI: self.INI_NAME, self.JSON: json_location, - self.MD5: '6416078989efc8197eb5179ebf379614' + self.MD5: 'ee5d5bc62807914086abcd66c6038e85' } self.run_basic_test(input_dir, params) diff --git a/src/lib/djerba/plugins/supplement/body/supplementary_materials_template.html b/src/lib/djerba/plugins/supplement/body/supplementary_materials_template.html index 826272387..b1ef53e6b 100644 --- a/src/lib/djerba/plugins/supplement/body/supplementary_materials_template.html +++ b/src/lib/djerba/plugins/supplement/body/supplementary_materials_template.html @@ -73,13 +73,7 @@