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:
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.
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 Metadata object.)
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: FeatureData[Sequence].view(qiime2.Metadata)