diff --git a/public/biopet-tools/src/test/resources/gens.samples b/public/biopet-tools/src/test/resources/gens.samples new file mode 100644 index 0000000000000000000000000000000000000000..1789a409e45a4b78fd83d84808c60e5ba9a494f7 --- /dev/null +++ b/public/biopet-tools/src/test/resources/gens.samples @@ -0,0 +1,5 @@ +ID_1 ID_2 missing hip knee hand knee_or_hip sex age bmi +0 0 0 D D D D D P P +sample-1 fam-1 0.0 2 NA 2 2 1 59.0767123287671 27.1314117909924 +sample-2 fam-1 0.0 2 NA NA 2 2 48.4958904109589 23.8754325259516 +sample-3 fam-1 0.0 NA NA NA NA 2 57.0876712328767 45.8842609074008 diff --git a/public/biopet-tools/src/test/resources/test.gens b/public/biopet-tools/src/test/resources/test.gens new file mode 100644 index 0000000000000000000000000000000000000000..bec79dab840537cac62c1c009391297ae38e6fee --- /dev/null +++ b/public/biopet-tools/src/test/resources/test.gens @@ -0,0 +1,3 @@ +--- rs1 30 A C 1 0 0 0 1 0 0 0 1 +--- rs2 40 A - 1 0 0 0 1 0 0 0 1 +--- rs3 50 A AT 1 0 0 0 1 0 0 0 1 \ No newline at end of file diff --git a/public/biopet-tools/src/test/resources/test.gens_info b/public/biopet-tools/src/test/resources/test.gens_info new file mode 100644 index 0000000000000000000000000000000000000000..250a9677f1bf86cff13d7dee2eba0b9878963b8b --- /dev/null +++ b/public/biopet-tools/src/test/resources/test.gens_info @@ -0,0 +1,4 @@ +snp_id rs_id position exp_freq_a1 info certainty type info_type0 concord_type0 r2_type0 +--- rs1 30 0.037 0.535 0.958 0 -1 -1 -1 +--- rs2 40 0.023 0.621 0.978 0 -1 -1 -1 +--- rs3 50 0.000 0.114 0.999 0 -1 -1 -1 diff --git a/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/GensToVcfTest.scala b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/GensToVcfTest.scala new file mode 100644 index 0000000000000000000000000000000000000000..01a196a79fc3003fa9a023396da7eceb964e9afb --- /dev/null +++ b/public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/GensToVcfTest.scala @@ -0,0 +1,48 @@ +package nl.lumc.sasc.biopet.tools + +import java.io.File +import java.nio.file.Paths + +import org.scalatest.Matchers +import org.scalatest.testng.TestNGSuite +import org.testng.annotations.Test + +/** + * Created by pjvan_thof on 4/11/16. + */ +class GensToVcfTest extends TestNGSuite with Matchers { + @Test + def testGensOnly: Unit = { + val output = File.createTempFile("test.", ".vcf.gz") + GensToVcf.main(Array( + "--inputGenotypes", GensToVcfTest.resourcePath("/test.gens"), + "--outputVcf", output.getAbsolutePath, + "--referenceFasta", GensToVcfTest.resourcePath("/fake_chrQ.fa"), + "--contig", "chrQ", + "--samplesFile", GensToVcfTest.resourcePath("/gens.samples") + )) + } + + @Test + def testGensInfo: Unit = { + val output = File.createTempFile("test.", ".vcf.gz") + GensToVcf.main(Array( + "--inputGenotypes", GensToVcfTest.resourcePath("/test.gens"), + "--inputInfo", GensToVcfTest.resourcePath("/test.gens_info"), + "--outputVcf", output.getAbsolutePath, + "--referenceFasta", GensToVcfTest.resourcePath("/fake_chrQ.fa"), + "--contig", "chrQ", + "--samplesFile", GensToVcfTest.resourcePath("/gens.samples"), + "--sortInput" + )) + } + +} + +object GensToVcfTest { + private def resourcePath(p: String): String = { + Paths.get(getClass.getResource(p).toURI).toString + } + + +}