Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
biopet.biopet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Mirrors
biopet.biopet
Commits
4a5d4fd9
Commit
4a5d4fd9
authored
Apr 30, 2015
by
Peter van 't Hof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added plots for front page of report
parent
0062bfa8
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
315 additions
and
29 deletions
+315
-29
public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp
...umc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp
+18
-3
public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala
...c/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala
+57
-1
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala
...c/sasc/biopet/extensions/RscriptCommandLineFunction.scala
+8
-1
public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp
.../sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp
+21
-1
public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp
.../sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp
+22
-1
public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala
...umc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala
+88
-0
public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp
...es/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp
+13
-1
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala
...ala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala
+88
-21
No files found.
public/bammetrics/src/main/resources/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp
View file @
4a5d4fd9
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var sampleLevel: Boolean = false %>
<%@ var sampleLevel: Boolean = false %>
<%@ var rootPath: String %>
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
#{
#{
val samples = sampleId match {
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case Some(sample) => {
case _ => summary.samples.toList
List(sample.toString)
}
case _ => summary.samples.toList
}
}
}#
}#
#if (showPlot)
#{ BammetricsReport.alignmentSummaryPlot(outputDir, "alignmentSummary", summary, !sampleLevel, sampleId = sampleId) }#
<img src="alignmentSummary.png"><br>
<a href="alignmentSummary.tsv">Tsv file</a>
#end
#if (showTable)
<table>
<table>
<thead><tr>
<thead><tr>
<th>Sample</th>
<th>Sample</th>
...
@@ -52,4 +66,5 @@
...
@@ -52,4 +66,5 @@
#end
#end
#end
#end
</tbody>
</tbody>
</table>
</table>
\ No newline at end of file
#end
\ No newline at end of file
public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala
View file @
4a5d4fd9
package
nl.lumc.sasc.biopet.pipelines.bammetrics
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.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.
* Created by pjvan_thof on 3/30/15.
*/
*/
object
BammetricsReport
extends
ReportBuilder
{
object
BammetricsReport
extends
ReportBuilder
{
// FIXME: Not yet finished
val
reportName
=
"Bam Metrics"
val
reportName
=
"Bam Metrics"
def
indexPage
=
ReportPage
(
Map
(
def
indexPage
=
ReportPage
(
Map
(
...
@@ -29,5 +35,55 @@ object BammetricsReport extends ReportBuilder {
...
@@ -29,5 +35,55 @@ object BammetricsReport extends ReportBuilder {
Map
()
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
()
}
}
}
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/RscriptCommandLineFunction.scala
View file @
4a5d4fd9
...
@@ -64,7 +64,14 @@ trait RscriptCommandLineFunction extends BiopetCommandLineFunction {
...
@@ -64,7 +64,14 @@ trait RscriptCommandLineFunction extends BiopetCommandLineFunction {
def
runLocal
(
logger
:
ProcessLogger
)
:
Unit
=
{
def
runLocal
(
logger
:
ProcessLogger
)
:
Unit
=
{
checkScript
(
local
=
true
)
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
())
}
}
/**
/**
...
...
public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp
View file @
4a5d4fd9
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
#{
#{
val samples = sampleId match {
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case Some(sample) => List(sample.toString)
case _ => summary.samples.toList
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)
}#
<table>
<tr><th>R1</th><th>R2</th></tr>
<tr>
<td><img src="QC_Bases_R1.png"><br><a href="QC_Bases_R1.tsv">Tsv file</a></td>
<td><img src="QC_Bases_R2.png"><br><a href="QC_Bases_R2.tsv">Tsv file</a></td>
</tr>
</table>
#end
#if (showTable)
<table>
<table>
<thead><tr>
<thead><tr>
<th>Sample</th>
<th>Sample</th>
...
@@ -54,4 +73,5 @@
...
@@ -54,4 +73,5 @@
#end
#end
#end
#end
</tbody>
</tbody>
</table>
</table>
\ No newline at end of file
#end
\ No newline at end of file
public/flexiprep/src/main/resources/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp
View file @
4a5d4fd9
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
#{
#{
val samples = sampleId match {
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case Some(sample) => List(sample.toString)
case _ => summary.samples.toList
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)
}#
<table>
<tr><th>R1</th><th>R2</th></tr>
<tr>
<td><img src="QC_Reads_R1.png"><br><a href="QC_Reads_R1.tsv">Tsv file</a></td>
<td><img src="QC_Reads_R2.png"><br><a href="QC_Reads_R2.tsv">Tsv file</a></td>
</tr>
</table>
#end
#if (showTable)
<table>
<table>
<thead><tr>
<thead><tr>
<th>Sample</th>
<th>Sample</th>
...
@@ -56,4 +76,5 @@
...
@@ -56,4 +76,5 @@
#end
#end
#end
#end
</tbody>
</tbody>
</table>
</table>
\ No newline at end of file
#end
\ No newline at end of file
public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala
View file @
4a5d4fd9
package
nl.lumc.sasc.biopet.pipelines.flexiprep
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.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.
* Created by pjvan_thof on 3/30/15.
...
@@ -38,4 +42,88 @@ object FlexiprepReport extends ReportBuilder {
...
@@ -38,4 +42,88 @@ object FlexiprepReport extends ReportBuilder {
}
}
// FIXME: Not yet finished
// 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
()
}
}
}
public/shiva/src/main/resources/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp
View file @
4a5d4fd9
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.shiva.ShivaReport)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var sampleId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ 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 fields = List("Hom", "HomVar", "HomRef", "NoCall", "Variant", "NonInformative", "Total")
val samples = sampleId match {
val samples = sampleId match {
...
@@ -11,6 +16,12 @@
...
@@ -11,6 +16,12 @@
}
}
}#
}#
#if (showPlot)
#{ ShivaReport.variantSummaryPlot(outputDir, "variantSummary", summary, sampleId = sampleId) }#
<img src="variantSummary.png"><br>
<a href="variantSummary.tsv">Tsv file</a>
#end
#if (showTable)
<table>
<table>
<thead><tr><th>Sample</th>
<thead><tr><th>Sample</th>
#for (field <- fields) <th>${field}</th> #end
#for (field <- fields) <th>${field}</th> #end
...
@@ -24,4 +35,5 @@
...
@@ -24,4 +35,5 @@
</tr>
</tr>
#end
#end
</tbody>
</tbody>
</table>
</table>
\ No newline at end of file
#end
\ No newline at end of file
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala
View file @
4a5d4fd9
package
nl.lumc.sasc.biopet.pipelines.shiva
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.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.bammetrics.BammetricsReport
import
nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
import
nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
...
@@ -8,32 +12,47 @@ 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.
* Created by pjvan_thof on 3/30/15.
*/
*/
object
ShivaReport
extends
MultisampleReportBuilder
{
object
ShivaReport
extends
MultisampleReportBuilder
{
def
indexPage
=
ReportPage
(
Map
(
// FIXME: Not yet finished
/*"General" -> ReportPage(Map(), List(
"Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"),
def
indexPage
=
{
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", Map("sampleLevel" -> true)),
ReportPage
(
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
Map
(
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
"MultiSample"
->
ReportPage
(
Map
(),
List
(
), Map()),*/
"Variantcalling"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"
,
"Samples"
->
generateSamplesPage
(
pageArgs
)
Map
(
"showPlot"
->
true
,
"showTable"
->
true
)),
),
"Alignment"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"
,
List
(
Map
(
"sampleLevel"
->
true
,
"showPlot"
->
true
,
"showTable"
->
true
)),
"Report"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/shiva/shivaFront.ssp"
),
"QC reads"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"
,
"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
)),
"QC bases"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp"
,
"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
()),
),
"Samples"
->
generateSamplesPage
(
pageArgs
)
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
])
=
{
def
samplePage
(
sampleId
:
String
,
args
:
Map
[
String
,
Any
])
=
{
ReportPage
(
Map
(
ReportPage
(
Map
(
"Libraries"
->
generateLibraryPage
(
args
),
"Libraries"
->
generateLibraryPage
(
args
),
"Alignment"
->
BammetricsReport
.
bamMetricsPage
"Alignment"
->
BammetricsReport
.
bamMetricsPage
),
List
(
),
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
)),
"Preprocessing"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"
,
Map
(
"sampleLevel"
->
true
)),
"Variantcalling"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"
),
"Variantcalling"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"
),
"QC reads"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"
),
"QC reads"
->
ReportSection
(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"
),
...
@@ -54,5 +73,53 @@ object ShivaReport extends MultisampleReportBuilder {
...
@@ -54,5 +73,53 @@ object ShivaReport extends MultisampleReportBuilder {
def
reportName
=
"Shiva Report"
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"
)