Skip to content
Snippets Groups Projects
Commit f58ba276 authored by Sander Bollen's avatar Sander Bollen
Browse files

remove redundant imports, add scaladoc and autostyle fixes.

parent 0065cfb1
No related branches found
No related tags found
No related merge requests found
...@@ -17,10 +17,8 @@ package nl.lumc.sasc.biopet.tools ...@@ -17,10 +17,8 @@ package nl.lumc.sasc.biopet.tools
import java.io.File import java.io.File
import java.util import java.util
import htsjdk.samtools.reference.FastaSequenceFile
import htsjdk.variant.variantcontext.{ VariantContext, VariantContextBuilder } import htsjdk.variant.variantcontext.{ VariantContext, VariantContextBuilder }
import htsjdk.variant.variantcontext.writer.{ AsyncVariantContextWriter, VariantContextWriterBuilder } import htsjdk.variant.variantcontext.writer.{ AsyncVariantContextWriter, VariantContextWriterBuilder }
import htsjdk.variant.vcf
import htsjdk.variant.vcf._ import htsjdk.variant.vcf._
import nl.lumc.sasc.biopet.utils.{ FastaUtils, ToolCommand } import nl.lumc.sasc.biopet.utils.{ FastaUtils, ToolCommand }
import nl.lumc.sasc.biopet.utils.VcfUtils.scalaListToJavaObjectArrayList import nl.lumc.sasc.biopet.utils.VcfUtils.scalaListToJavaObjectArrayList
...@@ -190,7 +188,6 @@ object VcfWithVcf extends ToolCommand { ...@@ -190,7 +188,6 @@ object VcfWithVcf extends ToolCommand {
} }
} }
def createRecord(fieldMap: Map[String, List[Any]], record: VariantContext, def createRecord(fieldMap: Map[String, List[Any]], record: VariantContext,
fields: List[Fields], header: VCFHeader): VariantContext = { fields: List[Fields], header: VCFHeader): VariantContext = {
fieldMap.foldLeft(new VariantContextBuilder(record))((builder, attribute) => { fieldMap.foldLeft(new VariantContextBuilder(record))((builder, attribute) => {
...@@ -216,18 +213,18 @@ object VcfWithVcf extends ToolCommand { ...@@ -216,18 +213,18 @@ object VcfWithVcf extends ToolCommand {
} }
/** /**
* Get the proper representation of a field from a secondary record given an original record * Get the proper representation of a field from a secondary record given an original record
* @param record original record * @param record original record
* @param secondaryRecord secondary record * @param secondaryRecord secondary record
* @param field field * @param field field
* @param header header of secondary record * @param header header of secondary record
* @return * @return
*/ */
def getSecondaryField(record: VariantContext, secondaryRecord: VariantContext, field: String, header: VCFHeader): Any = { def getSecondaryField(record: VariantContext, secondaryRecord: VariantContext, field: String, header: VCFHeader): Any = {
header.getInfoHeaderLine(field).getCountType match { header.getInfoHeaderLine(field).getCountType match {
case VCFHeaderLineCount.A => numberA(record, secondaryRecord, field) case VCFHeaderLineCount.A => numberA(record, secondaryRecord, field)
case VCFHeaderLineCount.R => numberR(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 { ...@@ -247,6 +244,13 @@ object VcfWithVcf extends ToolCommand {
toList 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] = { def numberR(referenceRecord: VariantContext, annotateRecord: VariantContext, field: String): List[Any] = {
val refValues = referenceRecord.getAttributeAsList(field).toArray val refValues = referenceRecord.getAttributeAsList(field).toArray
annotateRecord. annotateRecord.
......
...@@ -236,9 +236,9 @@ class VcfWithVcfTest extends TestNGSuite with MockitoSugar with Matchers { ...@@ -236,9 +236,9 @@ class VcfWithVcfTest extends TestNGSuite with MockitoSugar with Matchers {
main(arguments) main(arguments)
val annotatedRecord = new VCFFileReader(tmpFile).iterator().next() val annotatedRecord = new VCFFileReader(tmpFile).iterator().next()
annotatedRecord.getAttribute("MULTI_ALL_ALLELE") match { 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 u: util.ArrayList[_] => u.toList shouldBe List("C", "A")
case _ => throw new IllegalStateException("Not a list") case _ => throw new IllegalStateException("Not a list")
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment