AndersenLab / VCF-kit

VCF-kit: Assorted utilities for the variant call format
http://www.andersenlab.org
MIT License
122 stars 25 forks source link

Exception due to misuse of numpy options #22

Closed aozalevsky closed 1 week ago

aozalevsky commented 5 years ago

The recent version of VCF-kit is unusable right after the installation:

[nknyazeva@head02 silwer]$ vk
Traceback (most recent call last):
  File "/home/nknyazeva/.local/bin/vk", line 9, in <module>
    load_entry_point('VCF-kit==0.1.6', 'console_scripts', 'vk')()
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/nknyazeva/.local/lib/python2.7/site-packages/vcfkit/vk.py", line 27, in <module>
    from utils.vcf import *
  File "/home/nknyazeva/.local/lib/python2.7/site-packages/vcfkit/utils/vcf.py", line 10, in <module>
    np.set_printoptions(threshold=np.nan)
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 246, in set_printoptions
    floatmode, legacy)
  File "/home/tools/python/Python-2.7/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 93, in _make_options_dict
    raise ValueError("threshold must be numeric and non-NAN, try "
ValueError: threshold must be numeric and non-NAN, try sys.maxsize for untruncated representation

caused by line:

np.set_printoptions(threshold=np.nan)

in vcfkit/utils/vcf.py

The issue can be fixed with:

import sys
np.set_printoptions(threshold=sys.maxsize)

Please refer to https://github.com/numpy/numpy/issues/12987 for the explanation and the origin of the fix.

aozalevsky commented 1 week ago

fixed in 20ce55d12e4a520fe70254d2a2eb0d7e9f82a7f0