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

Fixed tests

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