Skip to content

Commit f2d76a3

Browse files
committed
small code clean
1 parent 8ae4ad7 commit f2d76a3

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

truvari/bench.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -237,46 +237,46 @@ def annotate_entry(entry, match, header):
237237
entry.info["Multi"] = match.multi
238238

239239

240-
def output_writer(call, outs, sizemin):
240+
def output_writer(match, outs, sizemin):
241241
"""
242242
Annotate a MatchResults' entries, write to the apppropriate file in outs
243243
and do the stats counting.
244244
Writer is responsible for handling FPs between sizefilt-sizemin
245245
"""
246246
box = outs["stats_box"]
247-
if call.base:
247+
if match.base:
248248
box["base cnt"] += 1
249-
annotate_entry(call.base, call, outs['n_base_header'])
250-
if call.state:
251-
gtBase = str(call.base_gt)
252-
gtComp = str(call.comp_gt)
249+
annotate_entry(match.base, match, outs['n_base_header'])
250+
if match.state:
251+
gtBase = str(match.base_gt)
252+
gtComp = str(match.comp_gt)
253253
box["gt_matrix"][gtBase][gtComp] += 1
254254

255255
box["TP-base"] += 1
256-
outs["tpb_out"].write(call.base)
257-
if call.gt_match:
256+
outs["tpb_out"].write(match.base)
257+
if match.gt_match:
258258
box["TP-base_TP-gt"] += 1
259259
else:
260260
box["TP-base_FP-gt"] += 1
261261
else:
262262
box["FN"] += 1
263-
outs["fn_out"].write(call.base)
263+
outs["fn_out"].write(match.base)
264264

265-
if call.comp:
266-
annotate_entry(call.comp, call, outs['n_comp_header'])
267-
if call.state:
265+
if match.comp:
266+
annotate_entry(match.comp, match, outs['n_comp_header'])
267+
if match.state:
268268
box["call cnt"] += 1
269269
box["TP-call"] += 1
270-
outs["tpc_out"].write(call.comp)
271-
if call.gt_match:
270+
outs["tpc_out"].write(match.comp)
271+
if match.gt_match:
272272
box["TP-call_TP-gt"] += 1
273273
else:
274274
box["TP-call_FP-gt"] += 1
275-
elif truvari.entry_size(call.comp) >= sizemin:
275+
elif truvari.entry_size(match.comp) >= sizemin:
276276
# The if is because we don't count FPs between sizefilt-sizemin
277277
box["call cnt"] += 1
278278
box["FP"] += 1
279-
outs["fp_out"].write(call.comp)
279+
outs["fp_out"].write(match.comp)
280280

281281

282282
##########################
@@ -499,12 +499,12 @@ def bench_main(cmdargs):
499499
comp_i = regions_extended.iterate(comp)
500500

501501
chunks = truvari.chunker(matcher, ('base', base_i), ('comp', comp_i))
502-
for call in itertools.chain.from_iterable(map(compare_chunk, chunks)):
503-
# setting non-matched call variants that are not fully contained in the original regions to None
502+
for match in itertools.chain.from_iterable(map(compare_chunk, chunks)):
503+
# setting non-matched comp variants that are not fully contained in the original regions to None
504504
# These don't count as FP or TP and don't appear in the output vcf files
505-
if args.extend and call.comp is not None and not call.state and not regions.include(call.comp):
506-
call.comp = None
507-
output_writer(call, outputs, args.sizemin)
505+
if args.extend and match.comp is not None and not match.state and not regions.include(match.comp):
506+
match.comp = None
507+
output_writer(match, outputs, args.sizemin)
508508

509509
with open(os.path.join(args.output, "summary.txt"), 'w') as fout:
510510
box = outputs["stats_box"]

0 commit comments

Comments
 (0)