Skip to content

Commit

Permalink
pr #209
Browse files Browse the repository at this point in the history
functional tests passed.
pylint wanted changes
```
% python repo_utils/pylint_maker.py
************* Module truvari.utils
truvari/utils.py:448:0: C0305: Trailing newlines (trailing-newlines)
truvari/utils.py:447:11: R1729: Use a generator instead 'any(os.path.exists(vcf_path + '.' + x) for x in vcf_index_ext)' (use-a-generator)
```

Updated `truvari/annotations/trf.py` to use the new method.

Added the new method to api docs in `docs/api/truvari.rst`
  • Loading branch information
ACEnglish committed Apr 8, 2024
1 parent f5d53e0 commit f9004cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/api/truvari.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ calc_hwe
^^^^^^^^
.. autofunction:: calc_hwe

check_vcf_index
^^^^^^^^^^^^^^^
.. autofunction:: check_vcf_index

compress_index_vcf
^^^^^^^^^^^^^^^^^^
.. autofunction:: compress_index_vcf
Expand Down
2 changes: 1 addition & 1 deletion truvari/annotations/trf.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def check_params(args):
if not args.input.endswith((".vcf.gz", ".bcf.gz")):
logging.error(f"{args.input} isn't compressed vcf")
check_fail = True
if not os.path.exists(args.input + ".tbi") and not os.path.exists(args.input + ".csi"):
if not truvari.check_vcf_index(args.input):
logging.error(f"{args.input}[.tbi|.csi] doesn't exit")
check_fail = True
if not args.repeats.endswith(".bed.gz"):
Expand Down
3 changes: 1 addition & 2 deletions truvari/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,5 +444,4 @@ def check_vcf_index(vcf_path):
Return true if an index file is found for the vcf
"""
vcf_index_ext = ['tbi','csi']
return any([os.path.exists(vcf_path + '.' + x) for x in vcf_index_ext])

return any(os.path.exists(vcf_path + '.' + x) for x in vcf_index_ext)

0 comments on commit f9004cc

Please sign in to comment.