Commit e7ed7e5f authored by Sander Bollen's avatar Sander Bollen
Browse files

camelCase for arguments in VcfFilter. See issue #153

parent 23c3057d
...@@ -42,7 +42,7 @@ Usage: VcfFilter [options] ...@@ -42,7 +42,7 @@ Usage: VcfFilter [options]
Filter when there are only ref calls Filter when there are only ref calls
--filterNoCalls --filterNoCalls
Filter when there are only no calls Filter when there are only no calls
--minQualscore <value> --minQualScore <value>
Min qual score Min qual score
~~~ ~~~
......
...@@ -59,14 +59,14 @@ object VcfFilter extends ToolCommand { ...@@ -59,14 +59,14 @@ object VcfFilter extends ToolCommand {
case class Args(inputVcf: File = null, case class Args(inputVcf: File = null,
outputVcf: File = null, outputVcf: File = null,
invertedOutputVcf: Option[File] = None, invertedOutputVcf: Option[File] = None,
minQualscore: Option[Double] = None, minQualScore: Option[Double] = None,
minSampleDepth: Int = -1, minSampleDepth: Int = -1,
minTotalDepth: Int = -1, minTotalDepth: Int = -1,
minAlternateDepth: Int = -1, minAlternateDepth: Int = -1,
minSamplesPass: Int = 0, minSamplesPass: Int = 0,
minBamAlternateDepth: Int = 0, minBamAlternateDepth: Int = 0,
mustHaveVariant: List[String] = Nil, mustHaveVariant: List[String] = Nil,
denovoInSample: String = null, deNovoInSample: String = null,
diffGenotype: List[(String, String)] = Nil, diffGenotype: List[(String, String)] = Nil,
filterHetVarToHomVar: List[(String, String)] = Nil, filterHetVarToHomVar: List[(String, String)] = Nil,
filterRefCalls: Boolean = false, filterRefCalls: Boolean = false,
...@@ -98,8 +98,8 @@ object VcfFilter extends ToolCommand { ...@@ -98,8 +98,8 @@ object VcfFilter extends ToolCommand {
opt[Int]("minBamAlternateDepth") unbounded () valueName ("<int>") action { (x, c) => opt[Int]("minBamAlternateDepth") unbounded () valueName ("<int>") action { (x, c) =>
c.copy(minBamAlternateDepth = x) c.copy(minBamAlternateDepth = x)
} // TODO: Convert this to more generic filter } // TODO: Convert this to more generic filter
opt[String]("denovoInSample") maxOccurs (1) unbounded () valueName ("<sample>") action { (x, c) => opt[String]("deNovoInSample") maxOccurs (1) unbounded () valueName ("<sample>") action { (x, c) =>
c.copy(denovoInSample = x) c.copy(deNovoInSample = x)
} text ("Only show variants that contain unique alleles in complete set for given sample") } text ("Only show variants that contain unique alleles in complete set for given sample")
opt[String]("mustHaveVariant") unbounded () valueName ("<sample>") action { (x, c) => opt[String]("mustHaveVariant") unbounded () valueName ("<sample>") action { (x, c) =>
c.copy(mustHaveVariant = x :: c.mustHaveVariant) c.copy(mustHaveVariant = x :: c.mustHaveVariant)
...@@ -118,13 +118,13 @@ object VcfFilter extends ToolCommand { ...@@ -118,13 +118,13 @@ object VcfFilter extends ToolCommand {
opt[Unit]("filterNoCalls") unbounded () action { (x, c) => opt[Unit]("filterNoCalls") unbounded () action { (x, c) =>
c.copy(filterNoCalls = true) c.copy(filterNoCalls = true)
} text ("Filter when there are only no calls") } text ("Filter when there are only no calls")
opt[Double]("minQualscore") unbounded () action { (x, c) => opt[Double]("minQualScore") unbounded () action { (x, c) =>
c.copy(minQualscore = Some(x)) c.copy(minQualScore = Some(x))
} text ("Min qual score") } text ("Min qual score")
opt[String]("id") unbounded () action { (x, c) => opt[String]("id") unbounded () action { (x, c) =>
c.copy(iDset = c.iDset + x) c.copy(iDset = c.iDset + x)
} text ("Id that may pass the filter") } text ("Id that may pass the filter")
opt[File]("id-file") unbounded () action { (x, c) => opt[File]("idFile") unbounded () action { (x, c) =>
c.copy(iDset = c.iDset ++ Source.fromFile(x).getLines()) c.copy(iDset = c.iDset ++ Source.fromFile(x).getLines())
} text ("File that contain list of IDs to get from vcf file") } text ("File that contain list of IDs to get from vcf file")
} }
...@@ -183,8 +183,8 @@ object VcfFilter extends ToolCommand { ...@@ -183,8 +183,8 @@ object VcfFilter extends ToolCommand {
} }
def minQualscore(record: VariantContext): Boolean = { def minQualscore(record: VariantContext): Boolean = {
if (commandArgs.minQualscore.isEmpty) return true if (commandArgs.minQualScore.isEmpty) return true
record.getPhredScaledQual >= commandArgs.minQualscore.get record.getPhredScaledQual >= commandArgs.minQualScore.get
} }
def filterRefCalls(record: VariantContext): Boolean = { def filterRefCalls(record: VariantContext): Boolean = {
...@@ -263,10 +263,10 @@ object VcfFilter extends ToolCommand { ...@@ -263,10 +263,10 @@ object VcfFilter extends ToolCommand {
} }
def denovoInSample(record: VariantContext): Boolean = { def denovoInSample(record: VariantContext): Boolean = {
if (commandArgs.denovoInSample == null) return true if (commandArgs.deNovoInSample == null) return true
val genotype = record.getGenotype(commandArgs.denovoInSample) val genotype = record.getGenotype(commandArgs.deNovoInSample)
for (allele <- genotype.getAlleles if allele.isNonReference) { for (allele <- genotype.getAlleles if allele.isNonReference) {
for (g <- record.getGenotypes if g.getSampleName != commandArgs.denovoInSample) { for (g <- record.getGenotypes if g.getSampleName != commandArgs.deNovoInSample) {
if (g.getAlleles.exists(_.basesMatch(allele))) return false if (g.getAlleles.exists(_.basesMatch(allele))) return false
} }
} }
......
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