panaroo icon indicating copy to clipboard operation
panaroo copied to clipboard

IndexError: cannot do a non-empty take from an empty axes.

Open vinicius-santos-bmc opened this issue 8 months ago • 3 comments

Hi! I had this issue creating a core alignment using GFFs from prokka and I have no clue what could be happening. I didn't find any related issue here.

command:

panaroo \
      -a core --clean-mode strict \
      -t 15 \
      -o results \
      -i GCF_003710915.gff GCF_002951935.gff GCF_002007765.gff GCF_002951915.gff GCF_003963515.gff GCF_004000985.gff GCF_001465255.gff GCF_001187725.gff GCF_003710935.gff GCF_004117055.gff GCF_013185195.gff GCF_001420695.gff GCF_002043025.gff GCF_016406105.gff GCF_003710965.gff GCF_022701015.gff GCF_016937515.gff GCF_020923435.gff GCF_002082155.gff GCF_023523925.gff GCF_961514395.gff GCF_036700025.gff GCF_046622605.gff GCF_020923495.gff GCF_041640235.gff Idee_0013.gff GCF_042431195.gff GCF_023746555.gff GCF_003710985.gff GCF_042432825.gff GCF_017873765.gff
Iteration:  30
  Iteration:  31
  Iteration:  32
  Iteration:  33
  Iteration:  34
  Iteration:  35
  Iteration:  36
  Iteration:  37
  trimming contig ends...
  refinding genes...
  Number of searches to perform:  39949
  Searching...
  translating hits...
  removing by consensus...
  Updating output...
  Number of refound genes:  146
  collapse gene families with refound genes...
  Processing depth:  1
  Iteration:  1
  Iteration:  2
  Processing depth:  2
  Iteration:  1
  Processing depth:  3
  Iteration:  1
  Iteration:  2
  Iteration:  3
  Iteration:  4
  Iteration:  5
  Iteration:  6
  Iteration:  7
  Iteration:  8
  Iteration:  9
  Iteration:  10
  Iteration:  11
  Iteration:  12
  Iteration:  13
  Iteration:  14
  Iteration:  15
  Iteration:  16
  Iteration:  17
  Iteration:  18
  Iteration:  19
  Iteration:  20
  Iteration:  21
  Iteration:  22
  Iteration:  23
  Iteration:  24
  Iteration:  25
  writing output...
  generating core genome MSAs...

Command error:
  Iteration:  22
  
    0%|          | 0/1 [00:00<?, ?it/s]
  100%|██████████| 1/1 [00:00<00:00, 935.60it/s]
  Iteration:  23
  
    0%|          | 0/3 [00:00<?, ?it/s]
  100%|██████████| 3/3 [00:00<00:00, 2890.63it/s]
  Iteration:  24
  
    0%|          | 0/3 [00:00<?, ?it/s]
  100%|██████████| 3/3 [00:00<00:00, 1719.21it/s]
  Iteration:  25
  
    0%|          | 0/2 [00:00<?, ?it/s]
  100%|██████████| 2/2 [00:00<00:00, 1275.64it/s]
  writing output...
  generating core genome MSAs...
  
  0it [00:00, ?it/s]
  0it [00:00, ?it/s]
  
  0it [00:00, ?it/s]
  0it [00:00, ?it/s]
  Traceback (most recent call last):
    File "/usr/local/bin/panaroo", line 10, in <module>
      sys.exit(main())
    File "/usr/local/lib/python3.10/site-packages/panaroo/__main__.py", line 510, in main
      generate_core_genome_alignment(G, temp_dir, args.output_dir,
    File "/usr/local/lib/python3.10/site-packages/panaroo/generate_output.py", line 526, in generate_core_genome_alignment
      concatenate_core_genome_alignments(core_gene_names, output_dir, hc_threshold)
    File "/usr/local/lib/python3.10/site-packages/panaroo/generate_output.py", line 399, in concatenate_core_genome_alignments
      q = np.quantile(allh, [0.25,0.75])
    File "<__array_function__ internals>", line 180, in quantile
    File "/usr/local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 4412, in quantile
      return _quantile_unchecked(
    File "/usr/local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 4424, in _quantile_unchecked
      r, k = _ureduce(a,
    File "/usr/local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 3725, in _ureduce
      r = func(a, **kwargs)
    File "/usr/local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 4593, in _quantile_ureduce_func
      result = _quantile(arr,
    File "/usr/local/lib/python3.10/site-packages/numpy/lib/function_base.py", line 4699, in _quantile
      take(arr, indices=-1, axis=DATA_AXIS)
    File "<__array_function__ internals>", line 180, in take
    File "/usr/local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 190, in take
      return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
    File "/usr/local/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
      return bound(*args, **kwds)
  IndexError: cannot do a non-empty take from an empty axes.

vinicius-santos-bmc avatar May 28 '25 11:05 vinicius-santos-bmc

Hi,

I am afraid I have not run into this issue before. It would help us a lot to diagnose the problem if you are able to confirm the Panaroo version number and attach a small reproducible example.

gtonkinhill avatar Jun 11 '25 14:06 gtonkinhill

I didn't realize I was using an old version (1.3.2). I'll try with the current one. However, I think this issue was likely related to the high divergence between the genomes and the absence of core genes. I was analyzing species instead of strains and I couldn't get any core alignment using Roary either. Unfortunately, I can't make my example available, but if you use public genomes of different bacterial species (30 was the number I used in my experiment) you will probably get the same error. I used Prokka for the annotation.

vinicius-santos-bmc avatar Jun 13 '25 03:06 vinicius-santos-bmc

Hi,

Thanks for getting back to us. Panaroo was not really designed to cluster different species so you would need to adjust the default clustering thresholds quite a bit.

gtonkinhill avatar Jun 13 '25 09:06 gtonkinhill