Commit 5d39aa90 authored by Sander Bollen's avatar Sander Bollen
Browse files

use Option[File] for output dir in stead of String

parent ceb905da
...@@ -43,28 +43,34 @@ class Cnmops(val root: Configurable) extends RscriptCommandLineFunction { ...@@ -43,28 +43,34 @@ class Cnmops(val root: Configurable) extends RscriptCommandLineFunction {
// output files, computed automatically from output directory // output files, computed automatically from output directory
@Output(doc = "Output CNV file") @Output(doc = "Output CNV file")
lazy val outputCnv: File = { lazy val outputCnv: File = {
require(!outputDir.isEmpty, "Unexpected error when trying to set cn.MOPS CNV output") outputDir match {
new File(outputDir, "cnv.txt") case Some(dir) if dir.exists => new File(dir, "cnv.txt")
case _ => throw new IllegalArgumentException("Unexpected error when trying to set cn.MOPS CNV output")
}
} }
@Output(doc = "Output CNR file") @Output(doc = "Output CNR file")
lazy val outputCnr: File = { lazy val outputCnr: File = {
require(!outputDir.isEmpty, "Unexpected error when trying to set cn.MOPS CNR output") outputDir match {
new File(outputDir, "cnr.txt") case Some(dir) if dir.exists => new File(dir, "cnr.txt")
case _ => throw new IllegalArgumentException("Unexpected error when trying to set cn.MOPS CNR output")
}
} }
@Output(doc = "Raw output") @Output(doc = "Raw output")
lazy val rawOutput: File = { lazy val rawOutput: File = {
require(!outputDir.isEmpty, "Unexpected error when trying to set cn.MOPS raw output") outputDir match {
new File(outputDir, "rawoutput.txt") case Some(dir) if dir.exists => new File(dir, "rawoutput.txt")
case _ => throw new IllegalArgumentException("Unexpected error when trying to set cn.MOPS raw output")
}
} }
/** write all output files to this directory [./] */ /** write all output files to this directory [./] */
var outputDir: String = _ var outputDir: Option[File] = None
override def beforeGraph = { override def beforeGraph = {
super.beforeGraph super.beforeGraph
require(!outputDir.isEmpty, "Outputdir for cn.MOPS should not be empty") require(outputDir.isDefined, "Outputdir for cn.MOPS should not be empty")
require(input.length >= 2, "Please supply at least 2 BAM files for cn.MOPS") require(input.length >= 2, "Please supply at least 2 BAM files for cn.MOPS")
} }
......
...@@ -27,7 +27,7 @@ class CnmopsMethod(val root: Configurable) extends CnvMethod { ...@@ -27,7 +27,7 @@ class CnmopsMethod(val root: Configurable) extends CnvMethod {
case (sampleName, bamFile) => Some(bamFile) case (sampleName, bamFile) => Some(bamFile)
case _ => None case _ => None
}.toList }.toList
cnmops.outputDir = new File(outputDir, contig.getSequenceName).getAbsolutePath cnmops.outputDir = Some(new File(outputDir, contig.getSequenceName))
cnmops.beforeGraph cnmops.beforeGraph
cnmops cnmops
}).toList }).toList
......
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