Commit f58ba276 authored by Sander Bollen's avatar Sander Bollen

remove redundant imports, add scaladoc and autostyle fixes.

parent 0065cfb1
......@@ -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.
......
......@@ -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")
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment