Commit b8b57869 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added resToDom option

parent c538587a
...@@ -74,6 +74,7 @@ object VcfFilter extends ToolCommand { ...@@ -74,6 +74,7 @@ object VcfFilter extends ToolCommand {
mustHaveVariant: List[String] = Nil, mustHaveVariant: List[String] = Nil,
calledIn: List[String] = Nil, calledIn: List[String] = Nil,
deNovoInSample: String = null, deNovoInSample: String = null,
resToDom: List[Trio] = Nil,
deNovoTrio: List[Trio] = Nil, deNovoTrio: List[Trio] = Nil,
trioLossOfHet: List[Trio] = Nil, trioLossOfHet: List[Trio] = Nil,
diffGenotype: List[(String, String)] = Nil, diffGenotype: List[(String, String)] = Nil,
...@@ -107,6 +108,9 @@ object VcfFilter extends ToolCommand { ...@@ -107,6 +108,9 @@ 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]("resToDom") unbounded () valueName ("<child:father:mother>") action { (x, c) =>
c.copy(resToDom = new Trio(x) :: c.resToDom)
} text ("Only show variants that contain unique alleles in complete set for given sample")
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")
...@@ -190,6 +194,7 @@ object VcfFilter extends ToolCommand { ...@@ -190,6 +194,7 @@ object VcfFilter extends ToolCommand {
denovoInSample(record) && denovoInSample(record) &&
denovoTrio(record, commandArgs.deNovoTrio) && denovoTrio(record, commandArgs.deNovoTrio) &&
denovoTrio(record, commandArgs.trioLossOfHet, true) && denovoTrio(record, commandArgs.trioLossOfHet, true) &&
resToDom(record, commandArgs.resToDom) &&
inIdSet(record)) { inIdSet(record)) {
writer.add(record) writer.add(record)
counterLeft += 1 counterLeft += 1
...@@ -301,6 +306,18 @@ object VcfFilter extends ToolCommand { ...@@ -301,6 +306,18 @@ object VcfFilter extends ToolCommand {
return true return true
} }
def resToDom(record: VariantContext, trios: List[Trio]): Boolean = {
for (trio <- trios) {
val child = record.getGenotype(trio.child)
if (child.isHomVar && child.getAlleles.forall(allele => {
record.getGenotype(trio.father).countAllele(allele) == 1 &&
record.getGenotype(trio.mother).countAllele(allele) == 1
})) return true
}
return trios.isEmpty
}
def denovoTrio(record: VariantContext, trios: List[Trio], onlyLossHet: Boolean = false): Boolean = { def denovoTrio(record: VariantContext, trios: List[Trio], onlyLossHet: Boolean = false): Boolean = {
for (trio <- trios) { for (trio <- trios) {
val child = record.getGenotype(trio.child) val child = record.getGenotype(trio.child)
......
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