SystemsGenetics / KINC

Knowledge Independent Network Construction
MIT License
11 stars 4 forks source link

KINC 3D viewer attempts to read in p_value as character string #183

Open JohnHadish opened 3 years ago

JohnHadish commented 3 years ago

If the first row of p_value use exponential format (X.XXXe-XX) rather than long form (X.XXXXX), python will attempt to read that column as a string. This will cause python to fail with this error:

Traceback (most recent call last):
  File "/usr/local/bin/kinc-3d-viewer.py", line 1764, in <module>
    main()
  File "/usr/local/bin/kinc-3d-viewer.py", line 1738, in main
    bin_edges(net)
  File "/usr/local/bin/kinc-3d-viewer.py", line 225, in bin_edges
    net['Pval_Bin'] = np.round(-np.log10(net['p_value']))
  File "/home/jah/.local/lib/python3.8/site-packages/pandas/core/series.py", line 679, in __array_ufunc__
    result = getattr(ufunc, method)(*inputs, **kwargs)
TypeError: loop of ufunc does not support argument 0 of type str which has no callable log10 method

This can be partially fixed by addressing issue https://github.com/SystemsGenetics/KINC/issues/182, but KINC extract will sometimes still use the exponential format when it is extracting a network, which will also cause failure:

image

Suggested Fix: