Commit 412fbccb authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Simplify lineplot code

parent e2f5ad58
......@@ -237,15 +237,11 @@ object BammetricsReport extends ReportBuilder {
tsvWriter.close()
val plot = new LinePlot(null)
plot.input = tsvFile
plot.output = pngFile
plot.ylabel = Some("Reads")
plot.xlabel = Some("Insert size")
plot.width = Some(1200)
plot.removeZero = true
plot.title = Some("Insert size")
plot.runLocal()
LinePlot(tsvFile, outputDir,
xlabel = Some("Insert size"),
ylabel = Some("Reads"),
title = Some("Insert size"),
removeZero = true).runLocal()
}
/**
......@@ -328,15 +324,11 @@ object BammetricsReport extends ReportBuilder {
tsvWriter.close()
val plot = new LinePlot(null)
plot.input = tsvFile
plot.output = pngFile
plot.ylabel = Some("Bases")
plot.xlabel = Some("Coverage")
plot.width = Some(1200)
plot.removeZero = true
plot.title = Some("Whole genome coverage")
plot.runLocal()
LinePlot(tsvFile, outputDir,
xlabel = Some("Coverage"),
ylabel = Some("Bases"),
title = Some("Whole genome coverage"),
removeZero = true).runLocal()
}
/**
......@@ -419,14 +411,10 @@ object BammetricsReport extends ReportBuilder {
tsvWriter.close()
val plot = new LinePlot(null)
plot.input = tsvFile
plot.output = pngFile
plot.xlabel = Some("Relative position")
plot.ylabel = Some("Coverage")
plot.width = Some(1200)
plot.removeZero = true
plot.title = Some("Rna coverage")
plot.runLocal()
LinePlot(tsvFile, outputDir,
xlabel = Some("Relative position"),
ylabel = Some("Coverage"),
title = Some("Rna coverage"),
removeZero = true).runLocal()
}
}
......@@ -49,3 +49,24 @@ class LinePlot(val root: Configurable) extends Rscript {
title.map(Seq("--title", _)).getOrElse(Seq()) ++
(if (removeZero) Seq("--removeZero", "true") else Seq())
}
object LinePlot {
def apply(inputTsv: File,
outputFile: File,
root: Configurable = null,
xlabel: Option[String] = None,
ylabel: Option[String] = None,
width: Int = 1200,
removeZero: Boolean = false,
title: Option[String] = None): LinePlot = {
val plot = new LinePlot(root)
plot.input = inputTsv
plot.output = outputFile
plot.xlabel = xlabel
plot.ylabel = ylabel
plot.width = Some(width)
plot.removeZero = removeZero
plot.title = title
plot
}
}
\ No newline at end of file
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