'ids_to_keep' must contain at least one ID

Hello All!

I have this error:
Plugin error from feature-table:

ids_to_keep must contain at least one ID.

I believe the problem may be that my unique IDs for column 1 of the metadata are called “id” and the feature-table IDs are something else.

However, I am not sure how to visualize the feature-table in order to see the IDs to confirm this suspicion.

I am working with AGP data and my code that resulted in the error is:

(qiime2-2021.2) katiemiriam@Katharines-MBP querying_redbiom % qiime feature-table summarize --i-table filtered-table-AGP.qza --o-visualization filtered-table.qzv --m-sample-metadata-file ./metadataR.tsv --verbose
Traceback (most recent call last):
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2cli/commands.py", line 329, in __call__
    results = action(**arguments)
  File "<decorator-gen-342>", line 2, in summarize
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 245, in bound_callable
    output_types, provenance)
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/sdk/action.py", line 452, in _callable_executor_
    ret_val = self._callable(output_dir=temp_dir, **view_args)
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_feature_table/_summarize/_visualizer.py", line 156, in summarize
    sample_frequencies
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/q2_feature_table/_summarize/_vega_spec.py", line 16, in vega_spec
    sample_frequencies.index)
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/metadata/metadata.py", line 728, in filter_ids
    ids_to_keep)
  File "/Users/katiemiriam/miniconda3/envs/qiime2-2021.2/lib/python3.6/site-packages/qiime2/metadata/metadata.py", line 184, in _filter_ids_helper
    raise ValueError("`ids_to_keep` must contain at least one ID.")
ValueError: `ids_to_keep` must contain at least one ID.

Plugin error from feature-table:

  `ids_to_keep` must contain at least one ID.

See above for debug info.

Many thanks for any input!

Katie

Hi @watson!

The index column name shouldn't matter - the error message is telling us that it found no valid IDs, although I'm not sure in which file. Please run the following and report back your findings:

qiime tools inspect-metadata ./metadataR.tsv
qiime tools inspect-metadata filtered-table-AGP.qza

Thanks!

:qiime2:

Thanks, @thermokarst!
When I run: qiime tools inspect-metadata ./metadataR.tsv
I get a column listing all variables except "id" and a second column listing the type of each variable. There are 3560 IDs and 57 columns.

When I run: qiime tools inspect-metadata filtered-table-AGP.qza
it says:
An error has been encountered:

Metadata must contain at least one ID.

When I view the metadataR.tsv file, the first column is ID, though. I'll attach that file here...metadataR.tsv (2.8 MB)

Thanks again.

Here is a screenshot of the result of qiime tools inspect-metadata ./metadataR.tsv

Perfect, thanks @watson! Your metadata file appears to be fine :champagne:! Unfortunately, your feature table has zero samples in it (uh oh!). You can further debug by running the summarize command sans metadata:

qiime feature-table summarize \
  --i-table filtered-table-AGP.qza \
  --o-visualization filtered-table.qzv \
  --verbose

What steps were taken to produce this table? It looks like you might've ran a filtering step - did you filter out all the samples on accident?

:qiime2:

Well, the first part is good news :grin:
I ran the --verbose command to debug and, as you suggested, no samples!

Here is how I produced the table…
I first downloaded a file called data.biom using redbiom (again, it’s AGP data).
(I’d attach it but it is >200MB.)

Next, I converted to a format QIIME2 can use like this:

qiime tools import --input-path /Users/katiemiriam/Desktop/querying_redbiom/data.biom --type 'FeatureTable[Frequency]' --input-format BIOMV210Format --output-path feature-table-AGP.qza

Then, I ran these steps:

(qiime2-2021.2) katiemiriam@Katharines-MBP querying_redbiom % qiime feature-table filter-samples --i-table feature-table-AGP.qza --p-min-frequency 1000 --o-filtered-table sample-frequency-filtered-table-AGP.qza

Saved FeatureTable[Frequency] to: sample-frequency-filtered-table-AGP.qza

qiime feature-table filter-features --i-table sample-frequency-filtered-table-AGP.qza --p-min-frequency 3 --o-filtered-table feature-filtered-table-AGP.qza

Saved FeatureTable[Frequency] to: feature-filtered-table-AGP.qza
qiime feature-table filter-samples --i-table feature-filtered-table-AGP.qza --m-metadata-file ./metadataR.tsv --o-filtered-table filtered-table-AGP.qza

Saved FeatureTable[Frequency] to: filtered-table-AGP.qza

qiime feature-table summarize --i-table filtered-table-AGP.qza --o-visualization filtered-table.qzv --m-sample-metadata-file ./metadataR.tsv

**Plugin error from feature-table:**

**`ids_to_keep` must contain at least one ID.**

So, perhaps I have done something with the samples in these steps or there is something wrong with the data.biom file (although I thought I followed all the redbiom steps correctly)?

Thanks again!

Sounds like you have everything you need to start diagnosing this issue - it looks like you applied at least 3 separate filtering steps - time to work your way backwards and see which step is responsible for clearing out your table. You can use the feature-table summarize command, sans metadata to help with this.

Keep us posted!

:qiime2:

Thank you for pointing me in the right direction! I’ll provide an update when I make the diagnosis :stethoscope:

1 Like

An update…the sample-frequency-filtered-table-AGP.qza indeed does not contain identifiers. It looks like when the data were downloaded using redbiom, sample identifiers were not attached to the sequences. Once I can figure out how to get those identifiers back and attach them to the sequences :crossed_fingers: :crossed_fingers: :crossed_fingers:, it should work.

1 Like

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