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
9b8ddc12
Commit
9b8ddc12
authored
May 23, 2016
by
Peter van 't Hof
Browse files
Added more filter options
parent
9139289c
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfFilter.scala
View file @
9b8ddc12
...
...
@@ -51,6 +51,8 @@ object VcfFilter extends ToolCommand {
trioLossOfHet
:
List
[
Trio
]
=
Nil
,
diffGenotype
:
List
[(
String
,
String
)]
=
Nil
,
filterHetVarToHomVar
:
List
[(
String
,
String
)]
=
Nil
,
uniqueOnly
:
Boolean
=
false
,
sharedOnly
:
Boolean
=
false
,
filterRefCalls
:
Boolean
=
false
,
filterNoCalls
:
Boolean
=
false
,
iDset
:
Set
[
String
]
=
Set
(),
...
...
@@ -119,6 +121,12 @@ object VcfFilter extends ToolCommand {
opt
[
Unit
](
"filterNoCalls"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
filterNoCalls
=
true
)
}
text
"Filter when there are only no calls"
opt
[
Unit
](
"uniqueOnly"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
uniqueOnly
=
true
)
}
text
"Filter when there more then 1 sample have this variant"
opt
[
Unit
](
"sharedOnly"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
sharedOnly
=
true
)
}
text
"Filter when not all samples have this variant"
opt
[
Double
](
"minQualScore"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
minQualScore
=
Some
(
x
))
}
text
"Min qual score"
...
...
@@ -161,6 +169,8 @@ object VcfFilter extends ToolCommand {
if
(
cmdArgs
.
minQualScore
.
map
(
minQualscore
(
record
,
_
)).
getOrElse
(
true
)
&&
(!
cmdArgs
.
filterRefCalls
||
hasNonRefCalls
(
record
))
&&
(!
cmdArgs
.
filterNoCalls
||
hasCalls
(
record
))
&&
(!
cmdArgs
.
uniqueOnly
||
hasUniqeSample
(
record
))
&&
(!
cmdArgs
.
sharedOnly
||
allSamplesVariant
(
record
))
&&
hasMinTotalDepth
(
record
,
cmdArgs
.
minTotalDepth
)
&&
hasMinSampleDepth
(
record
,
cmdArgs
.
minSampleDepth
,
cmdArgs
.
minSamplesPass
)
&&
minAlternateDepth
(
record
,
cmdArgs
.
minAlternateDepth
,
cmdArgs
.
minSamplesPass
)
&&
...
...
@@ -234,6 +244,16 @@ object VcfFilter extends ToolCommand {
record
.
getGenotypes
.
exists
(
g
=>
!
g
.
isNoCall
)
}
/** Checks if there is a variant in only 1 sample */
def
hasUniqeSample
(
record
:
VariantContext
)
:
Boolean
=
{
record
.
getGenotypes
.
count
(
_
.
getAlleles
.
exists
(
a
=>
a
.
isNonReference
&&
!
a
.
isNoCall
))
==
1
}
/** Checks if all samples are a variant */
def
allSamplesVariant
(
record
:
VariantContext
)
:
Boolean
=
{
record
.
getGenotypes
.
forall
(
_
.
getAlleles
.
exists
(
a
=>
a
.
isNonReference
&&
!
a
.
isNoCall
))
}
/** returns true when DP INFO field is atleast the given value */
def
hasMinTotalDepth
(
record
:
VariantContext
,
minTotalDepth
:
Int
)
:
Boolean
=
{
record
.
getAttributeAsInt
(
"DP"
,
-
1
)
>=
minTotalDepth
...
...
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