Nantes Université

Skip to content

evolution_nbreads.py failed if ids are integer

When sample ids are integer, I get this error:

Traceback (most recent call last):
  File "/LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/scripts/microSysMics/scripts/evolution_nbreads.py", line 80, in <module>
    nb_reads_boxplot = sns.boxplot(x="processing_step", y="nb_reads", ax = ax, data=stats_plot)
  File "/LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/envs/microSysMics/lib/python3.9/site-packages/seaborn/_decorators.py", line 46, in inner_f
    return f(**kwargs)
  File "/LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/envs/microSysMics/lib/python3.9/site-packages/seaborn/categorical.py", line 2240, in boxplot
    plotter = _BoxPlotter(x, y, hue, data, order, hue_order,
  File "/LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/envs/microSysMics/lib/python3.9/site-packages/seaborn/categorical.py", line 407, in __init__
    self.establish_colors(color, palette, saturation)
  File "/LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/envs/microSysMics/lib/python3.9/site-packages/seaborn/categorical.py", line 319, in establish_colors
    lum = min(light_vals) * .6
ValueError: min() arg is an empty sequence
(microSysMics) [bordron-p-1@js4jb5j microSysMics]$ python scripts/evolution_nbreads.py /LAB-DATA/BiRD/shares/mibiogate/DOPEC/anosain_vs_dopec/output ../../input/config.json
No reference based filtering found for this run.

The cause is that pandas assign best possible type, even for dataframe index, and qiime2's outputs has multiple metadata rows (like the one starting with #q2:types).

One solution is to force index to be string. Another one is to ignore 2nd row of qiime's output (we must be sure that it is always the case).