NBISweden / IgDiscover-legacy

Analyze antibody repertoires and discover new V genes from high-throughput sequencing reads
https://www.igdiscover.se
MIT License
17 stars 10 forks source link

clusterplot produces IndexError #78

Closed marcelm closed 7 years ago

marcelm commented 7 years ago

Sometimes, after a developer installation done according to the documentation, igdiscover clusterplot produces an IndexError (in the heatmap function).

marcelm commented 7 years ago

This is a problem in seaborn 0.8.0. Using 0.7.1 instead works fine. The error seems to have been fixed in the development version of seaborn. Whenever that is released, we can switch to it if also mwaskom/seaborn#1262 is fixed.

marcelm commented 7 years ago

I’ve submitted a pull request to fix the bioconda package to depend on 0.7.1.

smoe commented 5 years ago

This seaborn bug is unfortunate. I just drop the output of the test to help those googling to find the answer more quickly. Seaborn 0.9 is out https://seaborn.pydata.org/. I'll check it out.

===================================================================== FAILURES ======================================================================
__________________________________________________________________ test_clusterplot __________________________________________________________________

tmpdir = local('/tmp/pytest-of-moeller/pytest-1/test_clusterplot0')

    def test_clusterplot(tmpdir):
>       main(['clusterplot', '-m', '10', datapath('clusterplot.tab.gz'), str(tmpdir)])

tests/test_commands.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
igdiscover/__main__.py:108: in main
    args.func(args)
igdiscover/clusterplot.py:105: in main
    n_clusters = plot_clustermap(sequences, title, path, size=args.size, dpi=args.dpi)
igdiscover/clusterplot.py:59: in plot_clustermap
    yticklabels=False
/usr/lib/python3/dist-packages/seaborn/matrix.py:1301: in clustermap
    **kwargs)
/usr/lib/python3/dist-packages/seaborn/matrix.py:1142: in plot
    self.plot_matrix(colorbar_kws, xind, yind, **kws)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <seaborn.matrix.ClusterGrid object at 0x7f62404356d8>, colorbar_kws = {'ticks': <matplotlib.ticker.MaxNLocator object at 0x7f623d6383c8>}
xind = [0, 5, 1, 9, 6, 8, ...], yind = [0, 5, 1, 9, 6, 8, ...], kws = {'cmap': 'Blues', 'linecolor': 'none', 'linewidths': None}, xtl = False
ytl = False

    def plot_matrix(self, colorbar_kws, xind, yind, **kws):
        self.data2d = self.data2d.iloc[yind, xind]
        self.mask = self.mask.iloc[yind, xind]

        # Try to reorganize specified tick labels, if provided
        xtl = kws.pop("xticklabels", "auto")
        try:
            xtl = np.asarray(xtl)[xind]
        except (TypeError, IndexError):
            pass
        ytl = kws.pop("yticklabels", "auto")
        try:
            ytl = np.asarray(ytl)[yind]
        except (TypeError, IndexError):
            pass

        heatmap(self.data2d, ax=self.ax_heatmap, cbar_ax=self.cax,
                cbar_kws=colorbar_kws, mask=self.mask,
                xticklabels=xtl, yticklabels=ytl, **kws)

>       xtl_rot = self.ax_heatmap.get_xticklabels()[0].get_rotation()
E       IndexError: list index out of range

/usr/lib/python3/dist-packages/seaborn/matrix.py:1118: IndexError
marcelm commented 5 years ago

Current IgDiscover requires seaborn 0.9 and the tests don’t fail there.