From 4a5d4fd98eb34c3583974a24fd145d8cc5b18ba5 Mon Sep 17 00:00:00 2001 From: Peter van 't Hof Date: Thu, 30 Apr 2015 13:30:25 +0200 Subject: [PATCH] Added plots for front page of report --- .../pipelines/bammetrics/alignmentSummary.ssp | 21 +++- .../bammetrics/BammetricsReport.scala | 58 +++++++++- .../RscriptCommandLineFunction.scala | 9 +- .../flexiprep/flexiprepBaseSummary.ssp | 22 +++- .../flexiprep/flexiprepReadSummary.ssp | 23 +++- .../pipelines/flexiprep/FlexiprepReport.scala | 88 ++++++++++++++ .../biopet/pipelines/shiva/sampleVariants.ssp | 14 ++- .../biopet/pipelines/shiva/ShivaReport.scala | 109 ++++++++++++++---- 8 files changed, 315 insertions(+), 29 deletions(-) diff --git a/public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp b/public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp index 16617095a..0da3d3784 100644 --- a/public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp +++ b/public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp @@ -1,16 +1,30 @@ #import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.core.report.ReportPage) +#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport) +#import(java.io.File) <%@ var summary: Summary %> <%@ var sampleId: Option[String] = None %> <%@ var libId: Option[String] = None %> <%@ var sampleLevel: Boolean = false %> <%@ var rootPath: String %> +<%@ var outputDir: File %> +<%@ var showPlot: Boolean = false %> +<%@ var showTable: Boolean = true %> #{ val samples = sampleId match { - case Some(sample) => List(sample.toString) - case _ => summary.samples.toList + case Some(sample) => { + List(sample.toString) + } + case _ => summary.samples.toList } }# + +#if (showPlot) +#{ BammetricsReport.alignmentSummaryPlot(outputDir, "alignmentSummary", summary, !sampleLevel, sampleId = sampleId) }# +
+ Tsv file +#end +#if (showTable) @@ -52,4 +66,5 @@ #end #end -
Sample
\ No newline at end of file + +#end \ No newline at end of file diff --git a/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala b/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala index 135ee3731..35b5d4a23 100644 --- a/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala +++ b/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala @@ -1,11 +1,17 @@ package nl.lumc.sasc.biopet.pipelines.bammetrics +import java.io.{PrintWriter, File} + import nl.lumc.sasc.biopet.core.report.{ ReportBuilder, ReportPage, ReportSection } +import nl.lumc.sasc.biopet.core.summary.{SummaryValue, Summary} +import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot /** * Created by pjvan_thof on 3/30/15. */ object BammetricsReport extends ReportBuilder { + // FIXME: Not yet finished + val reportName = "Bam Metrics" def indexPage = ReportPage(Map( @@ -29,5 +35,55 @@ object BammetricsReport extends ReportBuilder { Map() ) - // FIXME: Not yet finished + def alignmentSummaryPlot(outputDir: File, + prefix: String, + summary: Summary, + libraryLevel: Boolean = false, + sampleId: Option[String] = None): Unit = { + val tsvFile = new File(outputDir, prefix + ".tsv") + val pngFile = new File(outputDir, prefix + ".png") + val tsvWriter = new PrintWriter(tsvFile) + if (libraryLevel) tsvWriter.print("Library") else tsvWriter.print("Sample") + tsvWriter.println("\tMapped\tDuplicates\tUnmapped\tSecondary") + + def getLine(summary: Summary, sample: String, lib: Option[String] = None): String = { + val mapped = new SummaryValue(List("bammetrics", "stats", "biopet_flagstat", "Mapped"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val duplicates = new SummaryValue(List("bammetrics", "stats", "biopet_flagstat", "Duplicates"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val total = new SummaryValue(List("bammetrics", "stats", "biopet_flagstat", "All"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val secondary = new SummaryValue(List("bammetrics", "stats", "biopet_flagstat", "NotPrimaryAlignment"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val sb = new StringBuffer() + if (lib.isDefined) sb.append(sample + "-" + lib.get + "\t") else sb.append(sample + "\t") + sb.append((mapped - duplicates) + "\t") + sb.append(duplicates + "\t") + sb.append((total - mapped - secondary) + "\t") + sb.append(secondary) + sb.toString + } + + if (libraryLevel) { + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get); + lib <- summary.libraries(sample)) { + tsvWriter.println(getLine(summary, sample, Some(lib))) + } + } else { + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get)) { + tsvWriter.println(getLine(summary, sample)) + } + } + + tsvWriter.close() + + val plot = new StackedBarPlot(null) + plot.input = tsvFile + plot.output = pngFile + plot.ylabel = Some("Reads") + plot.width = Some(750) + plot.runLocal() + } + + } diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala index e25f02688..d5da78b76 100644 --- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala +++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala @@ -64,7 +64,14 @@ trait RscriptCommandLineFunction extends BiopetCommandLineFunction { def runLocal(logger: ProcessLogger): Unit = { checkScript(local = true) - Process(cmdLine).run(logger) + this.logger.info(cmdLine) + + val cmd = cmdLine.stripPrefix(" '").stripSuffix("' ").split("' *'") + + this.logger.info(cmd.mkString(" ")) + + val process = Process(cmd.toSeq).run(logger) + this.logger.info(process.exitValue()) } /** diff --git a/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp b/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp index 25443df88..13095b877 100644 --- a/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp +++ b/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp @@ -1,15 +1,34 @@ #import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.core.report.ReportPage) +#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport) +#import(java.io.File) <%@ var summary: Summary %> <%@ var sampleId: Option[String] = None %> <%@ var libId: Option[String] = None %> <%@ var rootPath: String %> +<%@ var outputDir: File %> +<%@ var showPlot: Boolean = false %> +<%@ var showTable: Boolean = true %> #{ val samples = sampleId match { case Some(sample) => List(sample.toString) case _ => summary.samples.toList } }# +#if (showPlot) + #{ + FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R1","R1", summary, sampleId = sampleId) + FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R2","R2", summary, sampleId = sampleId) + }# + + + + + + +
R1R2

Tsv file

Tsv file
+#end +#if (showTable) @@ -54,4 +73,5 @@ #end #end -
Sample
\ No newline at end of file + +#end \ No newline at end of file diff --git a/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp b/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp index 2438c00e5..af5c26290 100644 --- a/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp +++ b/public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp @@ -1,15 +1,35 @@ #import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.core.report.ReportPage) +#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport) +#import(java.io.File) <%@ var summary: Summary %> <%@ var sampleId: Option[String] = None %> <%@ var libId: Option[String] = None %> <%@ var rootPath: String %> +<%@ var outputDir: File %> +<%@ var showPlot: Boolean = false %> +<%@ var showTable: Boolean = true %> #{ val samples = sampleId match { case Some(sample) => List(sample.toString) case _ => summary.samples.toList } }# + +#if (showPlot) + #{ + FlexiprepReport.readSummaryPlot(outputDir, "QC_Reads_R1","R1", summary, sampleId = sampleId) + FlexiprepReport.readSummaryPlot(outputDir, "QC_Reads_R2","R2", summary, sampleId = sampleId) + }# + + + + + + +
R1R2

Tsv file

Tsv file
+#end +#if (showTable) @@ -56,4 +76,5 @@ #end #end -
Sample
\ No newline at end of file + +#end \ No newline at end of file diff --git a/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala b/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala index 8bdf90523..bf4276b02 100644 --- a/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala +++ b/public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala @@ -1,6 +1,10 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep +import java.io.{PrintWriter, File} + import nl.lumc.sasc.biopet.core.report.{ ReportSection, ReportPage, ReportBuilder } +import nl.lumc.sasc.biopet.core.summary.{SummaryValue, Summary} +import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot /** * Created by pjvan_thof on 3/30/15. @@ -38,4 +42,88 @@ object FlexiprepReport extends ReportBuilder { } // FIXME: Not yet finished + + def readSummaryPlot(outputDir: File, + prefix: String, + read: String, + summary: Summary, + sampleId: Option[String] = None): Unit = { + val tsvFile = new File(outputDir, prefix + ".tsv") + val pngFile = new File(outputDir, prefix + ".png") + val tsvWriter = new PrintWriter(tsvFile) + tsvWriter.println("Library\tAfter_QC\tClipping\tTrimming\tSynced") + + def getLine(summary: Summary, sample: String, lib: String): String = { + val beforeTotal = new SummaryValue(List("flexiprep", "stats", "seqstat_" + read, "reads", "num_total"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + val afterTotal = new SummaryValue(List("flexiprep", "stats", "seqstat_" + read + "_after", "reads", "num_total"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + val clippingDiscardedToShort = new SummaryValue(List("flexiprep", "stats", "clipping_" + read, "num_reads_discarded_too_short"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + val clippingDiscardedToLong = new SummaryValue(List("flexiprep", "stats", "clipping_" + read, "num_reads_discarded_too_long"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + val trimmingDiscarded = new SummaryValue(List("flexiprep", "stats", "trimming", "num_reads_discarded_" + read), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + + val sb = new StringBuffer() + sb.append(sample + "-" + lib + "\t") + sb.append(afterTotal + "\t") + sb.append((clippingDiscardedToShort + clippingDiscardedToLong) + "\t") + sb.append(trimmingDiscarded + "\t") + sb.append(beforeTotal - afterTotal - trimmingDiscarded - clippingDiscardedToShort - clippingDiscardedToLong) + sb.toString + } + + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get); + lib <- summary.libraries(sample)) { + tsvWriter.println(getLine(summary, sample, lib)) + } + + tsvWriter.close() + + val plot = new StackedBarPlot(null) + plot.input = tsvFile + plot.output = pngFile + plot.ylabel = Some("Reads") + plot.width = Some(750) + plot.runLocal() + } + + def baseSummaryPlot(outputDir: File, + prefix: String, + read: String, + summary: Summary, + sampleId: Option[String] = None): Unit = { + val tsvFile = new File(outputDir, prefix + ".tsv") + val pngFile = new File(outputDir, prefix + ".png") + val tsvWriter = new PrintWriter(tsvFile) + tsvWriter.println("Library\tAfter_QC\tDiscarded") + + def getLine(summary: Summary, sample: String, lib: String): String = { + val beforeTotal = new SummaryValue(List("flexiprep", "stats", "seqstat_" + read, "bases", "num_total"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + val afterTotal = new SummaryValue(List("flexiprep", "stats", "seqstat_" + read + "_after", "bases", "num_total"), + summary, Some(sample), Some(lib)).value.getOrElse(0).toString.toLong + + val sb = new StringBuffer() + sb.append(sample + "-" + lib + "\t") + sb.append(afterTotal + "\t") + sb.append(beforeTotal - afterTotal) + sb.toString + } + + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get); + lib <- summary.libraries(sample)) { + tsvWriter.println(getLine(summary, sample, lib)) + } + + tsvWriter.close() + + val plot = new StackedBarPlot(null) + plot.input = tsvFile + plot.output = pngFile + plot.ylabel = Some("Bases") + plot.width = Some(750) + plot.runLocal() + } } diff --git a/public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp b/public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp index d03036b8a..62e06a658 100644 --- a/public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp +++ b/public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp @@ -1,8 +1,13 @@ #import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.core.report.ReportPage) +#import(nl.lumc.sasc.biopet.pipelines.shiva.ShivaReport) +#import(java.io.File) <%@ var summary: Summary %> <%@ var sampleId: Option[String] = None %> <%@ var rootPath: String %> +<%@ var outputDir: File %> +<%@ var showPlot: Boolean = false %> +<%@ var showTable: Boolean = true %> #{ val fields = List("Hom", "HomVar", "HomRef", "NoCall", "Variant", "NonInformative", "Total") val samples = sampleId match { @@ -11,6 +16,12 @@ } }# +#if (showPlot) + #{ ShivaReport.variantSummaryPlot(outputDir, "variantSummary", summary, sampleId = sampleId) }# +
+ Tsv file +#end +#if (showTable) #for (field <- fields) #end @@ -24,4 +35,5 @@ #end -
Sample${field}
\ No newline at end of file + +#end \ No newline at end of file diff --git a/public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala b/public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala index deb195f45..546c36f50 100644 --- a/public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala +++ b/public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala @@ -1,6 +1,10 @@ package nl.lumc.sasc.biopet.pipelines.shiva +import java.io.{PrintWriter, File} + import nl.lumc.sasc.biopet.core.report.{ ReportSection, MultisampleReportBuilder, ReportPage } +import nl.lumc.sasc.biopet.core.summary.{SummaryValue, Summary} +import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot import nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport @@ -8,32 +12,47 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport * Created by pjvan_thof on 3/30/15. */ object ShivaReport extends MultisampleReportBuilder { - def indexPage = ReportPage( - Map( - /*"General" -> ReportPage(Map(), List( - "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"), - "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", Map("sampleLevel" -> true)), - "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), - "QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp") - ), Map()),*/ - "Samples" -> generateSamplesPage(pageArgs) - ), - List( - "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/shivaFront.ssp"), - "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"), - "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", Map("sampleLevel" -> true)), - "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), - "QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp") - ), - pageArgs - ) + + // FIXME: Not yet finished + + def indexPage = { + ReportPage( + Map( + "MultiSample" -> ReportPage(Map(), List( + "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp", + Map("showPlot" -> true, "showTable" -> true)), + "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", + Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> true)), + "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp", + Map("showPlot" -> true, "showTable" -> true)), + "QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp", + Map("showPlot" -> true, "showTable" -> true)) + ), Map()), + "Samples" -> generateSamplesPage(pageArgs) + ), + List( + "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/shivaFront.ssp"), + "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp", + Map("showPlot" -> true, "showTable" -> false)), + "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", + Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false) + ), + "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp", + Map("showPlot" -> true, "showTable" -> false)), + "QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp", + Map("showPlot" -> true, "showTable" -> false)) + ), + pageArgs + ) + } def samplePage(sampleId: String, args: Map[String, Any]) = { ReportPage(Map( "Libraries" -> generateLibraryPage(args), "Alignment" -> BammetricsReport.bamMetricsPage ), List( - "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"), + "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", + if (summary.libraries(sampleId).size > 1) Map("showPlot" -> true) else Map()), "Preprocessing" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", Map("sampleLevel" -> true)), "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"), "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), @@ -54,5 +73,53 @@ object ShivaReport extends MultisampleReportBuilder { def reportName = "Shiva Report" - // FIXME: Not yet finished + def variantSummaryPlot(outputDir: File, + prefix: String, + summary: Summary, + libraryLevel: Boolean = false, + sampleId: Option[String] = None): Unit = { + val tsvFile = new File(outputDir, prefix + ".tsv") + val pngFile = new File(outputDir, prefix + ".png") + val tsvWriter = new PrintWriter(tsvFile) + if (libraryLevel) tsvWriter.print("Library") else tsvWriter.print("Sample") + tsvWriter.println("\tHomVar\tHet\tHomRef\tNoCall") + + def getLine(summary: Summary, sample: String, lib: Option[String] = None): String = { + val homVar = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "HomVar"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val homRef = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "HomRef"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val noCall = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "NoCall"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val het = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "Het"), + summary, Some(sample), lib).value.getOrElse(0).toString.toLong + val sb = new StringBuffer() + if (lib.isDefined) sb.append(sample + "-" + lib.get + "\t") else sb.append(sample + "\t") + sb.append(homVar + "\t") + sb.append(het + "\t") + sb.append(homRef + "\t") + sb.append(noCall) + sb.toString + } + + if (libraryLevel) { + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get); + lib <- summary.libraries(sample)) { + tsvWriter.println(getLine(summary, sample, Some(lib))) + } + } else { + for (sample <- summary.samples if (sampleId.isEmpty || sample == sampleId.get)) { + tsvWriter.println(getLine(summary, sample)) + } + } + + tsvWriter.close() + + val plot = new StackedBarPlot(null) + plot.input = tsvFile + plot.output = pngFile + plot.ylabel = Some("VCF records") + plot.width = Some(750) + plot.runLocal() + } } -- GitLab