BedToolsTest.scala 797 Bytes
Newer Older
Sander Bollen's avatar
Sander Bollen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
package nl.lumc.sasc.biopet.extensions

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

import nl.lumc.sasc.biopet.extensions.bedtools.BedtoolsCoverage
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test

import scala.io.Source

/**
  * Created by Sander Bollen on 12-5-16.
  */
class BedToolsTest extends TestNGSuite with Matchers {

  @Test
  def testBedtoolsCoverageCreateGenomeFile() = {
    val file = new File(Paths.get(this.getClass.getResource("/ref.fa.fai").toURI).toString)
    val cov = new BedtoolsCoverage(null)
    val tmp = File.createTempFile("test", ".bed")
    tmp.deleteOnExit()
    cov.output = tmp
    val genome = cov.createGenomeFile(file)

    Source.fromFile(genome).getLines().mkString("\n") shouldBe "chr1\t9"
  }

}