MergeAllelesTest.scala 2.34 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * 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
 *
 * A dual licensing mode is applied. The source code within this project that are
 * not part of GATK Queue is freely available for non-commercial use under an AGPL
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
16
17
package nl.lumc.sasc.biopet.tools

Sander Bollen's avatar
Sander Bollen committed
18
import java.io.File
19
20
21
22
23
24
25
26
27
28
import java.nio.file.Paths

import org.scalatest.Matchers
import org.scalatest.mock.MockitoSugar
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test

import scala.util.Random

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
 * Test class for [[MergeAlleles]]
 *
31
32
33
34
35
36
37
38
39
 * Created by ahbbollen on 10-4-15.
 */
class MergeAllelesTest extends TestNGSuite with MockitoSugar with Matchers {
  import MergeAlleles._

  private def resourcePath(p: String): String = {
    Paths.get(getClass.getResource(p).toURI).toString
  }

40
  val veppedPath = resourcePath("/chrQ.vcf.gz")
41
42
43
44
45
46
47
48
49
50
51
  val reference = resourcePath("/fake_chrQ.fa")

  // These two have to created
  // resourcepath copies files to another directory
  // hence we need to supply all needed files
  val dict = resourcePath("/fake_chrQ.dict")
  val fai = resourcePath("/fake_chrQ.fa.fai")

  val rand = new Random()

  @Test def testOutputTypeVcf() = {
Sander Bollen's avatar
Sander Bollen committed
52
53
    val tmp = File.createTempFile("MergeAlleles", ".vcf")
    tmp.deleteOnExit()
Sander van der Zeeuw's avatar
Sander van der Zeeuw committed
54
    val tmpPath = tmp.getAbsolutePath
55
    val arguments = Array("-I", veppedPath, "-o", tmpPath, "-R", reference)
56
57
58
59
    main(arguments)
  }

  @Test def testOutputTypeVcfGz() = {
Sander Bollen's avatar
Sander Bollen committed
60
61
    val tmp = File.createTempFile("MergeAlleles", ".vcf.gz")
    tmp.deleteOnExit()
Sander van der Zeeuw's avatar
Sander van der Zeeuw committed
62
    val tmpPath = tmp.getAbsolutePath
63
    val arguments = Array("-I", veppedPath, "-o", tmpPath, "-R", reference)
64
65
66
67
    main(arguments)
  }

  @Test def testOutputTypeBcf() = {
Sander Bollen's avatar
Sander Bollen committed
68
69
    val tmp = File.createTempFile("MergeAlleles", ".bcf")
    tmp.deleteOnExit()
Sander van der Zeeuw's avatar
Sander van der Zeeuw committed
70
    val tmpPath = tmp.getAbsolutePath
71
    val arguments = Array("-I", veppedPath, "-o", tmpPath, "-R", reference)
72
73
74
    main(arguments)
  }
}