From f58ba276d62000d4060577a8456ee4b53e38e9d8 Mon Sep 17 00:00:00 2001
From: Sander Bollen <a.h.b.bollen@lumc.nl>
Date: Thu, 10 Nov 2016 10:53:07 +0100
Subject: [PATCH] remove redundant imports, add scaladoc and autostyle fixes.

---
 .../lumc/sasc/biopet/tools/VcfWithVcf.scala   | 26 +++++++++++--------
 .../sasc/biopet/tools/VcfWithVcfTest.scala    |  4 +--
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfWithVcf.scala b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfWithVcf.scala
index 2eda5f4f0..ca6e077c7 100644
--- a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfWithVcf.scala
+++ b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfWithVcf.scala
@@ -17,10 +17,8 @@ package nl.lumc.sasc.biopet.tools
 import java.io.File
 import java.util
 
-import htsjdk.samtools.reference.FastaSequenceFile
 import htsjdk.variant.variantcontext.{ VariantContext, VariantContextBuilder }
 import htsjdk.variant.variantcontext.writer.{ AsyncVariantContextWriter, VariantContextWriterBuilder }
-import htsjdk.variant.vcf
 import htsjdk.variant.vcf._
 import nl.lumc.sasc.biopet.utils.{ FastaUtils, ToolCommand }
 import nl.lumc.sasc.biopet.utils.VcfUtils.scalaListToJavaObjectArrayList
@@ -190,7 +188,6 @@ object VcfWithVcf extends ToolCommand {
     }
   }
 
-
   def createRecord(fieldMap: Map[String, List[Any]], record: VariantContext,
                    fields: List[Fields], header: VCFHeader): VariantContext = {
     fieldMap.foldLeft(new VariantContextBuilder(record))((builder, attribute) => {
@@ -216,18 +213,18 @@ object VcfWithVcf extends ToolCommand {
   }
 
   /**
-    * Get the proper representation of a field from a secondary record given an original record
-    * @param record original record
-    * @param secondaryRecord secondary record
-    * @param field field
-    * @param header header of secondary record
-    * @return
-    */
+   * Get the proper representation of a field from a secondary record given an original record
+   * @param record original record
+   * @param secondaryRecord secondary record
+   * @param field field
+   * @param header header of secondary record
+   * @return
+   */
   def getSecondaryField(record: VariantContext, secondaryRecord: VariantContext, field: String, header: VCFHeader): Any = {
     header.getInfoHeaderLine(field).getCountType match {
       case VCFHeaderLineCount.A => numberA(record, secondaryRecord, field)
       case VCFHeaderLineCount.R => numberR(record, secondaryRecord, field)
-      case _ => secondaryRecord.getAttribute(field)
+      case _                    => secondaryRecord.getAttribute(field)
     }
   }
 
@@ -247,6 +244,13 @@ object VcfWithVcf extends ToolCommand {
       toList
   }
 
+  /**
+   * Get the correct values from a field that has number=R
+   * @param referenceRecord the reference record
+   * @param annotateRecord the to-be-annotated record
+   * @param field the field to annotate
+   * @return
+   */
   def numberR(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = {
     val refValues = referenceRecord.getAttributeAsList(field).toArray
     annotateRecord.
diff --git a/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala b/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
index 287b7ad24..42039af4c 100644
--- a/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
+++ b/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
@@ -236,9 +236,9 @@ class VcfWithVcfTest extends TestNGSuite with MockitoSugar with Matchers {
     main(arguments)
     val annotatedRecord = new VCFFileReader(tmpFile).iterator().next()
     annotatedRecord.getAttribute("MULTI_ALL_ALLELE") match {
-      case l: List[_] => l shouldBe List("C", "A")
+      case l: List[_]           => l shouldBe List("C", "A")
       case u: util.ArrayList[_] => u.toList shouldBe List("C", "A")
-      case _ => throw new IllegalStateException("Not a list")
+      case _                    => throw new IllegalStateException("Not a list")
     }
   }
 
-- 
GitLab