Commit 8a56e56b authored by Peter van 't Hof's avatar Peter van 't Hof

Added test for no sample to flexiprep

parent bb9b5b6a
......@@ -78,28 +78,33 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
if (sampleId == null || sampleId == None) Logging.addError("Missing sample ID on flexiprep module")
if (libId == null || libId == None) Logging.addError("Missing library ID on flexiprep module")
paired = inputR2.isDefined
if (inputR1 == null) Logging.addError("Missing input R1 on flexiprep module")
else {
paired = inputR2.isDefined
inputFiles :+= new InputFile(inputR1)
inputR2.foreach(inputFiles :+= new InputFile(_))
inputFiles :+= new InputFile(inputR1)
inputR2.foreach(inputFiles :+= new InputFile(_))
R1Name = getUncompressedFileName(inputR1)
inputR2.foreach { fileR2 =>
paired = true
R2Name = getUncompressedFileName(fileR2)
R1Name = getUncompressedFileName(inputR1)
inputR2.foreach { fileR2 =>
paired = true
R2Name = getUncompressedFileName(fileR2)
}
}
}
/** Script to add jobs */
def biopetScript() {
runInitialJobs()
if (inputR1 != null) {
runInitialJobs()
if (paired) runTrimClip(inputR1, inputR2, outputDir)
else runTrimClip(inputR1, outputDir)
if (paired) runTrimClip(inputR1, inputR2, outputDir)
else runTrimClip(inputR1, outputDir)
val R1Files = for ((k, v) <- outputFiles if k.endsWith("output_R1")) yield v
val R2Files = for ((k, v) <- outputFiles if k.endsWith("output_R2")) yield v
runFinalize(R1Files.toList, R2Files.toList)
val R1Files = for ((k, v) <- outputFiles if k.endsWith("output_R1")) yield v
val R2Files = for ((k, v) <- outputFiles if k.endsWith("output_R2")) yield v
runFinalize(R1Files.toList, R2Files.toList)
}
}
/** Add init non chunkable jobs */
......
......@@ -17,14 +17,14 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep
import java.io.File
import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions.tools.{ ValidateFastq, SeqStat }
import nl.lumc.sasc.biopet.extensions.tools.{SeqStat, ValidateFastq}
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.{AfterClass, DataProvider, Test}
/**
* Test class for [[Flexiprep]]
......@@ -83,6 +83,18 @@ class FlexiprepTest extends TestNGSuite with Matchers {
}
@Test
def testNoSample: Unit = {
val map = ConfigUtils.mergeMaps(Map(
"output_dir" -> FlexiprepTest.outputDir
), Map(FlexiprepTest.executables.toSeq: _*))
val flexiprep: Flexiprep = initPipeline(map)
intercept[IllegalStateException] {
flexiprep.script()
}
}
// remove temporary run directory all tests in the class have been run
@AfterClass def removeTempOutputDir() = {
FileUtils.deleteDirectory(FlexiprepTest.outputDir)
......
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