error in q2-sample-classifier 2019.7 classify-samples with two-class dataset

Hi and thank you for the new release 2019.7!

I performed an analysis with the qiime2-2019.4 version of q2-sample-classifier and it worked great.
I wanted to do the same analysis with the new version, mainly for the ROC curves, but I get this error message:

Plugin error from sample-classifier:

index 1 is out of bounds for axis 1 with size 1

Debug info has been saved to /var/folders/k6/6hcwnkcn099frbhql59cjg900000gn/T/qiime2-q2cli-err-kegvq49r.log

Can you please help me understand what went wrong?
I used the same files as in the previous analysis with 2019.4 version…

Thank you,
Lena

Could you please share:

  1. the command you used
  2. the full error message (run the command with --verbose added)

would you also mind sharing your input files, just in case we need them to debug? Thanks!

Sure! Please see the error below.
How can I send the files as a private message?

(qiime2-2019.7) ➜ sample-classifier-PSC qiime sample-classifier classify-samples
–i-table fecal-feature-table-PSC-Controls.qza
–m-metadata-file Merged_metadata-PSC-Controls.tsv
–m-metadata-column Diagnosis
–p-optimize-feature-selection
–p-parameter-tuning
–p-estimator RandomForestClassifier
–p-n-estimators 20
–p-random-state 123 --verbose
–output-dir 2019-7-classifier
/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/sklearn/model_selection/_search.py:813: DeprecationWarning: The default of the iid parameter will change from True to False in version 0.22 and will be removed in 0.24. This will change numeric results when test-set sizes are unequal.
DeprecationWarning)
Control PSC
id
52a 0.059544 0.940456
18B 0.950000 0.050000
95 0.267923 0.732077
28B 0.900000 0.100000
164 0.259544 0.740456
5B 0.791071 0.208929
99 0.703571 0.296429
52b 0.097044 0.902956
12A 0.703571 0.296429
12B 1.000000 0.000000
36B 0.850000 0.150000
11 0.501852 0.498148
91b 0.505423 0.494577
Traceback (most recent call last):
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2cli/commands.py”, line 327, in call
results = action(**arguments)
File “</Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/decorator.py:decorator-gen-148>”, line 2, in classify_samples
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 240, in bound_callable
output_types, provenance)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 477, in callable_executor
outputs = self._callable(scope.ctx, **view_args)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_sample_classifier/classify.py”, line 176, in classify_samples
missing_samples=‘ignore’, palette=palette)
File “</Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/decorator.py:decorator-gen-487>”, line 2, in confusion_matrix
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 240, in bound_callable
output_types, provenance)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 445, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_sample_classifier/classify.py”, line 363, in confusion_matrix
plot_title=‘confusion matrix’)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_sample_classifier/utilities.py”, line 494, in _plot_accuracy
roc = _generate_roc_plots(truth, probabilities, palette)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_sample_classifier/visuals.py”, line 184, in _generate_roc_plots
binarized_targets, probabilities, classes)
File “/Users/lenalapidot/miniconda2/envs/qiime2-2019.7/lib/python3.6/site-packages/q2_sample_classifier/visuals.py”, line 238, in _roc_per_class
binarized_targets[:, i], probabilities[:, i])
IndexError: index 1 is out of bounds for axis 1 with size 1

Plugin error from sample-classifier:

index 1 is out of bounds for axis 1 with size 1

See above for debug info.

Thanks @LenaLapidot! You found a bug in the new ROC plots that arises when you attempt to classify samples that have two classes (multi-class classification is unaffected). I have issued a bug report to track this.

For anyone else who is affected by this issue, there are two workarounds:

  1. use QIIME 2 version 2019.4 for the time being.
  2. If you want to use version 2019.7, you can run each step in the classify-samples pipeline individually: split-table, fit-classifier, predict-classification, and confusion-matrix. Do not input a Probabilities artifact to confusion-matrix and it should work fine (the issue is isolated to ROC curves of multi-class data).

Thank you!

Thank you Nicholas! I’ll try your suggestions and update how it works :slight_smile:

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.