Skip to content

Commit

Permalink
Merge pull request #190 from eastgenomics/release-2.8.1
Browse files Browse the repository at this point in the history
Merge release 2.8.1 to master (#190)

Co-Authored-By: Jethro Rainford <[email protected]>
Co-Authored-By: mattgarner <[email protected]>
  • Loading branch information
mattgarner and jethror1 authored Apr 4, 2024
2 parents 19ae999 + c5b8b48 commit 2cccf62
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 46 deletions.
4 changes: 2 additions & 2 deletions dxapp.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.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"
],
Expand Down
112 changes: 68 additions & 44 deletions resources/home/dnanexus/generate_workbook/utils/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = []
Expand Down Expand Up @@ -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(
Expand All @@ -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:
Expand All @@ -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]:
Expand All @@ -570,20 +590,20 @@ 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,
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)

Expand Down Expand Up @@ -1640,6 +1660,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:
"""
Expand Down

0 comments on commit 2cccf62

Please sign in to comment.