From 1429779693a4d66a5f8f0d89ad4a38fcbe293505 Mon Sep 17 00:00:00 2001 From: Adam English Date: Sun, 11 Feb 2024 09:00:29 -0500 Subject: [PATCH] potential fix for #196 functional tests failed to hit chain collapse --- truvari/bench.py | 2 +- truvari/collapse.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/truvari/bench.py b/truvari/bench.py index 8b52f4f9..d62fe1cd 100644 --- a/truvari/bench.py +++ b/truvari/bench.py @@ -37,7 +37,7 @@ def parse_args(args): help="Output directory") parser.add_argument("-f", "--reference", type=str, default=None, help="Fasta used to call variants. Turns on reference context sequence comparison") - parser.add_argument("--short", action="store_true", + parser.add_argument("--short", action="store_true", help="Short circuit comparisions. Faster, but fewer annotations") parser.add_argument("--debug", action="store_true", default=False, help="Verbose logging") diff --git a/truvari/collapse.py b/truvari/collapse.py index 63ead01f..f95f5d0a 100644 --- a/truvari/collapse.py +++ b/truvari/collapse.py @@ -94,6 +94,15 @@ def gt_conflict(self, other, which_gt): self.genotype_mask |= o_mask return False + def consolidate(self, other): + """ + Add other's calls/matches to self's matches + """ + self.matches.append(other.entry) + self.matches.extend(other.matches) + self.gt_consolidate_count += other.gt_consolidate_count + if self.genotype_mask != "" and other.genotype_mask != "": + self.genotype_mask |= other.genotype_mask def chain_collapse(cur_collapse, all_collapse, matcher): """ @@ -144,7 +153,7 @@ def collapse_chunk(chunk, matcher): if mat.state: m_collap.matches.append(mat) elif mat.sizesim is not None and mat.sizesim < matcher.params.pctsize: - # Can we do this? The sort tells us that we're going through most->least + # Can we do this? The sort tells us that we're going through most->least # similar size. So the next one will only be worse... break