From 51f894334c4b497bd6472921ff5da45f32d838eb Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Mon, 11 Apr 2016 09:02:38 +0200
Subject: [PATCH] Added spec parsing unit test

---
 .../src/test/resources/specs/files.specs      | 26 +++++++++++++++++
 .../src/test/resources/specs/test.gens        |  0
 .../src/test/resources/specs/test.gens_info   |  0
 .../resources/specs/test.gens_info_by_sample  |  0
 .../test/resources/specs/test.gens_summary    |  0
 .../test/resources/specs/test.gens_warnings   |  0
 .../pipelines/gwastest/GwasTestTest.scala     | 29 +++++++++++++++++++
 7 files changed, 55 insertions(+)
 create mode 100644 public/gwas-test/src/test/resources/specs/files.specs
 create mode 100644 public/gwas-test/src/test/resources/specs/test.gens
 create mode 100644 public/gwas-test/src/test/resources/specs/test.gens_info
 create mode 100644 public/gwas-test/src/test/resources/specs/test.gens_info_by_sample
 create mode 100644 public/gwas-test/src/test/resources/specs/test.gens_summary
 create mode 100644 public/gwas-test/src/test/resources/specs/test.gens_warnings

diff --git a/public/gwas-test/src/test/resources/specs/files.specs b/public/gwas-test/src/test/resources/specs/files.specs
new file mode 100644
index 000000000..6385b4296
--- /dev/null
+++ b/public/gwas-test/src/test/resources/specs/files.specs
@@ -0,0 +1,26 @@
+{
+        files = (
+                {
+                        chromosome = "chrQ";
+                        name = "imputation_06/test";
+                        orig = "imputation_03/LLS_Offspring_Partners_Final_37_Overlap_chr1";
+                },
+                {
+                        chromosome = "chrQ";
+                        name = "imputation_06/test";
+                        orig = "imputation_03/LLS_Offspring_Partners_Final_37_Overlap_chr1";
+                },
+                {
+                        chromosome = "chrQ";
+                        name = "imputation_06/test";
+                        orig = "imputation_03/LLS_Offspring_Partners_Final_37_Overlap_chr22";
+                },
+                {
+                        chromosome = "chrQ";
+                        name = "imputation_06/test";
+                        orig = "imputation_03/LLS_Offspring_Partners_Final_37_Overlap_chr22";
+                }
+        );
+        jids = ( "2102064" );
+        type = "tped3col";
+}
\ No newline at end of file
diff --git a/public/gwas-test/src/test/resources/specs/test.gens b/public/gwas-test/src/test/resources/specs/test.gens
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/gwas-test/src/test/resources/specs/test.gens_info b/public/gwas-test/src/test/resources/specs/test.gens_info
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/gwas-test/src/test/resources/specs/test.gens_info_by_sample b/public/gwas-test/src/test/resources/specs/test.gens_info_by_sample
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/gwas-test/src/test/resources/specs/test.gens_summary b/public/gwas-test/src/test/resources/specs/test.gens_summary
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/gwas-test/src/test/resources/specs/test.gens_warnings b/public/gwas-test/src/test/resources/specs/test.gens_warnings
new file mode 100644
index 000000000..e69de29bb
diff --git a/public/gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala b/public/gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
index 23bf7b43c..01b098d6f 100644
--- a/public/gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
+++ b/public/gwas-test/src/test/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTestTest.scala
@@ -32,6 +32,35 @@ class GwasTestTest extends TestNGSuite with Matchers {
     pipeline.script()
   }
 
+  @Test
+  def testFromGens: Unit = {
+    val pipeline = initPipeline(GwasTestTest.config ++
+      Map("input_gens" -> List(Map("genotypes" -> GwasTestTest.vcfFile, "contig" -> "chrQ"))
+      )
+    )
+    pipeline.script()
+  }
+
+  @Test
+  def testWrongContig: Unit = {
+    val pipeline = initPipeline(GwasTestTest.config ++
+      Map("input_gens" -> List(Map("genotypes" -> GwasTestTest.vcfFile, "contig" -> "chrBla"))
+      )
+    )
+    intercept[IllegalStateException] {
+      pipeline.script()
+    }
+  }
+
+  @Test
+  def testFromSpecs: Unit = {
+    val pipeline = initPipeline(GwasTestTest.config ++
+      Map("imute_specs_file" -> GwasTestTest.resourcePath("/specs/files.specs"))
+    )
+    pipeline.script()
+  }
+
+
   @Test
   def testEmpty: Unit = {
     val pipeline = initPipeline(GwasTestTest.config)
-- 
GitLab