Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mirrors
biopet.biopet
Commits
f58ba276
Commit
f58ba276
authored
Nov 10, 2016
by
Sander Bollen
Browse files
remove redundant imports, add scaladoc and autostyle fixes.
parent
0065cfb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfWithVcf.scala
View file @
f58ba276
...
...
@@ -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
.
...
...
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfWithVcfTest.scala
View file @
f58ba276
...
...
@@ -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"
)
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment