Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
17ac2dce
Commit
17ac2dce
authored
May 13, 2015
by
Peter van 't Hof
Browse files
Adding report to shiva pipeline
parent
6a31f16a
Changes
8
Hide whitespace changes
Inline
Side-by-side
public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BammetricsReport.scala
View file @
17ac2dce
package
nl.lumc.sasc.biopet.pipelines.bammetrics
import
java.io.
{
PrintWriter
,
File
}
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.core.summary.
{
SummaryValue
,
Summary
}
import
nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
/**
...
...
@@ -65,8 +65,10 @@ object BammetricsReport extends ReportBuilder {
}
if
(
libraryLevel
)
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
))
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
)
)
{
tsvWriter
.
println
(
getLine
(
summary
,
sample
,
Some
(
lib
)))
}
}
else
{
...
...
@@ -85,5 +87,4 @@ object BammetricsReport extends ReportBuilder {
plot
.
runLocal
()
}
}
public/biopet-framework/src/main/resources/nl/lumc/sasc/biopet/extensions/rscript/stackedBar.R
View file @
17ac2dce
...
...
@@ -28,6 +28,6 @@ ggplot(DF1, aes(x = Rank, y = value, fill = variable)) +
ylab
(
arguments
$
ylabel
)
+
guides
(
fill
=
guide_legend
(
title
=
arguments
$
llabel
))
+
theme
(
axis.text.x
=
element_text
(
angle
=
90
,
hjust
=
1
,
size
=
8
))
+
geom_bar
(
stat
=
"identity"
,
width
=
0.75
)
geom_bar
(
stat
=
"identity"
,
width
=
1
)
dev.off
()
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/BiopetQScript.scala
View file @
17ac2dce
...
...
@@ -18,6 +18,7 @@ package nl.lumc.sasc.biopet.core
import
java.io.File
import
java.io.PrintWriter
import
nl.lumc.sasc.biopet.core.config.
{
ConfigValueIndex
,
Config
,
Configurable
}
import
nl.lumc.sasc.biopet.core.report.
{
ReportBuilderExtension
,
ReportBuilder
}
import
org.broadinstitute.gatk.utils.commandline.Argument
import
org.broadinstitute.gatk.queue.QSettings
import
org.broadinstitute.gatk.queue.function.QFunction
...
...
@@ -57,6 +58,9 @@ trait BiopetQScript extends Configurable with GatkLogging {
/** Pipeline itself */
def
biopetScript
/** Returns the extension to make the report */
def
reportClass
:
Option
[
ReportBuilderExtension
]
=
None
/** Script from queue itself, final to force some checks for each pipeline and write report */
final
def
script
()
{
outputDir
=
config
(
"output_dir"
)
...
...
@@ -81,6 +85,8 @@ trait BiopetQScript extends Configurable with GatkLogging {
globalConfig
.
writeReport
(
qSettings
.
runName
,
new
File
(
outputDir
,
".log/"
+
qSettings
.
runName
))
else
BiopetQScript
.
addError
(
"Parent of output dir: '"
+
outputDir
.
getParent
+
"' is not writeable, outputdir can not be created"
)
reportClass
.
foreach
(
add
(
_
))
BiopetQScript
.
checkErrors
}
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala
View file @
17ac2dce
...
...
@@ -2,8 +2,9 @@ package nl.lumc.sasc.biopet.core.report
import
java.io.
{
PrintWriter
,
File
}
import
nl.lumc.sasc.biopet.core.ToolCommand
import
nl.lumc.sasc.biopet.core.
{
BiopetJavaCommandLineFunction
,
ToolCommand
}
import
nl.lumc.sasc.biopet.core.summary.Summary
import
org.broadinstitute.gatk.utils.commandline.Input
import
org.fusesource.scalate.
{
TemplateSource
,
TemplateEngine
}
import
scala.io.Source
...
...
@@ -11,15 +12,40 @@ import scala.io.Source
/**
* Created by pjvan_thof on 3/27/15.
*/
trait
ReportBuilderExtension
extends
BiopetJavaCommandLineFunction
{
val
builder
:
ReportBuilder
@Input
(
required
=
true
)
var
summaryFile
:
File
=
_
var
outputDir
:
File
=
_
var
args
:
Map
[
String
,
String
]
=
Map
()
override
def
beforeGraph
:
Unit
=
{
super
.
beforeGraph
jobOutputFile
=
new
File
(
outputDir
,
".report.log.out"
)
javaMainClass
=
builder
.
getClass
.
getName
.
takeWhile
(
_
!=
'$'
)
}
override
def
commandLine
:
String
=
{
super
.
commandLine
+
required
(
"--summary"
,
summaryFile
)
+
required
(
"--outputDir"
,
outputDir
)
+
args
.
map
(
x
=>
required
(
x
.
_1
,
x
.
_2
)).
mkString
}
}
trait
ReportBuilder
extends
ToolCommand
{
case
class
Args
(
summary
:
File
=
null
,
outputDir
:
File
=
null
,
pageArgs
:
Map
[
String
,
String
]
=
Map
())
extends
AbstractArgs
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
's'
,
"summary"
)
required
()
maxOccurs
(
1
)
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
opt
[
File
](
's'
,
"summary"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
summary
=
x
)
}
opt
[
File
](
'o'
,
"outputDir"
)
required
()
maxOccurs
(
1
)
valueName
(
"<file>"
)
action
{
(
x
,
c
)
=>
opt
[
File
](
'o'
,
"outputDir"
)
required
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
c
.
copy
(
outputDir
=
x
)
}
opt
[
Map
[
String
,
String
]](
'a'
,
"args"
)
action
{
(
x
,
c
)
=>
...
...
@@ -50,7 +76,7 @@ trait ReportBuilder extends ToolCommand {
val
cssDir
=
new
File
(
cmdArgs
.
outputDir
,
"css"
)
cssDir
.
mkdirs
()
val
cssWriter
=
new
PrintWriter
(
new
File
(
cssDir
,
"biopet.css"
))
Source
.
fromInputStream
(
getClass
.
getResourceAsStream
(
"/nl/lumc/sasc/biopet/core/report/biopet.css"
)).
getLines
().
foreach
(
cssWriter
.
println
(
_
)
)
Source
.
fromInputStream
(
getClass
.
getResourceAsStream
(
"/nl/lumc/sasc/biopet/core/report/biopet.css"
)).
getLines
().
foreach
(
cssWriter
.
println
)
cssWriter
.
close
()
logger
.
info
(
"Parsing summary"
)
...
...
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/rscript/StackedBarPlot.scala
View file @
17ac2dce
...
...
@@ -4,7 +4,7 @@ import java.io.File
import
nl.lumc.sasc.biopet.core.config.Configurable
import
nl.lumc.sasc.biopet.extensions.RscriptCommandLineFunction
import
org.broadinstitute.gatk.utils.commandline.
{
Output
,
Input
}
import
org.broadinstitute.gatk.utils.commandline.
{
Output
,
Input
}
/**
* Created by pjvan_thof on 4/29/15.
...
...
public/flexiprep/src/main/scala/nl/lumc/sasc/biopet/pipelines/flexiprep/FlexiprepReport.scala
View file @
17ac2dce
package
nl.lumc.sasc.biopet.pipelines.flexiprep
import
java.io.
{
PrintWriter
,
File
}
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.core.summary.
{
SummaryValue
,
Summary
}
import
nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
/**
...
...
@@ -44,10 +44,10 @@ object FlexiprepReport extends ReportBuilder {
// FIXME: Not yet finished
def
readSummaryPlot
(
outputDir
:
File
,
prefix
:
String
,
read
:
String
,
summary
:
Summary
,
sampleId
:
Option
[
String
]
=
None
)
:
Unit
=
{
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
)
...
...
@@ -74,8 +74,10 @@ object FlexiprepReport extends ReportBuilder {
sb
.
toString
}
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
))
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
)
)
{
tsvWriter
.
println
(
getLine
(
summary
,
sample
,
lib
))
}
...
...
@@ -112,8 +114,10 @@ object FlexiprepReport extends ReportBuilder {
sb
.
toString
}
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
))
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
)
)
{
tsvWriter
.
println
(
getLine
(
summary
,
sample
,
lib
))
}
...
...
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaReport.scala
View file @
17ac2dce
package
nl.lumc.sasc.biopet.pipelines.shiva
import
java.io.
{
PrintWriter
,
File
}
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.core.config.Configurable
import
nl.lumc.sasc.biopet.core.report.
{
ReportBuilderExtension
,
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
...
...
@@ -11,6 +12,10 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
/**
* Created by pjvan_thof on 3/30/15.
*/
class
ShivaReport
(
val
root
:
Configurable
)
extends
ReportBuilderExtension
{
val
builder
=
ShivaReport
}
object
ShivaReport
extends
MultisampleReportBuilder
{
// FIXME: Not yet finished
...
...
@@ -74,10 +79,10 @@ object ShivaReport extends MultisampleReportBuilder {
def
reportName
=
"Shiva Report"
def
variantSummaryPlot
(
outputDir
:
File
,
prefix
:
String
,
summary
:
Summary
,
libraryLevel
:
Boolean
=
false
,
sampleId
:
Option
[
String
]
=
None
)
:
Unit
=
{
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
)
...
...
@@ -103,8 +108,10 @@ object ShivaReport extends MultisampleReportBuilder {
}
if
(
libraryLevel
)
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
))
{
for
(
sample
<-
summary
.
samples
if
(
sampleId
.
isEmpty
||
sample
==
sampleId
.
get
);
lib
<-
summary
.
libraries
(
sample
)
)
{
tsvWriter
.
println
(
getLine
(
summary
,
sample
,
Some
(
lib
)))
}
}
else
{
...
...
public/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/ShivaTrait.scala
View file @
17ac2dce
...
...
@@ -45,6 +45,13 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
addSummaryJobs
}
override
def
reportClass
=
{
val
shiva
=
new
ShivaReport
(
this
)
shiva
.
outputDir
=
new
File
(
outputDir
,
"report"
)
shiva
.
summaryFile
=
summaryFile
Some
(
shiva
)
}
/** Method to make the variantcalling submodule of shiva */
def
makeVariantcalling
(
multisample
:
Boolean
=
false
)
:
ShivaVariantcallingTrait
=
{
if
(
multisample
)
new
ShivaVariantcalling
(
qscript
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment