Skip to content

Commit

Permalink
Pass through representative genotype call with the most attributes of…
Browse files Browse the repository at this point in the history
… interest specified. Helps with downstream filtering of ensemble calls. Thanks to Shalabh Suman
  • Loading branch information
chapmanb committed Feb 28, 2014
1 parent 3cff8fe commit 7c8ed9b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/bcbio/variation/recall.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
:attr-count (+ (if (seq (get-in g [:attributes "PL"])) 1 0)
(if (seq (get-in g [:attributes "PVAL"])) 1 0)
(if (seq (get-in g [:attributes "AD"])) 1 0)
(if (get-in g [:attributes "GQ"]) 1 0)
(if (get-in g [:attributes "DP"]) 1 0))
:pl (attr/get-pl g)
})))
Expand All @@ -79,11 +80,13 @@
(apply + (remove nil? (map k xs))))
(sum-plus-call-type [i xs]
(let [pls (safe-sum xs :pl)
represent-x (last (sort-by #(vector (:has-likelihood %)
(or (:pl %) (- Integer/MIN_VALUE))
(:attr-count %))
best-x (last (sort-by #(vector (:has-likelihood %)
(or (:pl %) (- Integer/MIN_VALUE))
(:attr-count %))
xs))
represent-x (last (sort-by #(vector (:has-likelihood %) (:attr-count %))
xs))
call-code (if (= "HET" (:call-type represent-x)) 0 1)]
call-code (if (= "HET" (:call-type best-x)) 0 1)]
[(count xs) call-code (- pls) i represent-x]))]
(->> alleles
(group-by :alleles)
Expand Down

0 comments on commit 7c8ed9b

Please sign in to comment.