Commit 8e070fb3 authored by Ryan Herbert's avatar Ryan Herbert

task.py compute extra check for keys and NoneType

See #3626
parent c9cf9aa9
Pipeline #49389 passed with stages
in 6 minutes and 45 seconds
......@@ -102,16 +102,18 @@ def compute_extra(id_file, id_config, min_threshold):
try:
d = json.load(rf)
loci_min = {}
loci_totals = d['reads']['germline']
for locus in loci_totals:
if locus not in result:
result[locus] = [0]
loci_min[locus] = loci_totals[locus][0] * (min_threshold/100.0)
for clone in d["clones"]:
germline = clone['germline']
if clone['reads'][0] >= loci_min[germline]:
result[germline][0] += 1
if 'reads' in d and 'germline' in d['reads']:
loci_totals = d['reads']['germline']
for locus in loci_totals:
if locus not in result:
result[locus] = [0]
loci_min[locus] = loci_totals[locus][0] * (min_threshold/100.0)
if 'clones' in d and d['clones'] is not None:
for clone in d["clones"]:
germline = clone['germline']
if clone['reads'][0] >= loci_min[germline]:
result[germline][0] += 1
except ValueError as e:
print('invalid_json')
return "FAIL"
......
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