From ffa834681aff5535ec03215158a0ea7336693bf9 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Fri, 25 Mar 2016 17:32:22 +0100
Subject: [PATCH] Added output file to snptest

---
 .../nl/lumc/sasc/biopet/extensions/Snptest.scala     |  8 ++++----
 .../sasc/biopet/pipelines/gwastest/GwasTest.scala    |  3 ++-
 .../pipelines/gwastest/impute/ImputeOutput.scala     | 12 ++++--------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Snptest.scala b/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Snptest.scala
index 24ff7f029..9d43e04e7 100644
--- a/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Snptest.scala
+++ b/public/biopet-extensions/src/main/scala/nl/lumc/sasc/biopet/extensions/Snptest.scala
@@ -2,15 +2,15 @@ package nl.lumc.sasc.biopet.extensions
 
 import java.io.File
 
-import nl.lumc.sasc.biopet.core.{Version, Reference, BiopetCommandLineFunction}
+import nl.lumc.sasc.biopet.core.{ Version, Reference, BiopetCommandLineFunction }
 import nl.lumc.sasc.biopet.utils.config.Configurable
-import org.broadinstitute.gatk.utils.commandline.{Output, Input}
+import org.broadinstitute.gatk.utils.commandline.{ Output, Input }
 
 import scala.util.matching.Regex
 
 /**
-  * Created by pjvan_thof on 3/25/16.
-  */
+ * Created by pjvan_thof on 3/25/16.
+ */
 class Snptest(val root: Configurable) extends BiopetCommandLineFunction with Reference with Version {
   @Input(required = true)
   var inputGenotypes: List[File] = Nil
diff --git a/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTest.scala b/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTest.scala
index b18c3f6e2..ea8bc0b22 100644
--- a/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTest.scala
+++ b/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/GwasTest.scala
@@ -5,7 +5,7 @@ import java.util
 
 import htsjdk.samtools.reference.FastaSequenceFile
 import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, BiopetQScript }
-import nl.lumc.sasc.biopet.extensions.{Snptest, Cat}
+import nl.lumc.sasc.biopet.extensions.{ Snptest, Cat }
 import nl.lumc.sasc.biopet.extensions.gatk.{ SelectVariants, CombineVariants }
 import nl.lumc.sasc.biopet.extensions.tools.GensToVcf
 import nl.lumc.sasc.biopet.utils.Logging
@@ -104,6 +104,7 @@ class GwasTest(val root: Configurable) extends QScript with BiopetQScript with R
         val snptest = new Snptest(this)
         snptest.inputGenotypes :+= sv.outputFile
         snptest.inputSampleFiles :+= phenotypeFile
+        snptest.outputFile = Some(new File(regionDir, s"${region.chr}-${region.start + 1}-${region.end}.snptest"))
         add(snptest)
         region -> snptest
       }
diff --git a/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/ImputeOutput.scala b/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/ImputeOutput.scala
index 5beda972d..41574f0cd 100644
--- a/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/ImputeOutput.scala
+++ b/public/gwas-test/src/main/scala/nl/lumc/sasc/biopet/pipelines/gwastest/impute/ImputeOutput.scala
@@ -58,21 +58,17 @@ object ImputeOutput {
       else if (summaryLines.contains(NO_TYPE_2)) {
         Logging.logger.warn(s"No Type 2 SNPs found, skipping this chunk: '${chunk.summary}'")
         None
-      }
-      else if (summaryLines.exists(ASSESSMENT_HEADER.findFirstIn(_).isDefined)) None
+      } else if (summaryLines.exists(ASSESSMENT_HEADER.findFirstIn(_).isDefined)) None
       else if (!chunk.gens.exists()) {
         addError(s"Gens file '${chunk.gens}' does not exist, please check Impute output")
         None
-      }
-      else if (!chunk.gensInfo.exists()) {
+      } else if (!chunk.gensInfo.exists()) {
         addError(s"GensInfo file '${chunk.gensInfo}' does not exist, please check Impute output")
         None
-      }
-      else if (!chunk.gensInfoBySample.exists()) {
+      } else if (!chunk.gensInfoBySample.exists()) {
         addError(s"GensInfoBySample file '${chunk.gensInfoBySample}' does not exist, please check Impute output")
         None
-      }
-      else {
+      } else {
         if (!summaryLines.contains(CORRECT_LOG)) {
           Logging.logger.warn(s"Impute says it did not run but the gens files are there, pipeline will still continue")
           Logging.logger.warn(s"      Please check: ${chunk.summary}")
-- 
GitLab