From e8b95688f79187a484d5b8f5c02720ba04970519 Mon Sep 17 00:00:00 2001 From: Sander Bollen <a.h.b.bollen@lumc.nl> Date: Wed, 13 Jul 2016 17:08:11 +0200 Subject: [PATCH] fix for #372 --- .../variantcallers/HaplotypeCallerGvcf.scala | 4 +-- .../HaploTypeCallerGvcfTest.scala | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala diff --git a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaplotypeCallerGvcf.scala b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaplotypeCallerGvcf.scala index 1228520fc..2e4d5c822 100644 --- a/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaplotypeCallerGvcf.scala +++ b/shiva/src/main/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaplotypeCallerGvcf.scala @@ -42,13 +42,13 @@ class HaplotypeCallerGvcf(val root: Configurable) extends Variantcaller { ) def biopetScript() { - val gvcfFiles = for ((sample, inputBam) <- inputBams) yield { + gVcfFiles = for ((sample, inputBam) <- inputBams) yield { val hc = gatk.HaplotypeCaller(this, List(inputBam), new File(outputDir, sample + ".gvcf.vcf.gz")) add(hc) sample -> hc.out } - val genotypeGVCFs = gatk.GenotypeGVCFs(this, gvcfFiles.values.toList, outputFile) + val genotypeGVCFs = gatk.GenotypeGVCFs(this, gVcfFiles.values.toList, outputFile) add(genotypeGVCFs) } } diff --git a/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala b/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala new file mode 100644 index 000000000..820efe247 --- /dev/null +++ b/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala @@ -0,0 +1,33 @@ +package nl.lumc.sasc.biopet.pipelines.shiva.variantcallers + +import java.io.File + +import org.scalatest.Matchers +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +/** + * Created by Sander Bollen on 13-7-16. + */ +class HaploTypeCallerGvcfTest extends TestNGSuite with Matchers { + + @Test + def testGvcfFiles = { + val samples = List("sample01", "sample02", "sample03") + val hc = new HaplotypeCallerGvcf(null) + hc.inputBams = createInputMap(samples) + hc.biopetScript() + + hc.getGvcfs.size shouldBe 3 + hc.getGvcfs.keys.toList shouldEqual samples + } + + def createInputMap(samples: List[String]): Map[String, File] = { + samples map { x => + val file = File.createTempFile(x, ".bam") + file.deleteOnExit() + x -> file + } toMap + } + +} -- GitLab