Commit c7b0392c authored by Peter van 't Hof's avatar Peter van 't Hof

Fix plots for library level

parent 2d950663
......@@ -42,7 +42,7 @@
#end
#if (showPlot)
#{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId) }#
#{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId, libId = libId) }#
<div class="panel-body">
<img src="insertsize.png" class="img-responsive" />
......
......@@ -36,7 +36,7 @@
#end
#if (showPlot)
#{ BammetricsReport.wgsHistogramPlot(outputDir, "wgs", summary, !sampleLevel, sampleId = sampleId) }#
#{ BammetricsReport.wgsHistogramPlot(outputDir, "wgs", summary, !sampleLevel, sampleId = sampleId, libId = libId) }#
<div class="panel-body">
<img src="wgs.png" class="img-responsive" />
......
......@@ -156,14 +156,15 @@ object BammetricsReport extends ReportBuilder {
prefix: String,
summary: Summary,
libraryLevel: Boolean = false,
sampleId: Option[String] = None): Unit = {
sampleId: Option[String] = None,
libId: 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.println((for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) yield s"$sample-$lib")
.mkString("library\t", "\t", ""))
} else {
......@@ -198,7 +199,7 @@ object BammetricsReport extends ReportBuilder {
if (libraryLevel) {
for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) fill(sample, Some(lib))
} else if (sampleId.isDefined) fill(sampleId.get, None)
else summary.samples.foreach(fill(_, None))
......@@ -208,7 +209,7 @@ object BammetricsReport extends ReportBuilder {
if (libraryLevel) {
for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) tsvWriter.print("\t" + counts.getOrElse(s"$sample-$lib", "0"))
} else {
for (sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample) {
......@@ -243,14 +244,15 @@ object BammetricsReport extends ReportBuilder {
prefix: String,
summary: Summary,
libraryLevel: Boolean = false,
sampleId: Option[String] = None): Unit = {
sampleId: Option[String] = None,
libId: 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.println((for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) yield s"$sample-$lib")
.mkString("library\t", "\t", ""))
} else {
......@@ -285,7 +287,7 @@ object BammetricsReport extends ReportBuilder {
if (libraryLevel) {
for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) fill(sample, Some(lib))
} else if (sampleId.isDefined) fill(sampleId.get, None)
else summary.samples.foreach(fill(_, None))
......@@ -295,8 +297,10 @@ object BammetricsReport extends ReportBuilder {
if (libraryLevel) {
for (
sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample;
lib <- summary.libraries(sample)
) tsvWriter.print("\t" + counts.getOrElse(s"$sample-$lib", "0"))
lib <- summary.libraries(sample) if libId.isEmpty || libId.get == lib
) {
tsvWriter.print("\t" + counts.getOrElse(s"$sample-$lib", "0"))
}
} else {
for (sample <- summary.samples if sampleId.isEmpty || sampleId.get == sample) {
tsvWriter.print("\t" + counts.getOrElse(sample, "0"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment