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

Fixed Kopisu unit tests

parent 9b7654c7
......@@ -14,9 +14,10 @@
*/
package nl.lumc.sasc.biopet.core.extensions
import java.io.{ File, FileOutputStream }
import java.io.{File, FileOutputStream}
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.utils.commandline.Input
trait PythonCommandLineFunction extends BiopetCommandLineFunction {
......@@ -50,9 +51,11 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
pythonScript = new File(".queue/tmp/" + subpackage + pythonScriptName)
if (!pythonScript.getParentFile.exists) pythonScript.getParentFile.mkdirs
val is = getClass.getResourceAsStream(subpackage + pythonScriptName)
val os = new FileOutputStream(pythonScript)
org.apache.commons.io.IOUtils.copy(is, os)
os.close()
if (is != null) {
val os = new FileOutputStream(pythonScript)
org.apache.commons.io.IOUtils.copy(is, os)
os.close()
} else Logging.addError(s"Python script not found: $pythonScriptName")
}
/** return basic command to prefix the complete command with */
......
......@@ -34,10 +34,11 @@ import scala.collection.mutable.ListBuffer
* Created by pjvan_thof on 3/2/15.
*/
class KopisuTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any], outputDir: File): Kopisu = {
def initPipeline(map: Map[String, Any], dir: File): Kopisu = {
new Kopisu() {
override def configNamespace = "kopisu"
override def globalConfig = new Config(ConfigUtils.mergeMaps(map, KopisuTest.config(outputDir)))
override def globalConfig = new Config(ConfigUtils.mergeMaps(map, KopisuTest.config(dir)))
outputDir = dir
qSettings = new QSettings
qSettings.runName = "test"
}
......@@ -121,6 +122,9 @@ object KopisuTest {
val controlDir = Files.createTempDir()
Files.touch(new File(controlDir, "test.txt"))
val coniferScript = File.createTempFile("conifer.", ".py")
coniferScript.deleteOnExit()
def config(outputDir: File) = Map(
"skip_write_dependencies" -> true,
"name_prefix" -> "test",
......@@ -133,7 +137,7 @@ object KopisuTest {
"tabix" -> Map("exe" -> "test"),
"freec" -> Map("exe" -> "test", "chrFiles" -> "test", "chrLenFile" -> "test"),
"controls_dir" -> controlDir.getAbsolutePath,
"conifer" -> Map("script" -> "/usr/bin/test"),
"conifer" -> Map("script" -> coniferScript.getAbsolutePath),
"probe_file" -> "test",
"rscript" -> Map("exe" -> "test")
)
......
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