Skip to content

Commit

Permalink
pylint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEnglish committed Jan 5, 2025
1 parent 154b9bb commit c17f5af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions truvari/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ def build_matrix(self, base_variants, comp_variants, chunk_id=0, skip_gt=False,
for bid, base in enumerate(base_variants):
base_matches = []
for cid, comp in enumerate(comp_variants):
mat = matcher(base, comp,
mat = matcher(base, comp,
matid=[f"{chunk_id}.{bid}", f"{chunk_id}.{cid}"],
skip_gt=skip_gt,
skip_gt=skip_gt,
short_circuit=self.short_circuit)
logging.debug("Made mat -> %s", mat)
base_matches.append(mat)
Expand Down
19 changes: 9 additions & 10 deletions truvari/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,16 @@ def bnd_build_match(self, base, comp, matid=None, **_kwargs):
"""
Build a MatchResult for bnds
"""
def bounds(entry, pos, key='POS'):
def bounds(pos):
"""
Inflate a bnd position
"""
start = pos - self.params.bnddist
end = pos + self.params.bnddist

""" Experimental, but it's getting tricky, so need clarification
Inflate a bnd position based on CIPOS.
Experimental, but it's getting tricky, so need clarification
For example, why does GIAB use CIPOS1 instead of the standard CIPOS? (not to mention Type=String).
Also, I assumed that the CIPOS was ±POS, but it seems like the standard is that the ambiguity is between
POS, POS+CIPOS[0]. But then, there is no enforcement of strands with CIPOS, I think, so it could always be
positive and if it's a complement BND it might need POS - CIPOS?
I'm dropping for now
entry and key were also parameters
key = 'CI' + key
idx = 0 if key == 'POS' else 1
if key in entry.info: # Just CIPOS
Expand All @@ -292,6 +288,9 @@ def bounds(entry, pos, key='POS'):
if k not in [None, '.']:
end += int(k)
"""
start = pos - self.params.bnddist
end = pos + self.params.bnddist

return start, end

ret = truvari.MatchResult()
Expand All @@ -301,7 +300,7 @@ def bounds(entry, pos, key='POS'):
ret.matid = matid
ret.state = base.chrom == comp.chrom
ret.st_dist = base.pos - comp.pos
ret.state &= truvari.overlaps(*bounds(base, base.pos, 'POS'), *bounds(comp, comp.pos, 'POS'))
ret.state &= truvari.overlaps(*bounds(base.pos), *bounds(comp.pos))
b_bnd = bnd_direction_strand(base.alts[0])
c_bnd = bnd_direction_strand(comp.alts[0])
ret.state &= b_bnd == c_bnd
Expand All @@ -311,7 +310,7 @@ def bounds(entry, pos, key='POS'):
ret.ed_dist = b_pos2[1] - c_pos2[1]
ret.state &= b_pos2[0] == c_pos2[0]

ret.state &= truvari.overlaps(*bounds(base, b_pos2[1], 'END'), *bounds(comp, c_pos2[1], 'END'))
ret.state &= truvari.overlaps(*bounds(b_pos2[1]), *bounds(c_pos2[1]))
ret.state &= ret.ed_dist < self.params.bnddist

self.compare_gts(ret, base, comp)
Expand Down

0 comments on commit c17f5af

Please sign in to comment.