Commit 28d55721 authored by bow's avatar bow
Browse files

Refactor FastQC outputDir and dataFile to separate methods

parent 46c811a1
...@@ -34,6 +34,14 @@ import nl.lumc.sasc.biopet.utils.ConfigUtils ...@@ -34,6 +34,14 @@ import nl.lumc.sasc.biopet.utils.ConfigUtils
*/ */
class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(root) { class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(root) {
/** Default FastQC output directory containing actual results */
// this is a def instead of a val since the value depends on the variable `output`, which is null on class creation
def outputDir: File = new File(output.getAbsolutePath.stripSuffix(".zip"))
/** Default FastQC output data file */
// this is a def instead of a val since the value depends on the variable `output`, which is null on class creation
def dataFile: File = new File(outputDir, "fastqc_data.txt")
/** /**
* FastQC QC modules. * FastQC QC modules.
* *
...@@ -43,10 +51,7 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r ...@@ -43,10 +51,7 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
*/ */
@throws(classOf[FileNotFoundException]) @throws(classOf[FileNotFoundException])
@throws(classOf[IllegalStateException]) @throws(classOf[IllegalStateException])
protected def qcModules: Map[String, Array[String]] = { def qcModules: Map[String, Array[String]] = {
val outputDir = output.getAbsolutePath.stripSuffix(".zip")
val dataFile = new File(outputDir, "fastqc_data.txt")
val fqModules = Source.fromFile(dataFile) val fqModules = Source.fromFile(dataFile)
// drop all the characters before the first module delimiter (i.e. '>>') // drop all the characters before the first module delimiter (i.e. '>>')
...@@ -128,7 +133,6 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r ...@@ -128,7 +133,6 @@ class Fastqc(root: Configurable) extends nl.lumc.sasc.biopet.extensions.Fastqc(r
/** Summary of the FastQC run, stored in a [[Json]] object */ /** Summary of the FastQC run, stored in a [[Json]] object */
def summary: Json = { def summary: Json = {
val outputDir: String = output.getAbsolutePath.stripSuffix(".zip")
val outputMap = val outputMap =
Map("plot_duplication_levels" -> "Images/duplication_levels.png", Map("plot_duplication_levels" -> "Images/duplication_levels.png",
"plot_kmer_profiles" -> "Images/kmer_profiles.png", "plot_kmer_profiles" -> "Images/kmer_profiles.png",
......
Supports Markdown
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