Skip to content

Commit

Permalink
pWGS formatting fixes (#385)
Browse files Browse the repository at this point in the history
* Formatting fixes

* Summary tweak

* Update checksum

* Extra formatting tweaks

* Adjust padding

* Adjust padding

* Conditional page break

* Syntax fix

* no top margin

* Adjust padding

* no message

* Adjust bottom margin

* checksums update

---------

Co-authored-by: Oumaima Hamza <[email protected]>
  • Loading branch information
OumaimaHamza and Oumaima Hamza authored Apr 26, 2024
1 parent 8157f38 commit d2a94e9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%>

<!-- gene information -->
<hr class="big-white-line" style="width: 100%; ; page-break-before:always;">
<hr class="big-white-line" style="width: 100%; margin-top: 0; padding-top: 0; page-break-before: always;">
${html_builder().section_cells_begin("<h3>Gene<br>Descriptions</h3>", True)}


Expand Down
10 changes: 5 additions & 5 deletions src/lib/djerba/plugins/pwgs/analysis/analysis_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
the number of detected sites in the plasma sample was statistically
compared to the number of detected sites in a healthy control cohort.
The number of SNVs of tumour origin
detected in this plasma sample (detected sites: <strong>${html_builder.k_comma_format(results.get(constants.SITES_DETECTED))}</strong>) was
detected in this plasma sample was
<strong>${results.get(constants.SIGNIFICANCE)} </strong>
than in the control cohort (N=${results.get(constants.COHORT_N)}). Dataset detection cutoff is <strong>${html_builder.k_comma_format(results.get(constants.DATASET_DETECTION_CUTOFF))}</strong>. </p>
than in the control cohort (N=${results.get(constants.COHORT_N)}). </p>
<table class="variants" style="width:100%">
<thead>
<th style=" width:16%">Reads Checked</th>
<th style=" width:16%">Reads Detected</th>
<th style=" width:20%">Detected:Checked Reads (%)</th>
<th style=" width:16%">Mutant Reads Detected</th>
<th style=" width:20%">Mutant/Checked Read Percentage</th>
</thead>
<tbody>
<tr>
<td>${html_builder.k_comma_format(results.get(constants.READS_CHECKED))}</td>
<td>${html_builder.k_comma_format(results.get(constants.READS_DETECTED))}</td>
<td>${results.get(constants.TUMOUR_FRACTION_READS)}</td>
<td>${results.get(constants.TUMOUR_FRACTION_READS)}%</td>
</tr>
</tbody>
</table>
Expand Down
9 changes: 5 additions & 4 deletions src/lib/djerba/plugins/pwgs/analysis/detection.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ get_mrd_stats <- function(results, pval_cutoff){
zscore <- (results$noise[results$label == "THIS SAMPLE"] - mean(results$noise))/ sd(results$noise)
pvalue <- pnorm(zscore,lower.tail=F)
dataset_cutoff <- (qnorm(pval_cutoff,lower.tail = F) * sd(results$noise)) + mean(results$noise[results$label == "CONTROLS"])

mrd_stats <- list(
"zscore" = zscore,
"pvalue" = pvalue,
Expand Down Expand Up @@ -59,6 +59,7 @@ mean_detection <- mrd_stats$mean_detection
sites_checked <- mrd_stats$sites_checked
dataset_cutoff <- mrd_stats$dataset_cutoff


##plot
rep_length = round(log(sites_checked,10),0)
my_breaks <- rep(1:9, rep_length) * (10^rep(0:(rep_length-1), each = 9))
Expand All @@ -73,7 +74,7 @@ my_labels[14] <- "Sites Detected:"

options(bitmapType='cairo')
svg(paste(output_directory,"pWGS.svg",sep="/"), width = 5, height = 1)

ggplot(results[results$label == "CONTROLS",]) +
geom_boxplot(aes(x=0,y=noise,color=label,shape=label),width = 0.05, outlier.shape = NA) +

Expand All @@ -82,9 +83,9 @@ ggplot(results[results$label == "CONTROLS",]) +

annotate( geom="segment", x = -0.1, xend=0.1, y=dataset_cutoff, yend=dataset_cutoff, colour = "gray") +

annotate(geom="text",y = dataset_cutoff,x=0,color="gray30",label="Detection Cutoff", vjust = -4.5, size=2.5) +
annotate(geom="text",y = dataset_cutoff,x=0,color="gray30",label=paste("Detection Cutoff:", round(dataset_cutoff, 2),"reads"), vjust = -4.5, size=2.5) +
annotate(geom="text",y = mean_detection, x=0,color="black",label="Control Cohort", hjust = 0.3, vjust = 3, size=2.5) +
annotate(geom="text",y = results$sites_detected[1],x=0,color="red",label="This Sample", vjust = -2.5,size=2.5) +
annotate(geom="text",y = results$sites_detected[1],x=0,color="red",label=paste("This Sample:",round(results$sites_detected[1]),"reads"), vjust = -2.5,size=2.5) +

annotate(geom="point",y = results$sites_detected[1],x=0,color="red",shape=1, size=5) +
annotate(geom="point",y = results$sites_detected[1],x=0,color="red",shape=20, size=1.5) +
Expand Down
2 changes: 1 addition & 1 deletion src/lib/djerba/plugins/pwgs/summary/summary_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="oneoftwocellmain" >
<h2 >Summary</h2>
</div>
<div class="twooftwocellmain" style="height: 80px; padding: 10px; background-color:rgba(194,194,194,.5); border: 3px solid #65bc45; border-radius: 12px" >
<div class="twooftwocellmain" style="height: 80px; padding: 10px; background-color:rgba(194,194,194,.5); border: 3px solid; border-radius: 12px" >
<hr class="big-line" style="margin-top: -30px;">

<h3 style="margin-top: 45px;">Cell-free DNA tumour burden: ${results.get(constants.CTDNA_DETECTION)}</h3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<br><strong>Candidate SNVs: </strong>the number of single nucleotide variants from the primary tumour that can be used for ctDNA detection.
If the number of candidate SNVs is too low (below 4,000), mutational sampling analysis is unreliable.

<br><strong>Detected-Checked Reads Ratio: </strong>the percentage of reads with primary tumour matches divided by the total checked reads covering candidate sites.
<br><strong>Mutant/Checked Read Percentage: </strong>the percentage of reads with primary tumour matches divided by the total checked reads covering candidate sites.
When ctDNA is detected, it may be an estimate of the fraction of ctDNA in the blood, but if ctDNA is not detected, it is an estimate of sequencing artefact matches.
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<td width="33%">Report drafted by ${results.get(core_constants.AUTHOR)} on ${results.get('extract_date')}</td>
</tr>
<tr>
<td width="33%">Report electronically signed out by ${results.get('clinical_geneticist_name')} (ABMS #${results.get('clinical_geneticist_licence')}) on ${results.get('report_signoff_date')}</td>
<td width="33%" style="padding-bottom: ${'300px' if ASSAY == 'PWGS' else '0'};">Report electronically signed out by ${results.get('clinical_geneticist_name')} (ABMS #${results.get('clinical_geneticist_licence')}) on ${results.get('report_signoff_date')}</td>
</tr>
</table>

Expand All @@ -78,10 +78,10 @@
${html_builder().section_cells_end()}


<hr class="big-line" style="width: 100%; ; page-break-after:always;" >
<hr class="big-line" style="width: 100%; ${'page-break-after: always;' if ASSAY != 'PWGS' else ''}" >
<hr class="header-big-line" style="width:100%; align:right">

<h2>APPENDIX</h2>
<h2 >APPENDIX</h2>

% if ASSAY in ('WGTS','TAR','WGS') and not FAILED:

Expand All @@ -96,7 +96,8 @@ <h2>APPENDIX</h2>
<br/>
<hr class="big-white-line" >

${html_builder().section_cells_begin("<h3>Definitions</h3>",False)}
${html_builder().section_cells_begin("<h3 style='margin-bottom: 0; padding-bottom: 0;'>Definitions</h3>", False)}


% if not FAILED:
% if ASSAY in ['WGTS', 'WGTS40X']:
Expand Down
14 changes: 7 additions & 7 deletions src/lib/djerba/plugins/supplement/body/test/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def testPwgsSupplementary(self):
params = {
self.INI: 'PWGS.supp.ini',
self.JSON: json_location,
self.MD5: '878c2defac8b85e2ca9000fa13479d03'
self.MD5: '8a958cc5924b86cb05a0d8ea94fd34cb'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -34,7 +34,7 @@ def testTarSupplementary(self):
params = {
self.INI: 'TAR.supp.ini',
self.JSON: json_location,
self.MD5: '4ff388fc36cba071715101583eb467af'
self.MD5: 'c0068f1b1d35ccb5272ee0ad466dc7ef'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -44,7 +44,7 @@ def testTarFailSupplementary(self):
params = {
self.INI: 'TAR.FAIL.supp.ini',
self.JSON: json_location,
self.MD5: 'b0b0c44835ff2055316f7df6408b8fa4'
self.MD5: '5826fffc01fed3f879620ba04c9bf722'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -54,7 +54,7 @@ def testWgtsSupplementary(self):
params = {
self.INI: 'WGTS.supp.ini',
self.JSON: json_location,
self.MD5: 'bb7e1ce8b6af9fcd3003be6d8ad5f976'
self.MD5: '125e44dbed16df044a3fd61313888e84'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -64,7 +64,7 @@ def testWgtsFailSupplementary(self):
params = {
self.INI: 'WGTS.FAIL.supp.ini',
self.JSON: json_location,
self.MD5: '56f3eb5c6c662cf67e8a4fb8ea219f09'
self.MD5: 'baf0e752b61c7176eaec06de9611e836'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -74,7 +74,7 @@ def testWgts40XSupplementary(self):
params = {
self.INI: 'WGTS40X.supp.ini',
self.JSON: json_location,
self.MD5: '021ef28363c75a55b69ff9abd6167320'
self.MD5: '00657dd036c9793497156136284541c5'
}
self.run_basic_test(test_source_dir, params)

Expand All @@ -84,7 +84,7 @@ def testWgts40XFailSupplementary(self):
params = {
self.INI: 'WGTS40X.FAIL.supp.ini',
self.JSON: json_location,
self.MD5: '42e54fe6c150806d8d884d2c762957a1'
self.MD5: '5c8e1e269d924e0d4cb3d1492480cbdc'
}
self.run_basic_test(test_source_dir, params)

Expand Down

0 comments on commit d2a94e9

Please sign in to comment.