Commit fbc7a317 authored by Peter van 't Hof's avatar Peter van 't Hof

Fixed tests

parent b53183a5
...@@ -15,20 +15,20 @@ ...@@ -15,20 +15,20 @@
*/ */
package nl.lumc.sasc.biopet.pipelines.shiva package nl.lumc.sasc.biopet.pipelines.shiva
import java.io.{ File, FileOutputStream } import java.io.{File, FileOutputStream}
import java.nio.file.Paths import java.nio.file.Paths
import com.google.common.io.Files import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions.breakdancer.{ BreakdancerCaller, BreakdancerConfig, BreakdancerVCF } import nl.lumc.sasc.biopet.extensions.breakdancer.{BreakdancerCaller, BreakdancerConfig, BreakdancerVCF}
import nl.lumc.sasc.biopet.extensions.clever.CleverCaller import nl.lumc.sasc.biopet.extensions.clever.CleverCaller
import nl.lumc.sasc.biopet.extensions.delly.DellyCaller import nl.lumc.sasc.biopet.extensions.delly.DellyCaller
import nl.lumc.sasc.biopet.extensions.pindel.{ PindelCaller, PindelConfig, PindelVCF } import nl.lumc.sasc.biopet.extensions.pindel.{PindelCaller, PindelConfig, PindelVCF}
import nl.lumc.sasc.biopet.utils.ConfigUtils import nl.lumc.sasc.biopet.utils.{ConfigUtils, Logging}
import nl.lumc.sasc.biopet.utils.config.Config import nl.lumc.sasc.biopet.utils.config.Config
import org.broadinstitute.gatk.queue.QSettings import org.broadinstitute.gatk.queue.QSettings
import org.scalatest.Matchers import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{ DataProvider, Test } import org.testng.annotations.{DataProvider, Test}
import scala.collection.mutable.ListBuffer import scala.collection.mutable.ListBuffer
...@@ -152,9 +152,9 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers { ...@@ -152,9 +152,9 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
pipeline.inputBams = Map("bam" -> ShivaSvCallingTest.inputTouch("bam" + ".bam")) pipeline.inputBams = Map("bam" -> ShivaSvCallingTest.inputTouch("bam" + ".bam"))
intercept[IllegalArgumentException] { intercept[IllegalArgumentException] {
pipeline.init()
pipeline.script() pipeline.script()
} }
Logging.errors.clear()
} }
private def resourcePath(p: String): String = { private def resourcePath(p: String): String = {
......
...@@ -84,7 +84,7 @@ class ShivaTest extends TestNGSuite with Matchers { ...@@ -84,7 +84,7 @@ class ShivaTest extends TestNGSuite with Matchers {
// Gatk preprocess // Gatk preprocess
pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0)) pipeline.functions.count(_.isInstanceOf[IndelRealigner]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0))
pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0)) pipeline.functions.count(_.isInstanceOf[RealignerTargetCreator]) shouldBe (numberLibs * (if (realign) 1 else 0) + (if (sample2 && realign) 1 else 0))
pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0) pipeline.functions.count(_.isInstanceOf[BaseRecalibrator]) shouldBe (if (dbsnp && baseRecalibration) (numberLibs * 2) else 0)
pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0) pipeline.functions.count(_.isInstanceOf[PrintReads]) shouldBe (if (dbsnp && baseRecalibration) numberLibs else 0)
pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (if (multi) 2 else 0) pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (if (multi) 2 else 0)
......
...@@ -15,7 +15,6 @@ import nl.lumc.sasc.biopet.utils.config.Config ...@@ -15,7 +15,6 @@ import nl.lumc.sasc.biopet.utils.config.Config
import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants import nl.lumc.sasc.biopet.extensions.gatk.CombineVariants
import nl.lumc.sasc.biopet.extensions.gatk.broad.{ HaplotypeCaller, UnifiedGenotyper } import nl.lumc.sasc.biopet.extensions.gatk.broad.{ HaplotypeCaller, UnifiedGenotyper }
import nl.lumc.sasc.biopet.extensions.tools.{ MpileupToVcf, VcfFilter, VcfStats } import nl.lumc.sasc.biopet.extensions.tools.{ MpileupToVcf, VcfFilter, VcfStats }
import nl.lumc.sasc.biopet.pipelines.shiva.ShivaVariantcalling
import nl.lumc.sasc.biopet.utils.ConfigUtils import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import org.broadinstitute.gatk.queue.QSettings import org.broadinstitute.gatk.queue.QSettings
...@@ -53,9 +52,7 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers { ...@@ -53,9 +52,7 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers {
@DataProvider(name = "shivaVariantcallingOptions") @DataProvider(name = "shivaVariantcallingOptions")
def shivaVariantcallingOptions = { def shivaVariantcallingOptions = {
(for ( (for (bams <- 0 to 2) yield Array[Any](bams, raw, bcftools, bcftools_singlesample, unifiedGenotyper,
bams <- 0 to 2;
) yield Array[Any](bams, raw, bcftools, bcftools_singlesample, unifiedGenotyper,
haplotypeCaller, haplotypeCallerGvcf, haplotypeCallerAllele, unifiedGenotyperAllele, haplotypeCaller, haplotypeCallerGvcf, haplotypeCallerAllele, unifiedGenotyperAllele,
freebayes, varscanCnsSinglesample) freebayes, varscanCnsSinglesample)
).toArray ).toArray
...@@ -89,7 +86,7 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers { ...@@ -89,7 +86,7 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers {
pipeline.inputBams = (for (n <- 1 to bams) yield n.toString -> ShivaVariantcallingTest.inputTouch("bam_" + n + ".bam")).toMap pipeline.inputBams = (for (n <- 1 to bams) yield n.toString -> ShivaVariantcallingTest.inputTouch("bam_" + n + ".bam")).toMap
val illegalArgumentException = pipeline.inputBams.isEmpty || (callers.isEmpty) val illegalArgumentException = pipeline.inputBams.isEmpty || callers.isEmpty
if (illegalArgumentException) intercept[IllegalArgumentException] { if (illegalArgumentException) intercept[IllegalArgumentException] {
pipeline.script() pipeline.script()
...@@ -113,10 +110,6 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers { ...@@ -113,10 +110,6 @@ trait ShivaVariantcallingTestTrait extends TestNGSuite with Matchers {
pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (1 + callers.size) pipeline.functions.count(_.isInstanceOf[VcfStats]) shouldBe (1 + callers.size)
} }
} }
@AfterClass def removeTempOutputDir() = {
FileUtils.deleteDirectory(ShivaVariantcallingTest.outputDir)
}
} }
class ShivaVariantcallingNoVariantcallersTest extends ShivaVariantcallingTestTrait class ShivaVariantcallingNoVariantcallersTest extends ShivaVariantcallingTestTrait
...@@ -165,6 +158,7 @@ class ShivaVariantcallingVarscanCnsSinglesampleTest extends ShivaVariantcallingT ...@@ -165,6 +158,7 @@ class ShivaVariantcallingVarscanCnsSinglesampleTest extends ShivaVariantcallingT
object ShivaVariantcallingTest { object ShivaVariantcallingTest {
val outputDir = Files.createTempDir() val outputDir = Files.createTempDir()
outputDir.deleteOnExit()
new File(outputDir, "input").mkdirs() new File(outputDir, "input").mkdirs()
def inputTouch(name: String): File = { def inputTouch(name: String): File = {
val file = new File(outputDir, "input" + File.separator + name).getAbsoluteFile val file = new File(outputDir, "input" + File.separator + name).getAbsoluteFile
......
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