Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rows can be 0 in virus panel grid calculation #477

Open
terrycojones opened this issue Dec 7, 2016 · 0 comments
Open

rows can be 0 in virus panel grid calculation #477

terrycojones opened this issue Dec 7, 2016 · 0 comments

Comments

@terrycojones
Copy link
Member

Here's an exception:

Traceback (most recent call last):
  File "/scratch/tcj25/root/.virtualenvs/35/bin/proteins-to-viruses.py", line 108, in <module>
    sampleTotalReadCountFilename=args.sampleTotalReadCountFilename))
  File "/scratch/tcj25/root/.virtualenvs/35/lib/python3.5/site-packages/dark/proteins.py", line 319, in toHTML
    self.virusPanel(virusPanelFilename, sampleTotalReadCountFilename)
  File "/scratch/tcj25/root/.virtualenvs/35/lib/python3.5/site-packages/dark/proteins.py", line 709, in virusPanel
    figure, ax = plt.subplots(rows, cols)  # , squeeze=False)
  File "/scratch/tcj25/root/.virtualenvs/35/lib/python3.5/site-packages/matplotlib/pyplot.py", line 1186, in subplots
    ax0 = fig.add_subplot(gs[0, 0], **subplot_kw)
  File "/scratch/tcj25/root/.virtualenvs/35/lib/python3.5/site-packages/matplotlib/gridspec.py", line 154, in __getitem__
    raise IndexError("index out of range")
IndexError: index out of range
make: *** [index] Error 1

This happens when rows = 0 in the following (from proteins.py line 707):

        cols = 5
        rows = int(len(virusTitles) / cols) + (
            0 if len(virusTitles) % cols == 0 else 1)
        figure, ax = plt.subplots(rows, cols)  # , squeeze=False)

rows will be 0 when virusTitles is 0. Presumably we shouldn't have called virusPanel in this case.

This is all triggered by running

$ find . -name summary-proteins | proteins-to-viruses.py --html --virusPanelFilename viral-sample-read-counts.png --sampleNameRegex '^\./(RISE\d+)/' > index.html

so fix it in toHTML or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant