Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -20,10 +20,10 @@ class IGVToolsCount(val root: Configurable) extends IGVTools { ...@@ -20,10 +20,10 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
var genomeChromSizes: File = _ var genomeChromSizes: File = _
@Output @Output
protected var tdf: File = _ protected var tdf: Option[File] = _
@Output @Output
protected var wig: File = _ protected var wig: Option[File] = _
var maxZoom: Option[Int] = config("maxZoom") var maxZoom: Option[Int] = config("maxZoom")
var windowSize: Option[Int] = config("windowSize") var windowSize: Option[Int] = config("windowSize")
...@@ -46,8 +46,8 @@ class IGVToolsCount(val root: Configurable) extends IGVTools { ...@@ -46,8 +46,8 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
super.afterGraph super.afterGraph
if (!input.exists()) throw new FileNotFoundException("Input bam is required for IGVToolsCount") if (!input.exists()) throw new FileNotFoundException("Input bam is required for IGVToolsCount")
this.tdf = new File(input.getAbsolutePath + ".tdf") this.tdf = Some(new File(input.getAbsolutePath + ".tdf"))
this.wig = new File(input.getAbsolutePath.stripSuffix(".bam") + ".wig") this.wig = Some(new File(input.getAbsolutePath.stripSuffix(".bam") + ".wig"))
} }
def cmdLine = { def cmdLine = {
...@@ -72,14 +72,14 @@ class IGVToolsCount(val root: Configurable) extends IGVTools { ...@@ -72,14 +72,14 @@ class IGVToolsCount(val root: Configurable) extends IGVTools {
/** /**
* This part should never fail, these values are set within this wrapper * This part should never fail, these values are set within this wrapper
* *
*/ */
private def outputArg: String = { private def outputArg: String = {
(tdf.isInstanceOf[File], wig.isInstanceOf[File]) match { (tdf, wig) match {
case (false, false) => throw new IllegalArgumentException("Either TDF or WIG should be supplied"); case (None, None) => throw new IllegalArgumentException("Either TDF or WIG should be supplied");
case (true, false) => tdf.getAbsolutePath; case (Some(a), None) => a.getAbsolutePath;
case (false, true) => wig.getAbsolutePath; case (None, Some(b)) => b.getAbsolutePath;
case (true, true) => tdf.getAbsolutePath + "," + wig.getAbsolutePath; case (Some(a), Some(b)) => a.getAbsolutePath + "," + b.getAbsolutePath;
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment