Skip to content

Commit

Permalink
doctest fix
Browse files Browse the repository at this point in the history
numpy 2.0 was different between local/action
  • Loading branch information
ACEnglish committed Jul 11, 2024
1 parent e9032c6 commit 611d0af
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
12 changes: 6 additions & 6 deletions imgs/pylint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions repo_utils/run_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ def tester(module):
fails += tester(msatovcf)
fails += tester(af_calc)

os.remove("log.txt")
sys.exit(fails)
2 changes: 1 addition & 1 deletion truvari/annotations/af_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def allele_freq_annos(entry, samples=None):
>>> import pysam
>>> v = pysam.VariantFile('repo_utils/test_files/variants/multi.vcf.gz')
>>> truvari.allele_freq_annos(next(v))
{'AF': 0.5, 'MAF': 0.5, 'ExcHet': 1.0, 'HWE': 1.0, 'MAC': 1, 'AC': [1, 1], 'AN': 2, 'N_HEMI': 0, 'N_HOMREF': 0, 'N_HET': 1, 'N_HOMALT': 0, 'N_MISS': 2}
{'AF': 0.5, 'MAF': 0.5, 'ExcHet': np.float64(1.0), 'HWE': np.float64(1.0), 'MAC': 1, 'AC': [1, 1], 'AN': 2, 'N_HEMI': 0, 'N_HOMREF': 0, 'N_HET': 1, 'N_HOMALT': 0, 'N_MISS': 2}
"""
if samples is None:
samples = list(entry.samples.keys())
Expand Down
6 changes: 2 additions & 4 deletions truvari/msatovcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def aln_to_vars(chrom, start_pos, ref_seq, alt_seq, anchor_base):

if ref_base == alt_base: # No variant
if cur_variant and is_ref: # back to matching reference
for variant in decompose_variant(cur_variant):
yield variant
yield from decompose_variant(cur_variant)
cur_variant = []
else:
if not cur_variant:
Expand All @@ -80,8 +79,7 @@ def aln_to_vars(chrom, start_pos, ref_seq, alt_seq, anchor_base):
anchor_base = ref_base
# End Zipping
if cur_variant:
for variant in decompose_variant(cur_variant):
yield variant
yield from decompose_variant(cur_variant)

def msa_to_vars(msa, chrom, ref_seq=None, start_pos=0, abs_anchor_base='N'):
"""
Expand Down
3 changes: 1 addition & 2 deletions truvari/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ def gz_hdlr(fn):

def fh_hdlr(fn):
with open(fn) as fh:
for line in fh:
yield line
yield from fh

if in_fn.endswith('.gz'):
return gz_hdlr(in_fn)
Expand Down

0 comments on commit 611d0af

Please sign in to comment.