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
db6b6ffa
Commit
db6b6ffa
authored
May 25, 2016
by
Peter van 't Hof
Browse files
Fixed denovo filter
parent
37ae7b76
Changes
2
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfFilter.scala
View file @
db6b6ffa
...
...
@@ -49,7 +49,7 @@ object VcfFilter extends ToolCommand {
mustHaveVariant
:
List
[
String
]
=
Nil
,
calledIn
:
List
[
String
]
=
Nil
,
mustHaveGenotype
:
List
[(
String
,
GenotypeType
)]
=
Nil
,
deNovo
InSample
:
String
=
null
,
uniqueVariant
InSample
:
String
=
null
,
resToDom
:
List
[
Trio
]
=
Nil
,
trioCompound
:
List
[
Trio
]
=
Nil
,
deNovoTrio
:
List
[
Trio
]
=
Nil
,
...
...
@@ -90,7 +90,7 @@ object VcfFilter extends ToolCommand {
c
.
copy
(
trioCompound
=
new
Trio
(
x
)
::
c
.
trioCompound
)
}
text
"Only shows variants where child is a compound variant combined from both parants"
opt
[
String
](
"deNovoInSample"
)
maxOccurs
1
unbounded
()
valueName
"<sample>"
action
{
(
x
,
c
)
=>
c
.
copy
(
deNovo
InSample
=
x
)
c
.
copy
(
uniqueVariant
InSample
=
x
)
}
text
"Only show variants that contain unique alleles in complete set for given sample"
opt
[
String
](
"deNovoTrio"
)
unbounded
()
valueName
"<child:father:mother>"
action
{
(
x
,
c
)
=>
c
.
copy
(
deNovoTrio
=
new
Trio
(
x
)
::
c
.
deNovoTrio
)
...
...
@@ -186,7 +186,7 @@ object VcfFilter extends ToolCommand {
cmdArgs
.
filterHetVarToHomVar
.
isEmpty
||
cmdArgs
.
filterHetVarToHomVar
.
forall
(
x
=>
filterHetVarToHomVar
(
record
,
x
.
_1
,
x
.
_2
))
)
&&
denovo
InSample
(
record
,
cmdArgs
.
deNovoInSample
)
&&
uniqueVariant
InSample
(
record
,
cmdArgs
.
deNovoInSample
)
&&
denovoTrio
(
record
,
cmdArgs
.
deNovoTrio
)
&&
denovoTrio
(
record
,
cmdArgs
.
trioLossOfHet
,
onlyLossHet
=
true
)
&&
resToDom
(
record
,
cmdArgs
.
resToDom
)
&&
...
...
@@ -208,6 +208,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if given samples are called
*
* @param record VCF record
* @param samples Samples that need this sample to be called
* @return false when filters fail
...
...
@@ -219,6 +220,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if given genotypes for given samples are there
*
* @param record VCF record
* @param samplesGenotypes samples and their associated genotypes to be checked (of format sample:genotype)
* @return false when filter fails
...
...
@@ -229,6 +231,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if record has atleast minQualScore
*
* @param record VCF record
* @param minQualScore Minimal quality score
* @return false when filters fail
...
...
@@ -249,7 +252,7 @@ object VcfFilter extends ToolCommand {
/** Checks if there is a variant in only 1 sample */
def
hasUniqeSample
(
record
:
VariantContext
)
:
Boolean
=
{
record
.
get
Genotypes
.
count
(
g
=>
!
g
.
isNonInformative
&&
g
.
getAlleles
.
exists
(
a
=>
a
.
isNonReference
&&
!
a
.
isNoCall
))
==
1
record
.
get
SampleNames
.
exists
(
uniqueVariantInSample
(
record
,
_
))
}
/** Checks if all samples are a variant */
...
...
@@ -264,6 +267,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if DP genotype field have a minimal value
*
* @param record VCF record
* @param minSampleDepth minimal depth
* @param minSamplesPass Minimal number of samples to pass filter
...
...
@@ -278,6 +282,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if non-ref AD genotype field have a minimal value
*
* @param record VCF record
* @param minAlternateDepth minimal depth
* @param minSamplesPass Minimal number of samples to pass filter
...
...
@@ -292,6 +297,7 @@ object VcfFilter extends ToolCommand {
/**
* Checks if genome quality field has minimum value
*
* @param record VCF record
* @param minGQ smallest GQ allowed
* @param minSamplesPass number of samples to consider
...
...
@@ -306,6 +312,7 @@ 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
* @return true if filter passed
...
...
@@ -335,11 +342,11 @@ object VcfFilter extends ToolCommand {
}
/** Checks if given sample have alternative alleles that are unique in the VCF record */
def
denovo
InSample
(
record
:
VariantContext
,
sample
:
String
)
:
Boolean
=
{
def
uniqueVariant
InSample
(
record
:
VariantContext
,
sample
:
String
)
:
Boolean
=
{
if
(
sample
==
null
)
return
true
val
genotype
=
record
.
getGenotype
(
sample
)
if
(
genotype
.
isNoCall
)
return
false
for
(
allele
<-
genotype
.
getAlleles
)
{
for
(
allele
<-
genotype
.
getAlleles
if
allele
.
isNonReference
)
{
for
(
g
<-
record
.
getGenotypes
if
g
.
getSampleName
!=
sample
)
{
if
(
g
.
getAlleles
.
exists
(
_
.
basesMatch
(
allele
)))
return
false
}
...
...
biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala
View file @
db6b6ffa
...
...
@@ -210,9 +210,9 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers {
val
reader
=
new
VCFFileReader
(
vepped
,
false
)
val
record
=
reader
.
iterator
().
next
()
denovo
InSample
(
record
,
"Sample_101"
)
shouldBe
false
denovo
InSample
(
record
,
"Sample_102"
)
shouldBe
false
denovo
InSample
(
record
,
"Sample_103"
)
shouldBe
false
uniqueVariant
InSample
(
record
,
"Sample_101"
)
shouldBe
false
uniqueVariant
InSample
(
record
,
"Sample_102"
)
shouldBe
false
uniqueVariant
InSample
(
record
,
"Sample_103"
)
shouldBe
false
}
@Test
def
testResToDom
()
=
{
...
...
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