VariantEffectPredictorTest.scala 2.57 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1 2 3 4 5 6 7 8 9 10
/**
 * Biopet is built on top of GATK Queue for building bioinformatic
 * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
 * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
 * should also be able to execute Biopet tools and pipelines.
 *
 * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
 *
 * Contact us at: sasc@lumc.nl
 *
11
 * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
Peter van 't Hof's avatar
Peter van 't Hof committed
12 13 14
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
Sander Bollen's avatar
Sander Bollen committed
15 16 17 18 19
package nl.lumc.sasc.biopet.extensions

import java.io.File
import java.nio.file.Paths

20
import nl.lumc.sasc.biopet.utils.ConfigUtils
Sander Bollen's avatar
Sander Bollen committed
21 22 23 24 25
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
26 27
 * Created by ahbbollen on 3-3-16.
 */
Sander Bollen's avatar
Sander Bollen committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
class VariantEffectPredictorTest extends TestNGSuite with Matchers {

  @Test
  def testSummaryStats = {
    val file = new File(Paths.get(getClass.getResource("/vep.metrics").toURI).toString)

    val vep = new VariantEffectPredictor(null)
    val stats = vep.parseStatsFile(file)

    stats.contains("VEP_run_statistics") shouldBe true
    stats.contains("General_statistics") shouldBe true
    stats.contains("Consequences_(most_severe)") shouldBe true
    stats.contains("Consequences_(all)") shouldBe true
    stats.contains("Coding_consequences") shouldBe true
    stats.contains("SIFT_summary") shouldBe true
    stats.contains("PolyPhen_summary") shouldBe true
    stats.contains("Variants_by_chromosome") shouldBe true
    stats.contains("Distribution_of_variants_on_chromosome_1") shouldBe true
    stats.contains("Position_in_protein") shouldBe true

  }

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
  @Test
  def testFailedSummaryStats = {
    val file = new File(Paths.get(getClass.getResource("/vep.failed.metrics").toURI).toString)

    val vep = new VariantEffectPredictor(null)
    val stats = vep.parseStatsFile(file)
  }

  @Test
  def testMergeFailSuccess: Unit = {
    val file1 = new File(Paths.get(getClass.getResource("/vep.metrics").toURI).toString)
    val vep1 = new VariantEffectPredictor(null)
    val stats1 = vep1.parseStatsFile(file1)

    val file2 = new File(Paths.get(getClass.getResource("/vep.failed.metrics").toURI).toString)
    val vep2 = new VariantEffectPredictor(null)
    val stats2 = vep2.parseStatsFile(file2)

    ConfigUtils.mergeMaps(stats1, stats2, vep1.resolveSummaryConflict)
    ConfigUtils.mergeMaps(stats2, stats1, vep1.resolveSummaryConflict)
  }

Sander Bollen's avatar
Sander Bollen committed
72
}