Commit 0bca2e4f authored by Sander Bollen's avatar Sander Bollen
Browse files

fix #273

parent 712422bb
......@@ -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) =>
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment