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
9a5d5343
Commit
9a5d5343
authored
Sep 08, 2015
by
Sander Bollen
Browse files
validation of wiggle track options
parent
9a9f6f66
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/tools/VcfStats.scala
View file @
9a5d5343
...
...
@@ -136,6 +136,14 @@ object VcfStats extends ToolCommand {
generalWiggle
:
List
[
String
]
=
Nil
,
genotypeWiggle
:
List
[
String
]
=
Nil
)
extends
AbstractArgs
private
val
generalWiggleOptions
=
List
(
"Total"
,
"Biallelic"
,
"ComplexIndel"
,
"Filtered"
,
"FullyDecoded"
,
"Indel"
,
"Mixed"
,
"MNP"
,
"MonomorphicInSamples"
,
"NotFiltered"
,
"PointEvent"
,
"PolymorphicInSamples"
,
"SimpleDeletion"
,
"SimpleInsertion"
,
"SNP"
,
"StructuralIndel"
,
"Symbolic"
,
"SymbolicOrSV"
,
"Variant"
)
private
val
genotypeWiggleOptions
=
List
(
"Total"
,
"Het"
,
"HetNonRef"
,
"Hom"
,
"HomRef"
,
"HomVar"
,
"Mixed"
,
"NoCall"
,
"NonInformative"
,
"Available"
,
"Called"
,
"Filtered"
,
"Variant"
)
/** Parsing commandline arguments */
class
OptParser
extends
AbstractOptParser
{
opt
[
File
](
'I'
,
"inputFile"
)
required
()
unbounded
()
maxOccurs
1
valueName
"<file>"
action
{
(
x
,
c
)
=>
...
...
@@ -176,7 +184,9 @@ object VcfStats extends ToolCommand {
}
text
"Write bin statistics. Default False"
opt
[
String
](
"generalWiggle"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
generalWiggle
=
x
::
c
.
generalWiggle
,
writeBinStats
=
true
)
}
text
}
validate
{
x
=>
if
(
generalWiggleOptions
.
contains
(
x
))
success
else
failure
(
s
"""Nonexistent field $x"""
)
}
text
"""
|Create a wiggle track with bin size <binSize> for any of the following statistics:
|Total
...
...
@@ -201,6 +211,8 @@ object VcfStats extends ToolCommand {
"""
.
stripMargin
opt
[
String
](
"genotypeWiggle"
)
unbounded
()
action
{
(
x
,
c
)
=>
c
.
copy
(
genotypeWiggle
=
x
::
c
.
genotypeWiggle
,
writeBinStats
=
true
)
}
validate
{
x
=>
if
(
genotypeWiggleOptions
.
contains
(
x
))
success
else
failure
(
s
"""Non-existent field $x"""
)
}
text
"""
|Create a wiggle track with bin size <binSize> for any of the following genotype fields:
...
...
public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/VcfStatsTest.scala
View file @
9a5d5343
...
...
@@ -222,6 +222,24 @@ class VcfStatsTest extends TestNGSuite with Matchers {
tmp
.
toAbsolutePath
.
toString
,
"--binSize"
,
"50"
,
"--writeBinStats"
,
"--generalWiggle"
,
x
))
)
// returns null when validation fails
def
validateArgs
(
array
:
Array
[
String
])
:
Option
[
Args
]
=
{
val
argsParser
=
new
OptParser
argsParser
.
parse
(
array
,
Args
())
}
validateArgs
(
Array
(
"-I"
,
vcf
,
"-R"
,
ref
,
"-o"
,
tmp
.
toAbsolutePath
.
toString
,
"--binSize"
,
"50"
,
"--writeBinStats"
,
"--genotypeWiggle"
,
"NonexistentThing"
))
shouldBe
empty
validateArgs
(
Array
(
"-I"
,
vcf
,
"-R"
,
ref
,
"-o"
,
tmp
.
toAbsolutePath
.
toString
,
"--binSize"
,
"50"
,
"--writeBinStats"
,
"--generalWiggle"
,
"NonexistentThing"
))
shouldBe
empty
validateArgs
(
Array
(
"-R"
,
ref
,
"-o"
,
tmp
.
toAbsolutePath
.
toString
))
shouldBe
empty
}
@Test
...
...
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