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
0bca2e4f
Commit
0bca2e4f
authored
Feb 10, 2016
by
Sander Bollen
Browse files
fix #273
parent
712422bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/VcfFilter.scala
View file @
0bca2e4f
...
...
@@ -103,7 +103,7 @@ object VcfFilter extends ToolCommand {
opt
[
String
](
"mustHaveGenotype"
)
unbounded
()
valueName
"<sample:genotype>"
action
{
(
x
,
c
)
=>
c
.
copy
(
mustHaveGenotype
=
(
x
.
split
(
":"
)(
0
),
GenotypeType
.
valueOf
(
x
.
split
(
":"
)(
1
)))
::
c
.
mustHaveGenotype
)
}
validate
{
x
=>
if
(
x
.
split
(
":"
).
length
==
2
&&
GenotypeType
.
values
().
contains
(
x
.
split
(
":"
)(
1
)))
success
if
(
x
.
split
(
":"
).
length
==
2
&&
GenotypeType
.
values
().
map
(
_
.
toString
).
contains
(
x
.
split
(
":"
)(
1
)))
success
else
failure
(
"--mustHaveGenotype should be in this format: sample:genotype"
)
}
text
"Must have genotoype <genotype> for this sample. Genotype can be "
+
GenotypeType
.
values
().
mkString
(
", "
)
opt
[
String
](
"diffGenotype"
)
unbounded
()
valueName
"<sample:sample>"
action
{
(
x
,
c
)
=>
...
...
public/biopet-tools/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala
View file @
0bca2e4f
...
...
@@ -67,6 +67,18 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers {
main
(
arguments
)
}
@Test
def
testMustHaveGenotypes
()
=
{
/**
* This should simply not raise an exception
*/
val
tmp
=
File
.
createTempFile
(
"VCfFilter"
,
".vcf.gz"
)
tmp
.
deleteOnExit
()
val
tmp_path
=
tmp
.
getAbsolutePath
val
arguments
:
Array
[
String
]
=
Array
(
"-I"
,
vepped_path
,
"-o"
,
tmp_path
,
"--mustHaveGenotype"
,
"Sample_101:HET"
)
main
(
arguments
)
}
@Test
def
testHasGenotype
()
=
{
val
reader
=
new
VCFFileReader
(
vepped
,
false
)
val
record
=
reader
.
iterator
().
next
()
...
...
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