Commit b2da50cb authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Making the output files Option[File], and use Some() to verify whether it was set or not

parent 92fd93df
......@@ -20,10 +20,10 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
var genomeChromSizes: File = _
@Output
protected var tdf: File = _
protected var tdf: Option[File] = _
@Output
protected var wig: File = _
protected var wig: Option[File] = _
var maxZoom: Option[Int] = config("maxZoom")
var windowSize: Option[Int] = config("windowSize")
......@@ -46,8 +46,8 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
super.afterGraph
if (!input.exists()) throw new FileNotFoundException("Input bam is required for IGVToolsCount")
this.tdf = new File(input.getAbsolutePath + ".tdf")
this.wig = new File(input.getAbsolutePath.stripSuffix(".bam") + ".wig")
this.tdf = Some(new File(input.getAbsolutePath + ".tdf"))
this.wig = Some(new File(input.getAbsolutePath.stripSuffix(".bam") + ".wig"))
}
def cmdLine = {
......@@ -75,11 +75,11 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
*
*/
private def outputArg: String = {
(tdf.isInstanceOf[File], wig.isInstanceOf[File]) match {
case (false, false) => throw new IllegalArgumentException("Either TDF or WIG should be supplied");
case (true, false) => tdf.getAbsolutePath;
case (false, true) => wig.getAbsolutePath;
case (true, true) => tdf.getAbsolutePath + "," + wig.getAbsolutePath;
(tdf, wig) match {
case (None, None) => throw new IllegalArgumentException("Either TDF or WIG should be supplied");
case (Some(a), None) => a.getAbsolutePath;
case (None, Some(b)) => b.getAbsolutePath;
case (Some(a), Some(b)) => a.getAbsolutePath + "," + b.getAbsolutePath;
}
}
}
......
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