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
26243a6b
Commit
26243a6b
authored
Sep 27, 2016
by
Sander Bollen
Browse files
attempt fix for #386
parent
6efe0956
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfFilter.scala
View file @
26243a6b
...
...
@@ -16,10 +16,10 @@ package nl.lumc.sasc.biopet.tools
import
java.io.File
import
htsjdk.variant.variantcontext.
{
GenotypeType
,
VariantContext
}
import
htsjdk.variant.variantcontext.writer.
{
AsyncVariantContextWriter
,
VariantContextWriterBuilder
}
import
htsjdk.variant.variantcontext.
{
GenotypeType
,
VariantContext
}
import
htsjdk.variant.variantcontext.writer.
{
AsyncVariantContextWriter
,
VariantContextWriterBuilder
}
import
htsjdk.variant.vcf.VCFFileReader
import
nl.lumc.sasc.biopet.utils.ToolCommand
import
nl.lumc.sasc.biopet.utils.
{
ToolCommand
,
VcfUtils
}
import
scala.collection.JavaConversions._
import
scala.io.Source
...
...
@@ -315,11 +315,11 @@ object VcfFilter extends ToolCommand {
* Checks if given samples does have a variant hin this record
*
* @param record VCF record
* @param
mustHaveVariant
List of samples that should have this variant
* @param
samples
List of samples that should have this variant
* @return true if filter passed
*/
def
mustHaveVariant
(
record
:
VariantContext
,
mustHaveVariant
:
List
[
String
])
:
Boolean
=
{
!
mustHaveVariant
.
map
(
record
.
getGenotype
).
exists
(
a
=>
a
.
isHomRef
||
a
.
isNoCall
)
def
mustHaveVariant
(
record
:
VariantContext
,
samples
:
List
[
String
])
:
Boolean
=
{
!
samples
.
map
(
record
.
getGenotype
).
exists
(
a
=>
a
.
isHomRef
||
a
.
isNoCall
||
VcfUtils
.
isCompoundNoCall
(
a
)
)
}
/** Checks if given samples have the same genotype */
...
...
biopet-utils/src/main/scala/nl/lumc/sasc/biopet/utils/VcfUtils.scala
View file @
26243a6b
...
...
@@ -140,4 +140,13 @@ object VcfUtils {
reader
.
close
()
!
hasNext
}
/**
* Check whether genotype is of the from 0/.
* @param genotype genotype
* @return boolean
*/
def
isCompoundNoCall
(
genotype
:
Genotype
)
:
Boolean
=
{
!
genotype
.
isHetNonRef
&&
genotype
.
isMixed
&&
genotype
.
getAlleles
.
last
.
basesMatch
(
""
)
}
}
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