Revision: 8731fbf4397c
Branch: default
Author: Kevin B. Jacobs <
jac...@bioinformed.com>
Date: Mon Jan 21 11:41:31 2013
Log: Fix case where a novel allele with no matching annotation records
would be
excluded from calculation of common score. This is exceptionally bad
because common score based on only the reference allele is 1.
http://code.google.com/p/glu-genetics/source/detail?r=8731fbf4397c
Modified:
/glu/lib/seqlib/cgfvariants.py
=======================================
--- /glu/lib/seqlib/cgfvariants.py Mon Dec 10 08:24:20 2012
+++ /glu/lib/seqlib/cgfvariants.py Mon Jan 21 11:41:31 2013
@@ -75,9 +75,14 @@
exact_vars = []
inexact_vars = []
- common_score = defaultdict(float)
function_score = 0
+ # Start by assuming common score is 0 for each non-reference allele and
+ # 1 for reference. This initialization is needed because a novel
allele
+ # would have no matching variant records and the minimum score would be
+ # incorrectly taken as 1 based only on information about the reference
allele.
+ common_score = dict( (a, 0. if not qref or a!=qref else 1.) for a in
geno )
+
for v,vrecs in vdata.iteritems():
if v.start!=start or v.stop!=stop:
if v.source:
@@ -99,7 +104,7 @@
exact_vars = sorted(set(exact_vars))
inexact_vars = sorted(set(inexact_vars))
- common_score = min(common_score.values()) if common_score else 0
+ common_score = min(common_score.values())
functions = []
if function_score: