Commit 81108a2a authored by Peter van 't Hof's avatar Peter van 't Hof

Adding separated outputDirs for tests for MultisampleMapping

parent 2cc410f4
...@@ -104,10 +104,10 @@ abstract class AbstractTestMapping(val aligner: String) extends TestNGSuite with ...@@ -104,10 +104,10 @@ abstract class AbstractTestMapping(val aligner: String) extends TestNGSuite with
val inputDir = Files.createTempDir() val inputDir = Files.createTempDir()
val r1 = new File(inputDir, "input" + File.separator + "R1.fq") val r1 = new File(inputDir, "R1.fq")
val r2 = new File(inputDir, "input" + File.separator + "R2.fq") val r2 = new File(inputDir, "R2.fq")
val r1Zipped = new File(inputDir, "input" + File.separator + "R1.fq.gz") val r1Zipped = new File(inputDir, "R1.fq.gz")
val r2Zipped = new File(inputDir, "input" + File.separator + "R2.fq.gz") val r2Zipped = new File(inputDir, "R2.fq.gz")
val hisat2Index = new File(inputDir, "ref.1.ht2") val hisat2Index = new File(inputDir, "ref.1.ht2")
@BeforeClass @BeforeClass
...@@ -128,7 +128,7 @@ abstract class AbstractTestMapping(val aligner: String) extends TestNGSuite with ...@@ -128,7 +128,7 @@ abstract class AbstractTestMapping(val aligner: String) extends TestNGSuite with
private def copyFile(name: String): Unit = { private def copyFile(name: String): Unit = {
val is = getClass.getResourceAsStream("/" + name) val is = getClass.getResourceAsStream("/" + name)
val os = new FileOutputStream(new File(outputDir, name)) val os = new FileOutputStream(new File(inputDir, name))
org.apache.commons.io.IOUtils.copy(is, os) org.apache.commons.io.IOUtils.copy(is, os)
os.close() os.close()
} }
......
...@@ -162,18 +162,24 @@ class MultisampleMappingBamToFastqTest extends MultisampleMappingTestTrait { ...@@ -162,18 +162,24 @@ class MultisampleMappingBamToFastqTest extends MultisampleMappingTestTrait {
} }
object MultisampleMappingTestTrait { object MultisampleMappingTestTrait {
val outputDir = Files.createTempDir() private var dirs: List[File] = Nil
outputDir.deleteOnExit() def outputDir = {
new File(outputDir, "input").mkdirs() val dir = Files.createTempDir()
dirs :+= dir
dir
}
val inputDir = Files.createTempDir()
def inputTouch(name: String): File = { def inputTouch(name: String): File = {
val file = new File(outputDir, "input" + File.separator + name).getAbsoluteFile val file = new File(inputDir, name).getAbsoluteFile
Files.touch(file) Files.touch(file)
file file
} }
private def copyFile(name: String): Unit = { private def copyFile(name: String): Unit = {
val is = getClass.getResourceAsStream("/" + name) val is = getClass.getResourceAsStream("/" + name)
val os = new FileOutputStream(new File(outputDir, name)) val os = new FileOutputStream(new File(inputDir, name))
org.apache.commons.io.IOUtils.copy(is, os) org.apache.commons.io.IOUtils.copy(is, os)
os.close() os.close()
} }
...@@ -183,14 +189,14 @@ object MultisampleMappingTestTrait { ...@@ -183,14 +189,14 @@ object MultisampleMappingTestTrait {
copyFile("ref.fa.fai") copyFile("ref.fa.fai")
copyFile("empty.sam") copyFile("empty.sam")
val config = Map( def config = Map(
"skip_write_dependencies" -> true, "skip_write_dependencies" -> true,
"name_prefix" -> "test", "name_prefix" -> "test",
"cache" -> true, "cache" -> true,
"dir" -> "test", "dir" -> "test",
"vep_script" -> "test", "vep_script" -> "test",
"output_dir" -> outputDir, "output_dir" -> outputDir,
"reference_fasta" -> (outputDir + File.separator + "ref.fa"), "reference_fasta" -> (inputDir + File.separator + "ref.fa"),
"fastqc" -> Map("exe" -> "test"), "fastqc" -> Map("exe" -> "test"),
"input_alleles" -> "test", "input_alleles" -> "test",
"fastqc" -> Map("exe" -> "test"), "fastqc" -> Map("exe" -> "test"),
...@@ -234,7 +240,7 @@ object MultisampleMappingTestTrait { ...@@ -234,7 +240,7 @@ object MultisampleMappingTestTrait {
val sample3 = Map( val sample3 = Map(
"samples" -> Map("sample3" -> Map("libraries" -> Map( "samples" -> Map("sample3" -> Map("libraries" -> Map(
"lib1" -> Map( "lib1" -> Map(
"bam" -> (outputDir + File.separator + "empty.sam") "bam" -> (inputDir + File.separator + "empty.sam")
) )
) )
))) )))
...@@ -242,7 +248,7 @@ object MultisampleMappingTestTrait { ...@@ -242,7 +248,7 @@ object MultisampleMappingTestTrait {
val sample4 = Map( val sample4 = Map(
"samples" -> Map("sample4" -> Map("libraries" -> Map( "samples" -> Map("sample4" -> Map("libraries" -> Map(
"lib1" -> Map( "lib1" -> Map(
"bam" -> (outputDir + File.separator + "empty.sam") "bam" -> (inputDir + File.separator + "empty.sam")
) )
) )
))) )))
......
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