Skip to content
Snippets Groups Projects
Commit 610e9327 authored by Wai Yi Leung's avatar Wai Yi Leung
Browse files

Merge branch 'fix-sv_unit_tests' into 'develop'

Fixed sv unit testing

Fixes #291 

See merge request !345
parents 34dca7bc 23e05373
No related branches found
No related tags found
No related merge requests found
......@@ -22,14 +22,13 @@ import com.google.common.io.Files
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.{ PindelVCF, PindelConfig, PindelCaller }
import nl.lumc.sasc.biopet.extensions.pindel.{ PindelCaller, PindelConfig, PindelVCF }
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.config.Config
import org.apache.commons.io.FileUtils
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
......@@ -106,7 +105,7 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
pipeline.functions.count(_.isInstanceOf[PindelVCF]) shouldBe (if (pindel) bams else 0)
pipeline.functions.count(_.isInstanceOf[CleverCaller]) shouldBe (if (clever) bams else 0)
pipeline.functions.count(_.isInstanceOf[DellyCaller]) shouldBe (if (delly) (bams * 4) else 0)
pipeline.functions.count(_.isInstanceOf[DellyCaller]) shouldBe (if (delly) bams * 4 else 0)
}
}
......@@ -114,12 +113,12 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
@DataProvider(name = "dellyOptions")
def dellyOptions = {
val bool = Array(true, false)
(for (
for (
del <- bool;
dup <- bool;
inv <- bool;
tra <- bool
) yield Array(1, del, dup, inv, tra)).toArray
) yield Array(1, del, dup, inv, tra)
}
@Test(dataProvider = "dellyOptions")
......@@ -130,7 +129,7 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
)
val pipeline = initPipeline(map)
pipeline.inputBams = Map("bam" -> ShivaVariantcallingTest.inputTouch("bam" + ".bam"))
pipeline.inputBams = Map("bam" -> ShivaSvCallingTest.inputTouch("bam" + ".bam"))
if (!del && !dup && !inv && !tra) intercept[IllegalArgumentException] {
pipeline.init()
......@@ -150,7 +149,7 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
val map = Map("sv_callers" -> List("this is not a caller"))
val pipeline = initPipeline(map)
pipeline.inputBams = Map("bam" -> ShivaVariantcallingTest.inputTouch("bam" + ".bam"))
pipeline.inputBams = Map("bam" -> ShivaSvCallingTest.inputTouch("bam" + ".bam"))
intercept[IllegalArgumentException] {
pipeline.init()
......@@ -176,16 +175,13 @@ class ShivaSvCallingTest extends TestNGSuite with Matchers {
assert(summaryCallers.contains("clever"))
assert(summaryCallers.contains("breakdancer"))
}
@AfterClass def removeTempOutputDir() = {
FileUtils.deleteDirectory(ShivaSvCallingTest.outputDir)
}
}
object ShivaSvCallingTest {
val outputDir = Files.createTempDir()
outputDir.deleteOnExit()
new File(outputDir, "input").mkdirs()
def inputTouch(name: String): File = {
private def inputTouch(name: String): File = {
val file = new File(outputDir, "input" + File.separator + name).getAbsoluteFile
Files.touch(file)
file
......
......@@ -96,16 +96,13 @@ class ShivaVariantcallingTest extends TestNGSuite with Matchers {
pipeline.functions.count(_.isInstanceOf[VcfFilter]) shouldBe (if (raw) bams else 0)
}
}
@AfterClass def removeTempOutputDir() = {
FileUtils.deleteDirectory(ShivaVariantcallingTest.outputDir)
}
}
object ShivaVariantcallingTest {
val outputDir = Files.createTempDir()
outputDir.deleteOnExit()
new File(outputDir, "input").mkdirs()
def inputTouch(name: String): File = {
private def inputTouch(name: String): File = {
val file = new File(outputDir, "input" + File.separator + name).getAbsoluteFile
Files.touch(file)
file
......
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