Commit 1bd1056d authored by Peter van 't Hof's avatar Peter van 't Hof

Fixed unit tests

parent 636158a5
......@@ -83,13 +83,14 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/** Set default output file, threads and vmem for current job */
final def internalBeforeGraph(): Unit = {
pipesJobs.foreach(_.beforeGraph())
pipesJobs.foreach(_.internalBeforeGraph())
_pipesJobs.foreach(_.beforeGraph())
_pipesJobs.foreach(_.internalBeforeGraph())
}
/**
* Can override this value is executable may not be converted to CanonicalPath
*
* @deprecated
*/
val executableToCanonicalPath = true
......@@ -121,6 +122,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/**
* This operator sends stdout to `that` and combine this into 1 command line function
*
* @param that Function that will read from stdin
* @return BiopetPipe function
*/
......@@ -141,6 +143,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/**
* This operator can be used to give a program a file as stdin
*
* @param file File that will become stdin for this program
* @return It's own class
*/
......@@ -152,6 +155,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/**
* This operator can be used to give a program a file write it's atdout
*
* @param file File that will become stdout for this program
* @return It's own class
*/
......@@ -169,6 +173,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/**
* This function needs to be implemented to define the command that is executed
*
* @return Command to run
*/
protected[core] def cmdLine: String
......@@ -176,6 +181,7 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
/**
* implementing a final version of the commandLine from org.broadinstitute.gatk.queue.function.CommandLineFunction
* User needs to implement cmdLine instead
*
* @return Command to run
*/
override final def commandLine: String = {
......@@ -187,10 +193,11 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
cmd
}
private[core] var pipesJobs: List[BiopetCommandLineFunction] = Nil
private[core] var _pipesJobs: List[BiopetCommandLineFunction] = Nil
def pipesJobs = _pipesJobs
def addPipeJob(job: BiopetCommandLineFunction) {
pipesJobs :+= job
pipesJobs = pipesJobs.distinct
_pipesJobs :+= job
_pipesJobs = _pipesJobs.distinct
}
}
......
......@@ -67,8 +67,8 @@ class BiopetFifoPipe(val root: Configurable,
deps :::= inputs.values.toList.flatten.filter(!fifoFiles.contains(_))
deps = deps.distinct
pipesJobs :::= commands
pipesJobs = pipesJobs.distinct
_pipesJobs :::= commands
_pipesJobs = _pipesJobs.distinct
}
override def beforeCmd(): Unit = {
......
......@@ -41,7 +41,7 @@ class BiopetPipe(val commands: List[BiopetCommandLineFunction]) extends BiopetCo
case e: Exception => Nil
}
pipesJobs :::= commands
_pipesJobs :::= commands
override def beforeGraph() {
super.beforeGraph()
......@@ -61,7 +61,7 @@ class BiopetPipe(val commands: List[BiopetCommandLineFunction]) extends BiopetCo
}
override def setResources(): Unit = {
combineResources(pipesJobs)
combineResources(_pipesJobs)
}
override def setupRetry(): Unit = {
......
......@@ -18,16 +18,17 @@ package nl.lumc.sasc.biopet.pipelines.shiva
import java.io.{ File, FileOutputStream }
import com.google.common.io.Files
import nl.lumc.sasc.biopet.utils.config.Config
import nl.lumc.sasc.biopet.core.BiopetPipe
import nl.lumc.sasc.biopet.extensions.Freebayes
import nl.lumc.sasc.biopet.extensions.bcftools.{ BcftoolsCall, BcftoolsMerge }
import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants
import nl.lumc.sasc.biopet.extensions.tools.VcfFilter
import nl.lumc.sasc.biopet.extensions.tools.{ MpileupToVcf, VcfFilter }
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.apache.commons.io.FileUtils
import nl.lumc.sasc.biopet.utils.config.Config
import org.broadinstitute.gatk.queue.QSettings
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{ AfterClass, DataProvider, Test }
import org.testng.annotations.{ DataProvider, Test }
import scala.collection.mutable.ListBuffer
......@@ -88,11 +89,13 @@ class ShivaVariantcallingTest extends TestNGSuite with Matchers {
pipeline.init()
pipeline.script()
val pipesJobs = pipeline.functions.filter(_.isInstanceOf[BiopetPipe]).flatMap(_.asInstanceOf[BiopetPipe].pipesJobs)
pipeline.functions.count(_.isInstanceOf[CombineVariants]) shouldBe (1 + (if (raw) 1 else 0) + (if (varscanCnsSinglesample) 1 else 0))
//pipeline.functions.count(_.isInstanceOf[Bcftools]) shouldBe (if (bcftools) 1 else 0)
//FIXME: Can not check for bcftools because of piping
pipeline.functions.count(_.isInstanceOf[Freebayes]) shouldBe (if (freebayes) 1 else 0)
//pipeline.functions.count(_.isInstanceOf[MpileupToVcf]) shouldBe (if (raw) bams else 0)
pipesJobs.count(_.isInstanceOf[BcftoolsCall]) shouldBe (if (bcftools) 1 else 0) + (if (bcftoolsSinglesample) bams else 0)
pipeline.functions.count(_.isInstanceOf[BcftoolsMerge]) shouldBe (if (bcftoolsSinglesample && bams > 1) 1 else 0)
pipesJobs.count(_.isInstanceOf[Freebayes]) shouldBe (if (freebayes) 1 else 0)
pipesJobs.count(_.isInstanceOf[MpileupToVcf]) shouldBe (if (raw) bams else 0)
pipeline.functions.count(_.isInstanceOf[VcfFilter]) shouldBe (if (raw) bams else 0)
}
}
......
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