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
aac5ea06
Commit
aac5ea06
authored
Sep 26, 2014
by
Peter van 't Hof
Browse files
Added filter on HET_REF
parent
20c57725
Changes
1
Hide whitespace changes
Inline
Side-by-side
biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/apps/VcfFilter.scala
View file @
aac5ea06
...
...
@@ -22,6 +22,7 @@ class VcfFilter(val root: Configurable) extends BiopetJavaCommandLineFunction {
var
minTotalDepth
:
Option
[
Int
]
=
_
var
minAlternateDepth
:
Option
[
Int
]
=
_
var
minSamplesPass
:
Option
[
Int
]
=
_
var
filterRefCalls
:
Boolean
=
_
override
val
defaultVmem
=
"8G"
memoryLimit
=
Option
(
4.0
)
...
...
@@ -31,6 +32,7 @@ class VcfFilter(val root: Configurable) extends BiopetJavaCommandLineFunction {
minTotalDepth
=
config
(
"min_total_depth"
)
minAlternateDepth
=
config
(
"min_alternate_depth"
)
minSamplesPass
=
config
(
"min_samples_pass"
)
filterRefCalls
=
config
(
"filter_ref_calls"
)
}
override
def
commandLine
=
super
.
commandLine
+
...
...
@@ -39,7 +41,8 @@ class VcfFilter(val root: Configurable) extends BiopetJavaCommandLineFunction {
optional
(
"-minSampleDepth"
,
minSampleDepth
)
+
optional
(
"-minTotalDepth"
,
minTotalDepth
)
+
optional
(
"-minAlternateDepth"
,
minAlternateDepth
)
+
optional
(
"-minSamplesPass"
,
minSamplesPass
)
optional
(
"-minSamplesPass"
,
minSamplesPass
)
+
conditional
(
filterRefCalls
,
"-filterRefCalls"
)
}
object
VcfFilter
{
...
...
@@ -49,6 +52,7 @@ object VcfFilter {
var
minTotalDepth
=
-
1
var
minAlternateDepth
=
-
1
var
minSamplesPass
=
0
var
filterRefCalls
=
false
/**
* @param args the command line arguments
*/
...
...
@@ -61,6 +65,7 @@ object VcfFilter {
case
"-minTotalDepth"
=>
minTotalDepth
=
args
(
t
+
1
).
toInt
case
"-minAlternateDepth"
=>
minAlternateDepth
=
args
(
t
+
1
).
toInt
case
"-minSamplesPass"
=>
minSamplesPass
=
args
(
t
+
1
).
toInt
case
"-filterRefCalls"
=>
filterRefCalls
=
true
case
_
=>
}
}
...
...
@@ -73,7 +78,8 @@ object VcfFilter {
for
(
record
<-
reader
)
{
val
genotypes
=
for
(
genotype
<-
record
.
getGenotypes
)
yield
{
genotype
.
getDP
>=
minSampleDepth
&&
List
(
genotype
.
getAD
:_
*
).
tail
.
count
(
_
>=
minAlternateDepth
)
>
0
List
(
genotype
.
getAD
:_
*
).
tail
.
count
(
_
>=
minAlternateDepth
)
>
0
&&
!(
filterRefCalls
&&
genotype
.
isHomRef
)
}
if
(
record
.
getAttributeAsInt
(
"DP"
,
-
1
)
>=
minTotalDepth
&&
genotypes
.
count
(
_
==
true
)
>=
minSamplesPass
)
...
...
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