brineylab / abstar

VDJ assignment and antibody sequence annotation. Scalable from a single sequence to billions of sequences.
MIT License
41 stars 17 forks source link

Numpy TypeError: 'float' object cannot be interpreted as an integer #81

Closed brandynwest closed 4 years ago

brandynwest commented 4 years ago

First off, abstar looks like a sweet program. Can't wait to give it a try. I found it while looking for an open source alternative to IMGT. This may be a problem with my installation, but I am getting an error when I try to run abstar from the command line. I updated both numpy and Matplotlib using pip and I am still getting the same error. I'm running python 3.8 on Mac OS Catalina. I get the same error from both terminal and Xquartz. Is this perhaps an issue with new versions of numpy?[https://github.com/pydata/numexpr/issues/354]

Here is a copy of the error as it is displayed in terminal:

`TestData brandyn$ abstar -i consensus_sequences.fasta -o abstarout/ Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/function_base.py", line 117, in linspace num = operator.index(num) TypeError: 'float' object cannot be interpreted as an integer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/abstar", line 29, in import abstar File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/abstar/init.py", line 3, in from .core.abstar import run, run_standalone, main, parse_arguments, validate_args File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/abstar/core/abstar.py", line 44, in from abutils.core.sequence import Sequence File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/abutils/init.py", line 6, in from .utils import alignment, cluster, decorators, jobs, log, phylogeny, pipeline, progbar, s3, utilities File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/abutils/utils/phylogeny.py", line 55, in from .color import hex_to_rgb, get_cmap File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/abutils/utils/color.py", line 41, in cmaps = {'heatmap': sns.diverging_palette(240, 10, as_cmap=True)} File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/seaborn/palettes.py", line 744, in diverging_palette neg = palfunc((h_neg, s, l), 128 - (sep / 2), reverse=True, input="husl") File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/seaborn/palettes.py", line 641, in light_palette return blend_palette(colors, n_colors, as_cmap) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/seaborn/palettes.py", line 777, in blend_palette pal = _ColorPalette(pal(np.linspace(0, 1, n_colors))) File "<__array_function__ internals>", line 5, in linspace File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/function_base.py", line 119, in linspace raise TypeError( TypeError: object of type <class 'float'> cannot be safely interpreted as an integer.`

brandynwest commented 4 years ago

It seems like the problem might be with seaborn. The code in seaborn pallettes.py around line 777 is:

`colors = [_color_to_rgb(color, input) for color in colors] name = "blend" pal = mpl.colors.LinearSegmentedColormap.from_list(name, colors) if not as_cmap:

BW - original code: pal = _ColorPalette(pal(np.linspace(0, 1, n_colors)))

    pal = _ColorPalette(pal(np.linspace(0, 1, int(n_colors))))
return pal'

I was able to run abstar after using the int() function as shown in the code above.

briney commented 4 years ago

You're correct, it appears to be a Seaborn issue.