Hi there, I had the following issue after using uchime_ref in Python API:
· I have my OTU table: OTU_table.qza (OTU_table variable).
· I have my nonchimeric sequences returned by uchime_ref: nonchim_seqs.qza (nonchim_seqs variable).
I have succesfully filtered my OTU table using Linux commands:
qiime feature-table filter-features --i-table OTU_table.qza --m-metadata-file nonchim_seqs.qza …
The problem appears when I try to do this using Python API, when I try to use the nonchimeric sequences as metadata for the function:
from qiime2.plugins.feature_table.methods import filter_features
filter_features(OTU_table, metadata = nonchim_seqs)
This gives me the following error:
Parameter ‘metadata’ received an argument of type FeatureData[Sequence]. An argument of subtype Metadata is required.
Another API user! Hi !
The error is relatively descriptive: your
nonchim_seqs object needs to be the
Metadata class, rather than the
Artifact class you currently have. My hack-tastic solution would be to export the
FeatureData[Sequence] to a pandas DataFrame and then pass it into the
qiime2.Metadata object. There may be a slicker solution, but I think it should solve your problem? (If not, maybe try passing it as a
MetadataCategory object out of the
filter_features(OTU_table, metadata = nonchim_seqs.view(qiime2.Metadata))
Hi Justine, thanks for your response. You were right, using the qiime2. Metadata object was the way to do this.
I’ve transformed the FeatureData[Sequence] artifact into Metadata using this method:
Now it works
Thank you! I learned something new today!
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.