From ccd57aa0fd6ed08c3b7deffcfa1d28b421473ba5 Mon Sep 17 00:00:00 2001 From: wintun12 Date: Wed, 20 Mar 2024 09:42:52 +0000 Subject: [PATCH 1/6] change lock_sheet function --- resources/home/dnanexus/generate_workbook/utils/excel.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/home/dnanexus/generate_workbook/utils/excel.py b/resources/home/dnanexus/generate_workbook/utils/excel.py index 11f0ceff..7540bf0c 100644 --- a/resources/home/dnanexus/generate_workbook/utils/excel.py +++ b/resources/home/dnanexus/generate_workbook/utils/excel.py @@ -1640,6 +1640,10 @@ def lock_sheet(self, ws, cell_to_unlock, start_row, start_col, row_num = row cell = f"{col_letter}{row_num}" ws[cell].protection = Protection(locked=False) + prot = ws.protection + prot.formatColumns = False + prot.formatRows = False + prot.formatCells = False def get_col_letter(self, worksheet, col_name) -> str: """ From 5c9e51d28b4240b1976027374a53a9738c090daf Mon Sep 17 00:00:00 2001 From: wintun12 Date: Wed, 20 Mar 2024 12:32:04 +0000 Subject: [PATCH 2/6] update version in dxpy.json --- dxapp.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dxapp.json b/dxapp.json index ee6d439d..c4c7d377 100644 --- a/dxapp.json +++ b/dxapp.json @@ -3,8 +3,8 @@ "title": "eggd_generate_variant_workbook", "summary": "Create Excel workbook from VEP annotated vcf", "dxapi": "1.0.0", - "version": "2.8.0", - "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500", + "version": "2.8.1", + "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500; * v2.8.1 update lock_sheet function to allow formatting cols/rows", "authorizedUsers": [ "org-emee_1" ], From 3269d714a149f26fd5dffb56fc2a1ef6a0662026 Mon Sep 17 00:00:00 2001 From: wintun12 Date: Wed, 20 Mar 2024 12:35:16 +0000 Subject: [PATCH 3/6] make capital letter --- dxapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dxapp.json b/dxapp.json index c4c7d377..5ed48f89 100644 --- a/dxapp.json +++ b/dxapp.json @@ -4,7 +4,7 @@ "summary": "Create Excel workbook from VEP annotated vcf", "dxapi": "1.0.0", "version": "2.8.1", - "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500; * v2.8.1 update lock_sheet function to allow formatting cols/rows", + "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500; * v2.8.1 Update lock_sheet function to allow formatting cols/rows", "authorizedUsers": [ "org-emee_1" ], From f842e8f45d47a7e5b3f25187c6284a0a26eeb212 Mon Sep 17 00:00:00 2001 From: wintun12 Date: Tue, 2 Apr 2024 14:58:11 +0100 Subject: [PATCH 4/6] update summary page --- .../dnanexus/generate_workbook/utils/excel.py | 106 +++++++++++------- 1 file changed, 63 insertions(+), 43 deletions(-) diff --git a/resources/home/dnanexus/generate_workbook/utils/excel.py b/resources/home/dnanexus/generate_workbook/utils/excel.py index 7540bf0c..0f179725 100644 --- a/resources/home/dnanexus/generate_workbook/utils/excel.py +++ b/resources/home/dnanexus/generate_workbook/utils/excel.py @@ -394,7 +394,7 @@ def dias_summary(self) -> None: self.summary.cell(1, 1).value = "Sample ID:" self.summary.cell(1, 5).value = "Clinical Indication(s):" self.summary.cell(2, 5).value = "Panel(s):" - self.summary.cell(33, 1).value = "Total records:" + self.summary.cell(38, 1).value = "Total records:" # get sample name from vcf, should only be one but handle everything # list-wise just in case @@ -418,7 +418,7 @@ def dias_summary(self) -> None: json.dump(details_dict, details_json) # write total rows in each sheet - count = 33 + count = 38 # cells to make bold to_bold = [] @@ -480,29 +480,36 @@ def dias_summary(self) -> None: # write center reporting section tables - self.summary.cell(2, 1).value = "Lab no." + self.summary.cell(2, 1).value = "Lab number" self.summary.cell(2, 3).value = "First name" self.summary.cell(2, 4).value = "Last name" self.summary.cell(4, 1).value = "Number checked" self.summary.cell(5, 1).value = "Summary coverage" self.summary.cell(14, 2).value = "Phenotype:" - self.summary.cell(21, 2).value = "Panels" - self.summary.cell(21, 3).value = "Excel file" - self.summary.cell(21, 4).value = "Comments" - self.summary.cell(21, 6).value = "Analysis by" + self.summary.cell(21, 2).value = "Result" + self.summary.cell(21, 4).value = "Analysis by" + self.summary.cell(21, 5).value = "Date" + self.summary.cell(21, 6).value = "Checked by" self.summary.cell(21, 7).value = "Date" - self.summary.cell(21, 8).value = "Checked by" - self.summary.cell(21, 9).value = "Date" self.summary.cell(26, 2).value = "Sanger sequencing confirmation" - self.summary.cell(27, 2).value = "Gene" - self.summary.cell(27, 3).value = "NM_#" - self.summary.cell(27, 4).value = "Coordinate" - self.summary.cell(27, 5).value = "cDNA" - self.summary.cell(27, 6).value = "Protein change" - self.summary.cell(27, 7).value = "WS#" - self.summary.cell(27, 8).value = "Confirmed (Y/N)" + self.summary.cell(27, 2).value = "CHROM" + self.summary.cell(27, 3).value = "POS" + self.summary.cell(27, 4).value = "SYMBOL" + self.summary.cell(27, 5).value = "HGVSc" + self.summary.cell(27, 6).value = "HGVSp" + self.summary.cell(27, 7).value = "Worksheet" + self.summary.cell(27, 8).value = "Confirmed Y/N" + + self.summary.cell(31, 2).value = "MLPA confirmation" + self.summary.cell(32, 2).value = "CHROM" + self.summary.cell(32, 3).value = "POS" + self.summary.cell(32, 4).value = "END" + self.summary.cell(32, 5).value = "SYMBOL" + self.summary.cell(32, 6).value = "VARIANT CLASS" + self.summary.cell(32, 7).value = "Worksheet" + self.summary.cell(32, 8).value = "Confirmed Y/N" # merge some title columns that have longer text self.summary.merge_cells( @@ -512,24 +519,34 @@ def dias_summary(self) -> None: self.summary.merge_cells( start_row=2, end_row=2, start_column=6, end_column=20) self.summary.merge_cells( - start_row=14, end_row=14, start_column=2, end_column=5) + start_row=14, end_row=14, start_column=2, end_column=3) + self.summary.merge_cells( + start_row=15, end_row=18, start_column=2, end_column=3) self.summary.merge_cells( start_row=26, end_row=26, start_column=2, end_column=8) self.summary.merge_cells( - start_row=21, end_row=21, start_column=4, end_column=5) + start_row=21, end_row=21, start_column=2, end_column=3) + self.summary.merge_cells( + start_row=22, end_row=22, start_column=2, end_column=3) + self.summary.merge_cells( + start_row=23, end_row=23, start_column=2, end_column=3) self.summary.merge_cells( start_row=5, end_row=11, start_column=1, end_column=1) - + self.summary.merge_cells( + start_row=31, end_row=31, start_column=2, end_column=8) + # make the coverage tile centre of merged rows self.summary["A5"].alignment = Alignment( wrapText=True, vertical="center") + self.summary["B15"].alignment = Alignment( + wrapText=True, vertical="center") # titles to set to bold to_bold += [ - "A1", "A2", "A4", "A5", "A33", "B1", "B14", "B21", "B26", - "B27", "B33", "B34", "C2", "C21", "C27", "D2", "D21", "D27", - "E1", "E2", "E27", "F21", "F27", "G21", "G27", "H21", "H27", - "I21" + "A1", "A2", "A4", "A5", "A38", "B1", "B14", "B21", "B26", + "B27", "B31", "B32", "B38", "B39", "C2", "C27", "C32", + "D2", "D21", "D27", "D32", "E1", "E2", "E21", "E27", + "E32", "F21", "F27", "F32", "G21", "G27", "G32", "H27", "H32" ] for cell in to_bold: @@ -538,29 +555,32 @@ def dias_summary(self) -> None: # set column widths for readability self.summary.column_dimensions['A'].width = 22 if self.args.colour else 18 self.summary.column_dimensions['B'].width = 13 - self.summary.column_dimensions['C'].width = 13 - self.summary.column_dimensions['D'].width = 13 + self.summary.column_dimensions['C'].width = 22 + self.summary.column_dimensions['D'].width = 22 self.summary.column_dimensions['E'].width = 22 - self.summary.column_dimensions['F'].width = 16 - self.summary.column_dimensions['G'].width = 16 - self.summary.column_dimensions['H'].width = 16 + self.summary.column_dimensions['F'].width = 22 + self.summary.column_dimensions['G'].width = 22 + self.summary.column_dimensions['H'].width = 22 # colour title cells blueFill = PatternFill(patternType="solid", start_color="0CABA8") colour_cells = [ - "A2", "A4", "A5", "B2", "B14", "B21", "B26", "B27", - "C2", "C21", "C27", "D2", "D21", "D27", "E27", "F21", - "F27", "G21", "G27", "H21", "H27", "I21" + "A2", "A4", "A5", "B14", "B21", "B26", "B27", "B31", + "B32", "C2", "C21", "C27", "C32", "D2", "D21", "D27", "D32", + "E21", "E27", "E32", "F21", "F27", "F32", "G21", "G27", "G32", + "H27", "H32" ] for cell in colour_cells: self.summary[cell].fill = blueFill # set borders around table areas row_ranges = [ - 'A2:D2', 'A3:D3', 'A4:D4', 'A5:A5', 'B14:E14', 'B15:E15', - 'B16:E16', 'B17:E17', 'B18:E18', 'B21:I21', 'B22:I22', - 'B23:I23', 'B26:H26', 'B27:H27', 'B28:H28', 'B29:H29', 'B30:H30' + 'A2:A2', 'A4:A4', 'C2:D2', 'C3:D3', 'A5:A5', 'B14:C14', + 'B15:C15', 'B16:C16', 'B17:C17', 'B18:C18', 'B21:G21', + 'B22:G22', 'B23:G23', 'B26:H26', 'B27:H27', 'B28:H28', + 'B29:H29', 'B31:H31', 'B32:H32', 'B33:H33', 'B34:H34', + 'B35:H35' ] for row in row_ranges: for cells in self.summary[row]: @@ -570,15 +590,15 @@ def dias_summary(self) -> None: cell_to_unlock = ["A3", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "B10", "B11", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10", "C11", "D3", "D4", "D5", "D6", "D7", - "D8", "D9", "D10", "D11", "B15", "C15", "D15", - "E15", "B16", "C16", "D16", "E16", "B17", "C17", - "D17", "E17", "B18", "C18", "D18", "E18", "B22", - "C22", "D22", "E22", "F22", "G22", "H22", "I22", - "B23", "C23", "D23", "E23", "F23", "G23", "H23", - "I23", "B28", "C28", "D28", "E28", "F28", "G28", - "H28", "B29", "C29", "D29", "E29", "F29", "G29", - "H29", "B30", "C30", "D30", "E30", "F30", "G30", - "H30" + "D8", "D9", "D10", "D11", "B15", "C15", "B16", + "C16", "B17", "C17", "B18", "C18", "B22", + "C22", "D22", "E22", "F22", "G22", "B23", "C23", + "D23", "E23", "F23", "G23", "B28", "C28", "D28", + "E28", "F28", "G28", "H28", "B29", "C29", "D29", + "E29", "F29", "G29", "H29", "B33", "C33", "D33", + "E33", "F33", "G33", "H33", "B34", "C34", "D34", + "E34", "F34", "G34", "H34", "B35", "C35", "D35", + "E35", "F35", "G35", "H35" ] self.lock_sheet(ws=self.summary, cell_to_unlock=cell_to_unlock, From 668b6d008bcc9613e52837cadcb2b81323ed51da Mon Sep 17 00:00:00 2001 From: wintun12 Date: Wed, 3 Apr 2024 08:59:24 +0100 Subject: [PATCH 5/6] update start col for unlock --- resources/home/dnanexus/generate_workbook/utils/excel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/home/dnanexus/generate_workbook/utils/excel.py b/resources/home/dnanexus/generate_workbook/utils/excel.py index 0f179725..f9f95cff 100644 --- a/resources/home/dnanexus/generate_workbook/utils/excel.py +++ b/resources/home/dnanexus/generate_workbook/utils/excel.py @@ -603,7 +603,7 @@ def dias_summary(self) -> None: self.lock_sheet(ws=self.summary, cell_to_unlock=cell_to_unlock, start_row=self.summary.max_row+1, - start_col=10, + start_col=9, unlock_row_num=ROW_TO_UNLOCK, unlock_col_num=COL_TO_UNLOCK) From 501feb32508c62c81b0758651b3a500083b26134 Mon Sep 17 00:00:00 2001 From: wintun12 Date: Wed, 3 Apr 2024 11:30:02 +0100 Subject: [PATCH 6/6] increase version --- dxapp.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dxapp.json b/dxapp.json index 5ed48f89..617c9a5b 100644 --- a/dxapp.json +++ b/dxapp.json @@ -3,8 +3,8 @@ "title": "eggd_generate_variant_workbook", "summary": "Create Excel workbook from VEP annotated vcf", "dxapi": "1.0.0", - "version": "2.8.1", - "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500; * v2.8.1 Update lock_sheet function to allow formatting cols/rows", + "version": "2.8.2", + "whatsNew": "* v2.0.0 Rewrite of previous app to generate xlsx file from a VEP annotated VCF(s); * v2.0.1 Bug fix to correctly treat CHROM as string values; * v2.0.2 Bug fix for ACMG report template structure; * v2.0.3 Bug fixes for issues with hyperlinks, changed app name to eggd_generate_variant_workbook; * v2.1.0 Handle VCFs from GATK gCNV and Illumina TSO500, readability tweaks to variant sheets; * v2.1.1 Bug fix for typing of numeric values in hyperlinks; * v2.2.0 Added ability to pass in non VCF files (tsvs/csvs and images) to additional sheets, optional adding of links to DECIPHER with --decipher; * v2.3.0 Added conditional colouring of cells in variant sheets, new 'basic' summary sheet; * v2.4.0 Added handling for duplicate annotation in VEP fields (i.e. cosmic, CGC, etc..); * v2.5.0 Better parsing of CombinedVariantOutput files as additional files; * v2.6.0 Add variant counts as DNAnexus file details to the .xlsx workbook; *v2.7.0 Handle pre-split and non VEP annotated VCFs, improvements to Dias reporting templates and Excel data validation; * v2.7.1 v.2.7.0 app was accidentally published on DNAnexus before testing; so a new version is created. Everything except version number is the same as v2.7.0; * v2.8.0 Add PID box in summary, swap BS1 and BA1 in interpret table, increase the number of unlocked rows to 500; * v2.8.1 Update lock_sheet function to allow formatting cols/rows; * v2.8.2 Update summary sheet titles and tables", "authorizedUsers": [ "org-emee_1" ],