Commit ec703d07 authored by bow's avatar bow
Browse files

Use Vector instead of Seq for multiple argument flag in WipeReads

parent f76745df
......@@ -58,19 +58,22 @@ object WipeReads {
=> parseOption(opts ++ Map("targetRegions" -> checkInputFile(new File(value))), tail)
case ("--outputBAM" | "-o") :: value :: tail if !opts.contains("outputBAM")
=> parseOption(opts ++ Map("outputBAM" -> new File(value)), tail)
// TODO: implementation
case ("--minOverlapFraction" | "-f") :: value :: tail if !opts.contains("minOverlapFraction")
=> parseOption(opts ++ Map("minOverlapFraction" -> value.toDouble), tail)
case ("--minMapQ" | "-Q") :: value :: tail if !opts.contains("minMapQ")
=> parseOption(opts ++ Map("minMapQ" -> value.toInt), tail)
case ("--strand" | "-s") :: (value @ ("plus" | "minus" | "ignore")) :: tail if !opts.contains("strand")
// TODO: implementation
case ("--strand" | "-s") :: (value @ ("identical" | "opposite" | "both")) :: tail if !opts.contains("strand")
=> parseOption(opts ++ Map("strand" -> Strand.withName(value.capitalize)), tail)
// TODO: implementation
case ("--makeIndex") :: tail
=> parseOption(opts ++ Map("makeIndex" -> true), tail)
case ("--limitToRegion" | "-limit") :: tail
=> parseOption(opts ++ Map("limitToRegion" -> true), tail)
// TODO: better way to parse multiple flag values?
case ("--readGroup" | "-RG") :: value :: tail if !opts.contains("readGroup")
=> parseOption(opts ++ Map("readGroup" -> value.split(",").toSeq), tail)
=> parseOption(opts ++ Map("readGroup" -> value.split(",").toVector), tail)
case option :: tail
=> throw new IllegalArgumentException("Unexpected or duplicate option flag: " + option)
}
......
......@@ -76,22 +76,22 @@ class WipeReadsUnitTest extends Assertions {
assert(opts("minMapQ") == 13)
}
@Test def testOptStrandPlus() = {
val argList = List("--strand", "plus") ::: minArgList
@Test def testOptStrandIdentical() = {
val argList = List("--strand", "identical") ::: minArgList
val opts = parseOption(Map(), argList)
assert(opts("strand") == Strand.Plus)
assert(opts("strand") == Strand.Identical)
}
@Test def testOptStrandMinus() = {
val argList = List("--strand", "minus") ::: minArgList
@Test def testOptStrandOpposite() = {
val argList = List("--strand", "opposite") ::: minArgList
val opts = parseOption(Map(), argList)
assert(opts("strand") == Strand.Minus)
assert(opts("strand") == Strand.Opposite)
}
@Test def testOptStrandIgnore() = {
val argList = List("--strand", "ignore") ::: minArgList
@Test def testOptStrandBoth() = {
val argList = List("--strand", "both") ::: minArgList
val opts = parseOption(Map(), argList)
assert(opts("strand") == Strand.Ignore)
assert(opts("strand") == Strand.Both)
}
@Test def testOptMakeIndex() = {
......@@ -109,13 +109,13 @@ class WipeReadsUnitTest extends Assertions {
@Test def testOptSingleReadGroup() = {
val argList = List("--readGroup", "g1") ::: minArgList
val opts = parseOption(Map(), argList)
assert(opts("readGroup") == Seq("g1"))
assert(opts("readGroup") == Vector("g1"))
}
@Test def testOptMultipleReadGroup() = {
val argList = List("--readGroup", "g1,g2") ::: minArgList
val opts = parseOption(Map(), argList)
assert(opts("readGroup") == Seq("g1", "g2"))
assert(opts("readGroup") == Vector("g1", "g2"))
}
}
......
Supports Markdown
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