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

Adding more testing

parent 81797e5a
...@@ -23,7 +23,7 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep ...@@ -23,7 +23,7 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.Flexiprep
import nl.lumc.sasc.biopet.pipelines.mapping.Mapping import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
import nl.lumc.sasc.biopet.extensions.tools.SquishBed import nl.lumc.sasc.biopet.extensions.tools.SquishBed
import nl.lumc.sasc.biopet.extensions.tools.{BedtoolsCoverageToCounts, PrefixFastq, SageCountFastq, SageCreateLibrary, SageCreateTagCounts} import nl.lumc.sasc.biopet.extensions.tools.{BedtoolsCoverageToCounts, PrefixFastq, SageCountFastq, SageCreateLibrary, SageCreateTagCounts}
import nl.lumc.sasc.biopet.utils.{ConfigUtils, Logging} import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
class Sage(val root: Configurable) extends QScript with MultiSampleQScript { class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
...@@ -139,14 +139,14 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript { ...@@ -139,14 +139,14 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
def biopetScript() { def biopetScript() {
val squishBed = new SquishBed(this) val squishBed = new SquishBed(this)
squishBed.input = countBed.get squishBed.input = countBed.getOrElse(null)
squishBed.output = new File(outputDir, countBed.get.getName.stripSuffix(".bed") + ".squish.bed") squishBed.output = new File(outputDir, countBed.getOrElse(new File("fake")).getName.stripSuffix(".bed") + ".squish.bed")
add(squishBed) add(squishBed)
squishedCountBed = squishBed.output squishedCountBed = squishBed.output
if (tagsLibrary.isEmpty) { if (tagsLibrary.isEmpty) {
val cdl = new SageCreateLibrary(this) val cdl = new SageCreateLibrary(this)
cdl.input = transcriptome.get cdl.input = transcriptome.getOrElse(null)
cdl.output = new File(outputDir, "taglib/tag.lib") cdl.output = new File(outputDir, "taglib/tag.lib")
cdl.noAntiTagsOutput = new File(outputDir, "taglib/no_antisense_genes.txt") cdl.noAntiTagsOutput = new File(outputDir, "taglib/no_antisense_genes.txt")
cdl.noTagsOutput = new File(outputDir, "taglib/no_sense_genes.txt") cdl.noTagsOutput = new File(outputDir, "taglib/no_sense_genes.txt")
......
...@@ -33,9 +33,11 @@ class SageTest extends TestNGSuite with Matchers { ...@@ -33,9 +33,11 @@ class SageTest extends TestNGSuite with Matchers {
} }
def sample1 = Array(false, true) def sample1 = Array(false, true)
def sample2 = Array(false, true) def sample2 = Array(false, true)
def transcriptome = true
def countBed = true
def tagsLibrary = false
def libraryCounts: Option[Boolean] = None
@Test(dataProvider = "sageOptions") @Test(dataProvider = "sageOptions")
def testSage(f: String, sample1: Boolean, sample2: Boolean): Unit = { def testSage(f: String, sample1: Boolean, sample2: Boolean): Unit = {
...@@ -43,13 +45,16 @@ class SageTest extends TestNGSuite with Matchers { ...@@ -43,13 +45,16 @@ class SageTest extends TestNGSuite with Matchers {
var m: Map[String, Any] = SageTest.config var m: Map[String, Any] = SageTest.config
if (sample1) m = ConfigUtils.mergeMaps(SageTest.sample1, m) if (sample1) m = ConfigUtils.mergeMaps(SageTest.sample1, m)
if (sample2) m = ConfigUtils.mergeMaps(SageTest.sample2, m) if (sample2) m = ConfigUtils.mergeMaps(SageTest.sample2, m)
ConfigUtils.mergeMaps(Map( ConfigUtils.mergeMaps(
// Config values (if (transcriptome) Map[String, Any]("transcriptome" -> SageTest.inputTouch("trans.fa")) else Map[String, Any]()) ++
), m) (if (countBed) Map[String, Any]("count_bed" -> SageTest.inputTouch("count.bed")) else Map[String, Any]()) ++
(if (tagsLibrary) Map[String, Any]("tags_library" -> SageTest.inputTouch("tablib")) else Map[String, Any]()) ++
libraryCounts.map("library_counts" -> _),
m)
} }
if (!sample1 && !sample2) { if ((!sample1 && !sample2) || !countBed || (!transcriptome && !tagsLibrary)) {
// When no samples // When no samples
intercept[IllegalStateException] { intercept[IllegalStateException] {
initPipeline(map).script() initPipeline(map).script()
...@@ -81,6 +86,25 @@ class SageTest extends TestNGSuite with Matchers { ...@@ -81,6 +86,25 @@ class SageTest extends TestNGSuite with Matchers {
} }
} }
class SageNoBedTest extends SageTest {
override def sample1 = Array(true)
override def sample2 = Array(false)
override def countBed = false
}
class SageNoLibTest extends SageTest {
override def sample1 = Array(true)
override def sample2 = Array(false)
override def transcriptome = false
override def tagsLibrary = false
}
class SageLibraryCountsTest extends SageTest {
override def sample1 = Array(true)
override def sample2 = Array(false)
override def libraryCounts = Some(true)
}
object SageTest { object SageTest {
val outputDir = Files.createTempDir() val outputDir = Files.createTempDir()
outputDir.deleteOnExit() outputDir.deleteOnExit()
...@@ -107,8 +131,6 @@ object SageTest { ...@@ -107,8 +131,6 @@ object SageTest {
val config: Map[String, Any] = Map( val config: Map[String, Any] = Map(
"reference_fasta" -> (outputDir + File.separator + "ref.fa"), "reference_fasta" -> (outputDir + File.separator + "ref.fa"),
"output_dir" -> outputDir.getAbsolutePath, "output_dir" -> outputDir.getAbsolutePath,
"transcriptome" -> inputTouch("trans.fa"),
"count_bed" -> inputTouch("count.bed"),
"fastqc" -> Map("exe" -> "test"), "fastqc" -> Map("exe" -> "test"),
"seqtk" -> Map("exe" -> "test"), "seqtk" -> Map("exe" -> "test"),
"md5sum" -> Map("exe" -> "test"), "md5sum" -> 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