Commit 3ef511a0 authored by Peter van 't Hof's avatar Peter van 't Hof

Added testing for aligner in gentrap

parent 25d7f27b
...@@ -14,19 +14,21 @@ ...@@ -14,19 +14,21 @@
*/ */
package nl.lumc.sasc.biopet.pipelines.gentrap package nl.lumc.sasc.biopet.pipelines.gentrap
import java.io.{ File, FileOutputStream } import java.io.{File, FileOutputStream}
import com.google.common.io.Files import com.google.common.io.Files
import nl.lumc.sasc.biopet.extensions._ import nl.lumc.sasc.biopet.extensions._
import nl.lumc.sasc.biopet.extensions.gmap.Gsnap
import nl.lumc.sasc.biopet.extensions.hisat.Hisat2
import nl.lumc.sasc.biopet.extensions.tools.BaseCounter import nl.lumc.sasc.biopet.extensions.tools.BaseCounter
import nl.lumc.sasc.biopet.utils.ConfigUtils import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.config.Config import nl.lumc.sasc.biopet.utils.config.Config
import org.broadinstitute.gatk.queue.QSettings import org.broadinstitute.gatk.queue.QSettings
import org.scalatest.Matchers import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite import org.scalatest.testng.TestNGSuite
import org.testng.annotations.{ DataProvider, Test } import org.testng.annotations.{DataProvider, Test}
abstract class GentrapTestAbstract(val expressionMeasure: String) extends TestNGSuite with Matchers { abstract class GentrapTestAbstract(val expressionMeasure: String, val aligner: Option[String]) extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): Gentrap = { def initPipeline(map: Map[String, Any]): Gentrap = {
new Gentrap() { new Gentrap() {
...@@ -105,10 +107,9 @@ abstract class GentrapTestAbstract(val expressionMeasure: String) extends TestNG ...@@ -105,10 +107,9 @@ abstract class GentrapTestAbstract(val expressionMeasure: String) extends TestNG
val settings = Map( val settings = Map(
"output_dir" -> GentrapTest.outputDir, "output_dir" -> GentrapTest.outputDir,
"gsnap" -> Map("db" -> "test", "dir" -> "test"), "gsnap" -> Map("db" -> "test", "dir" -> "test"),
"aligner" -> "gsnap",
"expression_measures" -> expMeasures, "expression_measures" -> expMeasures,
"strand_protocol" -> strandProtocol "strand_protocol" -> strandProtocol
) ) ++ aligner.map("aligner" -> _)
val config = ConfigUtils.mergeMaps(settings ++ sampleConfig, Map(GentrapTest.executables.toSeq: _*)) val config = ConfigUtils.mergeMaps(settings ++ sampleConfig, Map(GentrapTest.executables.toSeq: _*))
val gentrap: Gentrap = initPipeline(config) val gentrap: Gentrap = initPipeline(config)
...@@ -139,16 +140,29 @@ abstract class GentrapTestAbstract(val expressionMeasure: String) extends TestNG ...@@ -139,16 +140,29 @@ abstract class GentrapTestAbstract(val expressionMeasure: String) extends TestNG
assert(gentrap.functions.exists(_.isInstanceOf[Cufflinks])) assert(gentrap.functions.exists(_.isInstanceOf[Cufflinks]))
assert(gentrap.functions.exists(_.isInstanceOf[Ln])) assert(gentrap.functions.exists(_.isInstanceOf[Ln]))
} }
val classMap = Map(
"gsnap" -> classOf[Gsnap],
"tophat" -> classOf[Tophat],
"star" -> classOf[Star],
"star-2pass" -> classOf[Star],
"hisat2" -> classOf[Hisat2]
)
val alignerClass = classMap.get(aligner.getOrElse("gsnap"))
alignerClass.foreach(c => assert(gentrap.functions.exists(c.isInstance(_))))
classMap.values.filterNot(Some(_) == alignerClass).foreach(x => assert(!gentrap.functions.exists(x.isInstance(_))))
} }
} }
class GentrapFragmentsPerGeneTest extends GentrapTestAbstract("fragments_per_gene") class GentrapFragmentsPerGeneTest extends GentrapTestAbstract("fragments_per_gene", None)
//class GentrapFragmentsPerExonTest extends GentrapTestAbstract("fragments_per_exon") //class GentrapFragmentsPerExonTest extends GentrapTestAbstract("fragments_per_exon", None)
class GentrapBaseCountsTest extends GentrapTestAbstract("base_counts") class GentrapBaseCountsTest extends GentrapTestAbstract("base_counts", Some("gsnap"))
class GentrapCufflinksStrictTest extends GentrapTestAbstract("cufflinks_strict") class GentrapCufflinksStrictTest extends GentrapTestAbstract("cufflinks_strict", None)
class GentrapCufflinksGuidedTest extends GentrapTestAbstract("cufflinks_guided") class GentrapCufflinksGuidedTest extends GentrapTestAbstract("cufflinks_guided", None)
class GentrapCufflinksBlindTest extends GentrapTestAbstract("cufflinks_blind") class GentrapCufflinksBlindTest extends GentrapTestAbstract("cufflinks_blind", None)
object GentrapTest { object GentrapTest {
val outputDir = Files.createTempDir() val outputDir = Files.createTempDir()
......
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