VCF-kit
VCF-kit copied to clipboard
Exception due to misuse of numpy options
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.