Skip to content

Commit

Permalink
Merge pull request #491 from oicr-gsi/release-1.7.7
Browse files Browse the repository at this point in the history
Release 1.7.7
  • Loading branch information
iainrb authored Nov 11, 2024
2 parents 24bba4e + 804f9c9 commit cdaea31
Show file tree
Hide file tree
Showing 23 changed files with 348 additions and 40 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# CHANGELOG

## 1.7.7: 2024-11-11
- GCGI-1424: Fix rendering of non-Latin characters
- GCGI-1437: Remove unnecessary checks in OncoKB cache
- GCGI-981: Create virus (research) plugin
- GCGI-1460: Make study a required parameter for PWGS
- GCGI-1459: Update report date for PWGS assay from yyyy/mm/dd to date report was generated
- GCGI-1458: Change geneticist sign-off date from date report was generated to yyyy-mm-dd
- GCGI-1465: Fix for overzealous date format check from implementation of GCGI-1458

## 1.7.6: 2024-10-22
- GCGI-1156: Merge long-running documentation branch to main
- GCGI-1452: Update disclaimer with somatic mutation text and laboratory disclaimer
- GCGI-1453: Update pWGS version number
- GCGI-1456: Fix rounding of estimated tumour fraction in tar.sample
- Increase csv field limit in plugins.fusions.tools.py to handle large fields in mavis_summary.txt
- Increase csv field limit in plugins.fusions.tools.py to handle large fields in mavis_summary.txt

## 1.7.5: 2024-10-02
- GCGI-1378: Improve benchmarking to write an HTML summary page; update tests
Expand Down
2 changes: 1 addition & 1 deletion src/lib/djerba/core/html_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def update_cached_html(self, new_html, old_cache):
if replace_name:
msg = "No end tag found for component name '{0}'".format(replace_name)
self.logger.error(msg)
raise DjerbaHatmlCacheError(msg)
raise DjerbaHtmlCacheError(msg)
self.logger.debug("HTML update done")
return "\n".join(new_lines)

Expand Down
4 changes: 2 additions & 2 deletions src/lib/djerba/core/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def update_report_data(self, new_data, data, force):

def update_data_from_file(self, new_data, json_path, force):
"""Read old JSON from a file, and return the updated data structure"""
with open(json_path) as in_file:
with open(json_path, encoding=cc.TEXT_ENCODING) as in_file:
data = json.loads(in_file.read())
return self.update_report_data(new_data, data, force)

Expand Down Expand Up @@ -579,7 +579,7 @@ def update(self, config_path, json_path, out_dir, archive, pdf, summary_only, fo
config = self.configure_from_parser(config_in)
else:
config = self.configure(config_path)
with open(json_path) as in_file:
with open(json_path, encoding=cc.TEXT_ENCODING) as in_file:
data = json.loads(in_file.read())
data_new = self.base_extract(config)
data = self.update_data_from_file(data_new, json_path, force)
Expand Down
13 changes: 8 additions & 5 deletions src/lib/djerba/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import json
import logging
import os
import djerba.core.constants as cc
from djerba.util.logger import logger
from djerba.util.validator import path_validator

Expand Down Expand Up @@ -51,15 +52,15 @@ def open_file(self, rel_path, mode='r'):
self.validator.validate_input_file(file_path)
else:
self.validator.validate_output_file(file_path)
return open(file_path, mode)
return open(file_path, mode, encoding=cc.TEXT_ENCODING)

def print_location(self):
return self.dir_path

def read_json(self, rel_path):
in_path = os.path.join(self.dir_path, rel_path)
self.validator.validate_input_file(in_path)
with open(in_path) as in_file:
with open(in_path, encoding=cc.TEXT_ENCODING) as in_file:
data = json.loads(in_file.read())
return data

Expand All @@ -82,7 +83,7 @@ def read_maybe_json(self, rel_path):
def read_string(self, rel_path):
in_path = os.path.join(self.dir_path, rel_path)
self.validator.validate_input_file(in_path)
with open(in_path) as in_file:
with open(in_path, encoding=cc.TEXT_ENCODING) as in_file:
content = in_file.read()
return content

Expand All @@ -92,9 +93,11 @@ def remove_file(self, rel_path):
# no need to validate paths for write_* methods; output dir already validated as writable

def write_json(self, rel_path, data):
with open(os.path.join(self.dir_path, rel_path), 'w') as out_file:
out_path = os.path.join(self.dir_path, rel_path)
with open(out_path, 'w', encoding=cc.TEXT_ENCODING) as out_file:
out_file.write(json.dumps(data))

def write_string(self, rel_path, output_string):
with open(os.path.join(self.dir_path, rel_path), 'w') as out_file:
out_path = os.path.join(self.dir_path, rel_path)
with open(out_path, 'w', encoding=cc.TEXT_ENCODING) as out_file:
out_file.write(output_string)
2 changes: 1 addition & 1 deletion src/lib/djerba/plugins/pwgs/analysis/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def extract(self, config):
json_data = json.load(json_file)
assay = json_data.get("results", {}).get("assay", "Assay name not found")
primary_cancer = json_data.get("results", {}).get("primary_cancer", "Primary cancer not found")
study_title = json_data.get("results", {}).get("study_title", "Study title not found")
study_title = json_data.get("results", {}).get("study", "Study title not found")
else:
assay = "Assay name not found"
primary_cancer = "Primary cancer not found"
Expand Down
5 changes: 3 additions & 2 deletions src/lib/djerba/plugins/pwgs/case_overview/case_template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%
from djerba.util.html import html_builder
import djerba.plugins.pwgs.constants as constants
from djerba.util.date import get_todays_date
%>

${html_builder.section_cells_begin("Case Overview", True)}
Expand Down Expand Up @@ -37,11 +38,11 @@
<td>Plasma Sample ID:</td><td>${results.get(constants.GROUP_ID)}</td>
</tr>
<tr>
<td>Date of Report:</td> <td>yyyy/mm/dd</td>
<td>Date of Report:</td> <td>${get_todays_date()}</td>
<td>pWGS Report ID:</td><td>${results.get(constants.PWGS_REPORT)}</td>
</tr>


</table>

${html_builder.section_cells_end()}
${html_builder.section_cells_end()}
7 changes: 2 additions & 5 deletions src/lib/djerba/plugins/pwgs/case_overview/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def configure(self, config):
wrapper.set_my_param(pc.GROUP_ID, sample_info[core_constants.TUMOUR_ID])
if wrapper.my_param_is_null(pc.PATIENT_ID_LOWER):
wrapper.set_my_param(pc.PATIENT_ID_LOWER, sample_info[pc.PATIENT_ID_LOWER])
if wrapper.my_param_is_null(pc.STUDY):
# if study id is unspecifided, default to project id
wrapper.set_my_param(pc.STUDY, sample_info[pc.PROJECT])
else:
msg = 'sample info file not found, make sure case overview parameters are in INI'
self.logger.warning(msg)
Expand Down Expand Up @@ -66,15 +63,15 @@ def specify_params(self):
required = [
pc.REQ_APPROVED,
pc.PRIMARY_CANCER,
pc.WGS_REPORT
pc.WGS_REPORT,
pc.STUDY
]
for key in required:
self.add_ini_required(key)
discovered = [
pc.DONOR,
pc.GROUP_ID,
pc.PATIENT_ID_LOWER,
pc.STUDY
]
for key in discovered:
self.add_ini_discovered(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def testPwgsCase(self):
params = {
self.INI: self.INI_NAME,
self.JSON: json_location,
self.MD5: '9bf12ff6b6f8af8382480cb870f3f666'
self.MD5: '3d7ff8107b879dd01db629482971969d'
}
self.run_basic_test(input_dir, params)

Expand Down
6 changes: 3 additions & 3 deletions src/lib/djerba/plugins/pwgs/case_overview/test/pwgs.case.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[core]

[pwgs.case_overview]
requisition_approved = 2023/01/01
study_title = Plasma Val
requisition_approved = 2023-01-01
study = Plasma Val
primary_cancer = Uterine Clear Cell Carcinoma
donor = OCT_011328
group_id = OCT_010384_Ct_T_nn_1-11_LB01
patient_study_id= OCT-01-1328
wgs_report_id=OCT-01-1328_Ut_P-v2
wgs_report_id=OCT-01-1328_Ut_P-v2
4 changes: 2 additions & 2 deletions src/lib/djerba/plugins/pwgs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
PWGS_REPORT = 'pwgs_report_id'
REQ_APPROVED = 'requisition_approved'
REQ_ID = 'requisition_id'
STUDY = 'study_title'
STUDY = 'study'
WGS_REPORT = 'wgs_report_id'

# file constants
Expand All @@ -58,4 +58,4 @@
ANALYSIS_TEMPLATE_NAME = 'analysis_template.html'
SAMPLE_TEMPLATE_NAME = 'sample_template.html'
SUMMARY_TEMPLATE_NAME = 'summary_template.html'
CASE_OVERVIEW_TEMPLATE_NAME = 'case_template.html'
CASE_OVERVIEW_TEMPLATE_NAME = 'case_template.html'
2 changes: 1 addition & 1 deletion src/lib/djerba/plugins/summary/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def configure(self, config):
def extract(self, config):
wrapper = self.get_config_wrapper(config)
summary_path = wrapper.get_my_string(self.SUMMARY_FILE)
with open(summary_path) as in_file:
with open(summary_path, encoding=core_constants.TEXT_ENCODING) as in_file:
summary_text = in_file.read()
self.logger.debug('Read summary from {0}: "{1}"'.format(summary_path, summary_text))
data = self.get_starting_plugin_data(wrapper, self.PLUGIN_VERSION)
Expand Down
1 change: 1 addition & 0 deletions src/lib/djerba/plugins/summary/test/custom_summary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \u0391\u0392\u0393\u0394\u03B1\u03B2\u03B3\u03B4
22 changes: 21 additions & 1 deletion src/lib/djerba/plugins/summary/test/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import unittest
import tempfile
from configparser import ConfigParser

from djerba.util.validator import path_validator
from djerba.plugins.plugin_tester import PluginTester
Expand All @@ -20,13 +21,32 @@ def setUp(self):

def testSummary(self):
test_source_dir = os.path.realpath(os.path.dirname(__file__))
json_location = os.path.join(self.data_dir_root ,"plugins/summary/report_json/summary.json")
json_location = os.path.join(self.data_dir_root, "plugins", "summary", "report_json", "summary.json")
params = {
self.INI: 'summary.ini',
self.JSON: json_location,
self.MD5: '155e22cc02a45e04dc9058112354367c'
}
self.run_basic_test(test_source_dir, params)

def testSummaryWithCustomText(self):
test_source_dir = os.path.realpath(os.path.dirname(__file__))
summary_path = os.path.join(test_source_dir, 'custom_summary.txt')
config = ConfigParser()
config.add_section('core')
config.add_section('summary')
config.set('summary', 'summary_file', summary_path)
ini_path = os.path.join(self.tmp_dir, 'custom_summary.ini')
with open(ini_path, 'w') as ini_file:
config.write(ini_file)
json_location = os.path.join(self.data_dir_root, "plugins", "summary", "report_json", "custom_summary.json")
params = {
self.INI: ini_path,
self.JSON: json_location,
self.MD5: 'cebbb53b9b074131e309dca71704a896'
}
self.run_basic_test(test_source_dir, params)


if __name__ == '__main__':
unittest.main()
9 changes: 6 additions & 3 deletions src/lib/djerba/plugins/supplement/body/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class main(plugin_base):
INCLUDE_SIGNOFFS = "include_signoffs"
GENETICIST_DEFAULT = 'PLACEHOLDER'
GENETICIST_ID_DEFAULT = 'XXXXXXX'
REPORT_SIGNOUT_DEFAULT = 'yyyy-mm-dd'

def check_assay_name(self, wrapper):
[ok, msg] = assays.name_status(wrapper.get_my_string(self.ASSAY))
Expand Down Expand Up @@ -54,13 +55,15 @@ def configure(self, config):
# Check if dates are valid
user_supplied_date = wrapper.get_my_string(self.USER_SUPPLIED_DRAFT_DATE)
report_signoff_date = wrapper.get_my_string(self.REPORT_SIGNOFF_DATE)
for date in [user_supplied_date, report_signoff_date]:
dates_to_check = [user_supplied_date, ]
if report_signoff_date != self.REPORT_SIGNOUT_DEFAULT:
dates_to_check.append(report_signoff_date)
for date in dates_to_check:
if not is_valid_date(date):
msg = "Invalid requisition approved date '{0}': ".format(date)+\
"Must be in yyyy-mm-dd format"
self.logger.error(msg)
raise ValueError(msg)

return wrapper.get_config()

def extract(self, config):
Expand Down Expand Up @@ -113,7 +116,7 @@ def specify_params(self):
]
for key in discovered:
self.add_ini_discovered(key)
self.set_ini_default(self.REPORT_SIGNOFF_DATE, get_todays_date())
self.set_ini_default(self.REPORT_SIGNOFF_DATE, self.REPORT_SIGNOUT_DEFAULT)
self.set_ini_default(self.USER_SUPPLIED_DRAFT_DATE, get_todays_date())
self.set_ini_default(self.GENETICIST, self.GENETICIST_DEFAULT)
self.set_ini_default(self.GENETICIST_ID, self.GENETICIST_ID_DEFAULT)
Expand Down
Loading

0 comments on commit cdaea31

Please sign in to comment.