Rescript evaluate-fit-classifier - Plugin error from rescript: Passing a set as an indexer is not supported. Use a list instead.

Hi all,

I have run into an issue with Rescript that I cannot see reported after searching the forum. When attempting to run 'qiime rescript evaluate-fit-classifier' I get the following:

Plugin error from rescript: Passing a set as an indexer is not supported. Use a list instead. The generation of ref-seqs and taxonomy all appears fine up to here.

Last entry in the debug log is:
File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pandas/core/indexing.py", line 2774, in check_dict_or_set_indexers
raise TypeError(
TypeError: Passing a set as an indexer is not supported. Use a list instead.

I am running Rescript via qiime2-amplicon-2024.5 in a conda environment via a Mac Terminal.

Any help or insights as to how to solve this would be hugely appreciated.

1 Like

Hi @Mat_Goddard,
Would you mind posting the whole command you ran?

Would you also run the command with the --verbose flag and share the output?
Thanks
:turtle:

Thanks so much for the quick reply. Here is the whole command with the --verbose flag:

qiime rescript evaluate-fit-classifier \
    --i-sequences spike-path-only-refseqs.qza \
    --i-taxonomy spike-path-only-taxonomy.qza \
    --o-classifier spike-path-only-refseqs-classifier.qza \
    --o-evaluation spike-path-only-refseqs-classifier-evaluation.qzv \
    --o-observed-taxonomy spike-path-only-refseqs-predicted-taxonomy.qza \
    --verbose
Traceback (most recent call last):
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 520, in __call__
    results = self._execute_action(
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/q2cli/commands.py", line 586, in _execute_action
    results = action(**arguments)
  File "<decorator-gen-720>", line 2, in evaluate_fit_classifier
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
    outputs = self._callable_executor_(
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/qiime2/sdk/action.py", line 657, in _callable_executor_
    outputs = self._callable(scope.ctx, **view_args)
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/rescript/cross_validate.py", line 34, in evaluate_fit_classifier
    taxa = taxa.loc[seq_ids]
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pandas/core/indexing.py", line 1178, in __getitem__
    check_dict_or_set_indexers(key)
  File "/opt/miniconda3/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pandas/core/indexing.py", line 2774, in check_dict_or_set_indexers
    raise TypeError(
TypeError: Passing a set as an indexer is not supported. Use a list instead.

Plugin error from rescript:

  Passing a set as an indexer is not supported. Use a list instead.

See above for debug info.

Thanks so much for any help again....

Hi @Mat_Goddard,
Would you mind running qiime info and sending me the results?

Thanks... the output is below.

If it helps, I also conducted a clean install of miniconda3 and qiime2-amplicon-2024.5 on a new machine (Mac mini with M1 chip) and ran Nick's code exactly as per 'Using RESCRIPt to compile sequence databases and taxonomy classifiers from NCBI Genbank' and recovered exactly the same error.

Acknowledging I am at the limit of my understanding, some googling suggests that a python function in Rescript has been updated and now needs a list as an input?

qiime info
System versions
Python version: 3.9.19
QIIME 2 release: 2024.5
QIIME 2 version: 2024.5.0
q2cli version: 2024.5.0

Installed plugins
alignment: 2024.5.0
composition: 2024.5.0
cutadapt: 2024.5.0
dada2: 2024.5.0
deblur: 2024.5.0
demux: 2024.5.0
diversity: 2024.5.0
diversity-lib: 2024.5.0
emperor: 2024.5.0
feature-classifier: 2024.5.0
feature-table: 2024.5.0
fragment-insertion: 2024.5.0
longitudinal: 2024.5.0
metadata: 2024.5.0
phylogeny: 2024.5.0
quality-control: 2024.5.0
quality-filter: 2024.5.0
rescript: 2024.5.0
sample-classifier: 2024.5.0
taxa: 2024.5.0
types: 2024.5.0
vsearch: 2024.5.0

Application config directory
/opt/miniconda3/envs/qiime2-amplicon-2024.5/var/q2cli

Many thanks again...

I have also just run the same code from Using RESCRIPt to compile sequence databases and taxonomy classifiers from NCBI Genbank on a VM running Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1061-azure x86_64) with

System versions
Python version: 3.9.19
QIIME 2 release: 2024.5
QIIME 2 version: 2024.5.0
q2cli version: 2024.5.0

rescript: 2024.5.0

and recovered the same error (last line of error log only)

  File "/anaconda/envs/qiime2-amplicon-2024.5/lib/python3.9/site-packages/pandas/core/indexing.py", line 2774, in check_dict_or_set_indexers
    raise TypeError(
TypeError: Passing a set as an indexer is not supported. Use a list instead.

Plugin error from rescript:

  Passing a set as an indexer is not supported. Use a list instead.

Hope this is helpful. All the best

I have the same issue running the code from " Using RESCRIPt to compile sequence databases and taxonomy classifiers from NCBI Genbank](Using RESCRIPt to compile sequence databases and taxonomy classifiers from NCBI Genbank)". Cannot figure out reason

qiime rescript evaluate-fit-classifier
--i-sequences ncbi-refseqs.qza
--i-taxonomy ncbi-refseqs-taxonomy.qza
--o-classifier ncbi-refseqs-classifier.qza
--o-evaluation ncbi-refseqs-classifier-evaluation.qzv
--o-observed-taxonomy ncbi-refseqs-predicted-taxonomy.qza

Plugin error from rescript:
Passing a set as an indexer is not supported. Use a list instead.
Debug info has been saved to /tmp/qiime2-q2cli-err-l0g956ta.log

Hi @John_Strisler and @Mat_Goddard,
Looks like this was a bug in our q2-2024.5 release but we just released a patch. Uninstall this env and reinstall a new q2-2024.5 release, and you should be golden! :star:

2 Likes

Thanks so much.

Just a note to all that any ref-seq or taxomony objects built prior to the patch will need to be re-built after the patch to avoid this error when creating a classifier.

All the best

Thank you as well, I attempted redownloading qiime2 from the QIIME2 website via

wget https://data.qiime2.org/distro/amplicon/qiime2-amplicon-2024.5-py38-linux-conda.yml
conda env create -n qiime2-amplicon-2024.5 --file qiime2-amplicon-2024.5-py38-linux-conda.yml

as the latest releases on Github do not include a Linux

Where is the updated distribution located when I call qiime --version on the redownloaded environment it reads q2cli version 2024.5.0. I also tried to create another environment with qiime2-amplicon-ubuntu-latest-conda.yml. But is appears to likely just be an update file

Hi @John_Strisler,

You won't see an updated version for q2cli - you'll only see updated versions for the packages that were patched. When running qiime info you should see q2-diversity and rescript at 2024.5.1, as those were the packages that received patch updates. If you're not seeing those versions, you are likely still working with the original release version of the amplicon distribution.

Here's a direct install command you can use to ensure you're installing the latest version (without needing to download a file to your local machine):

conda env create -n q2amplicon-2024.5 -f https://raw.githubusercontent.com/qiime2/distributions/dev/2024.5/amplicon/released/qiime2-amplicon-ubuntu-latest-conda.yml

Cheers :lizard:

4 Likes