Browse Source

flow + chart

Thomas 1 year ago
parent
commit
901c0ff1d4
2 changed files with 124 additions and 13 deletions
  1. BIN
      report.pdf
  2. 124 13
      report.typ

BIN
report.pdf


+ 124 - 13
report.typ

@@ -1,11 +1,20 @@
 #let cr_colors = (
-  dark_grey: rgb("#333333"), beige: rgb("#fdf0d5"), light_grey: rgb("#eeeeee"), dark_red: rgb("#780000"), red: rgb("#c1121f"), blue: rgb("#669bbc"), dark_blue: rgb("#003049"),
+  dark_grey: rgb("#333333"), beige: rgb("#fdf0d5"), light_grey: rgb("#eeeeee"), dark_red: rgb("#780000"), red: rgb("#c1121f"), blue: rgb("#669bbc"), dark_blue: rgb("#003049"), green: rgb("#29bf12"),
 )
 
+#import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge
 #import "@local/svg-emoji:0.1.0": setup-emoji, noto, github
+#import "@preview/metro:0.3.0": *
+#import "@preview/cetz:0.2.2"
+
 #show: setup-emoji.with(font: noto)
 
-#set page(paper: "a4", fill: cr_colors.light_grey)
+#set page(paper: "a4", fill: cr_colors.light_grey, footer: locate(loc => [
+  #set text(10pt)
+  #if loc.page() != 1 {
+    align(right, counter(page).display("1 / 1", both: true))
+  }
+]))
 
 #show heading.where(level: 1): it => [
   #set align(center)
@@ -160,22 +169,97 @@
   diag.insert(0, "diag")
   mrd.insert(0, "mrd")
   let arrays1 = (c.slice(0, index), diag.slice(0, index), mrd.slice(0, index))
-  table(columns: arrays1.at(0).len(), ..arrays1.map(arr => arr.map(item => [#item])).flatten())
+  table(
+    columns: arrays1.at(0).len(), ..arrays1.map(arr => arr.map(item => [#item])).flatten(),
+  )
 
   let arrays2 = (c.slice(index), diag.slice(index), mrd.slice(index))
   arrays2.at(0).insert(0, "")
   arrays2.at(1).insert(0, "diag")
   arrays2.at(2).insert(0, "mrd")
 
-  table(columns: arrays2.at(0).len(),  ..arrays2.map(arr => arr.map(item => [#item])).flatten())
+  table(
+    columns: arrays2.at(0).len(), ..arrays2.map(arr => arr.map(item => [#item])).flatten(),
+  )
 }
-#set heading(numbering: "1.")
-#heading(level: 1, outlined: false)[Compte Rendu]
 
-#outline(
-  title: "Table of Contents",
-  depth: 3
-)
+#let variantsFlow(path) = {
+  import fletcher.shapes: diamond, parallelogram, chevron
+  let data = json(path)
+  diagram(
+    spacing: (1pt, 60pt), node-fill: gradient.radial(cr_colors.light_grey, cr_colors.blue, radius: 300%), node-stroke: cr_colors.dark_blue + 1pt, edge-stroke: 1pt, node-inset: 14pt, node(
+      (0.2, 0), [Variants MRD: #num(data.vcf_stats.n_tumoral_init)], corner-radius: 2pt, extrude: (0, 3), name: <input_mrd>,
+    ), node(
+      (1.8, 0), [Variants Diag: #num(data.vcf_stats.n_constit_init)], corner-radius: 2pt, extrude: (0, 3), name: <input_diag>,
+    ), node(
+      (1, 1), align(center)[Variant in MRD ?], shape: diamond, name: <is_in_mrd>,
+    ), edge(<input_mrd>, "s", <is_in_mrd>, "-|>"), edge(<input_diag>, "s", <is_in_mrd>, "-|>"), edge(<is_in_mrd>, <is_low_mrd>, "-|>", [Yes], label-pos: 0.8), node(
+      (0.25, 2), [MRD variant depth \ < 4 ?], shape: diamond, name: <is_low_mrd>,
+    ), edge(<is_low_mrd>, <low_mrd>, "-|>"), node(
+      (0, 3), [Low MRD depth: #num(data.vcf_stats.n_low_mrd_depth)], shape: parallelogram, name: <low_mrd>,
+    ), edge(<is_in_mrd>, <next>, "-|>", [No], label-pos: 0.8), node(
+      (1.85, 2), [To BAM filter: #num(data.bam_stats.n_lasting)], shape: chevron, extrude: (-3, 0), name: <next>, stroke: cr_colors.green,
+    ), edge(<is_low_mrd>, <homo>, "-|>"), node((1.5, 3), [VAF = 100% ?], shape: diamond, name: <homo>), edge(<homo>, <constit>, "-|>", [Yes], label-pos: 0.5, bend: -80deg), edge(<homo>, <chi>, "-|>", [No], label-pos: 0.6), node(
+      (1.5, 4), [$#sym.chi^2$ VAF MRD vs Diag ?], shape: diamond, name: <chi>,
+    ), edge(<chi>, <constit>, "-|>", label-pos: 0.8), node(
+      (1, 5), [Constit: #num(data.vcf_stats.n_constit)], shape: parallelogram, name: <constit>,
+    ), edge(<chi>, <loh>, "-|>", [p < 0.01], label-pos: 0.8), node(
+      (2, 5), [LOH: #num(data.vcf_stats.n_loh)], shape: parallelogram, name: <loh>,
+    ),
+  )
+}
+
+#let bamFilter(path) = {
+  import fletcher.shapes: diamond, parallelogram, hexagon
+  let data = json(path)
+  diagram(
+    spacing: (1pt, 60pt), node-fill: gradient.radial(cr_colors.light_grey, cr_colors.blue, radius: 300%), node-inset: 14pt, node-stroke: cr_colors.dark_blue + 1pt, edge-stroke: 1pt, node(
+      (0.75, 0), [Variants not in MRD VCF: #num(data.bam_stats.n_lasting)], corner-radius: 2pt, extrude: (0, 3), name: <input_mrd>,
+    ), edge(<input_mrd>, <depth>, "-|>"), node((0.75, 1), [MRD alignement depth ?], shape: diamond, name: <depth>), edge(<depth>, <low_depth>, "-|>", [< 4]), node(
+      (0, 2), [Low MRD depth: #num(data.bam_stats.n_low_mrd_depth)], shape: parallelogram, name: <low_depth>,
+    ), edge(<depth>, <seen>, "-|>"), node(
+      (0.75, 3), [Alt. base seen in MRD pileup ?], shape: diamond, name: <seen>,
+    ), edge(<seen>, <constit>, "-|>", [Yes]), node(
+      (0, 4), [Constit: #num(data.bam_stats.n_constit)], shape: parallelogram, name: <constit>,
+    ), edge(<seen>, <is_div>, "-|>", [No]), node(
+      (1.1, 4), [Sequence #sym.plus.minus 20nt \ diversity ?], shape: diamond, name: <is_div>,
+    ), edge(<is_div>, <low_div>, "-|>", [entropy < 1.8]), node(
+      (0.25, 5), [Low diversity, artefact: #num(data.bam_stats.n_low_diversity)], shape: parallelogram, name: <low_div>,
+    ), edge(<is_div>, <somatic>, "-|>"), node(
+      (1.75, 5), [Somatic: #num(data.bam_stats.n_somatic)], shape: hexagon, extrude: (-3, 0), name: <somatic>, stroke: cr_colors.green,
+    ),
+  )
+}
+
+#let barCallers(path) = {
+  import cetz.draw: *
+  import cetz.chart
+  
+  let json_data = json(path).variants_stats
+  let data = json_data.find(item => item.name == "callers_cat")
+  let chart_data = data.counts.pairs().sorted(key: x => -x.at(1))
+  let max_value = chart_data.first().at(1)
+
+  cetz.canvas(
+    length: 80%,
+    {
+      set-style(axes: (bottom: (tick: (label: (angle: 45deg, anchor: "north-east")))))
+      chart.columnchart(
+        chart_data,
+        size: (1, 1),
+      )
+  })
+}
+
+#set heading(numbering: (..numbers) => {
+  if numbers.pos().len() >= 2 and numbers.pos().len() <= 3 {
+    numbering("1.1", ..numbers.pos().slice(1))
+  }
+})
+
+#heading(level: 1, outlined: false)[Whole Genome Sequencing Report]
+
+#outline(title: "Table of Contents", depth: 3)
 #pagebreak()
 == Identity
 Camara
@@ -183,13 +267,13 @@ Camara
 == Alignement
 #grid(
   columns: (1fr, 1fr), gutter: 3pt, [
-    === Diagnostic sample
+    ==== Diagnostic sample
     #set text(size: 11pt)
     #reportBam(
       "/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_diag_hs1_info.json",
     )
   ], [
-    === MRD sample
+    ==== MRD sample
     #set text(size: 11pt)
     #reportBam(
       "/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_mrd_hs1_info.json",
@@ -204,7 +288,9 @@ Camara
 === Normalized read count by chromosome
 #[
   #set text(size: 10pt)
-  #printReadCount("/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_diag_hs1_info.json", "/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_mrd_hs1_info.json")
+  #printReadCount(
+    "/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_diag_hs1_info.json", "/Turbine-pool/LongReads/report/BECERRA/report/data/BECERRA_mrd_hs1_info.json",
+  )
 ]
 
 === Coverage by chromosome
@@ -214,7 +300,32 @@ Camara
 #footnote[Values computed by Pandora development version]
 #pagebreak()
 
+== Variants
+=== Variants calling
+==== VCF filters
+#pad(
+  left: -0.8cm, top: 0.8cm, variantsFlow(
+    "/Turbine-pool/LongReads/report/BECERRA/report/data/CAMARA_variants_stats.json",
+  ),
+)
 
+==== BAM filters
+#pad(
+  top: 0.8cm, bamFilter(
+    "/Turbine-pool/LongReads/report/BECERRA/report/data/CAMARA_variants_stats.json",
+  ),
+)
+#pagebreak()
+
+=== Somatic variants
+#barCallers("/Turbine-pool/LongReads/report/BECERRA/report/data/CAMARA_variants_stats.json")
+
+=== Selected Variants
+
+
+#pagebreak()
+== Conclusion
+hello ???
 #lorem(150)
 #emoji.rocket