How to extract sequences for specific samples in dataset?

I have looked in the qiime2 forum but no answers have been able to help me yet.

I have 27 samples. I want to extract the rep seqs from one specific sample so I can BLAST them and compare to an isolate I have from this sample's same sampling site. I seem to be repeatedly misunderstanding how I can do this.

So far I have seen these posts:

But they either weren't specific enough for what I am trying to do or weren't helpful enough for me (I'm new to QIIME2 btw).

So far I have tried creating a simplified metadata file with only the sample ID of the sample I want to retain, and then I tried using that simplified metadata file in filter-seqs against the OG repseqs from deblur:

qiime feature-table filter-seqs --i-data ../deblur-repseqs.qza --m-metadata-file sample-metadata-dconly.tsv --o-filtered-data dc-onlyseqs

But i received the error:
Plugin error from feature-table:

All features were filtered out of the data.

Debug info has been saved to /tmp/qiime2-q2cli-err-a8ngb9bw.log

I have also tried doing this command where I tried doing filter-samples using my table.qza after deblur (i previously already filtered things like Mitochondria and chloroplasts that I didn't want) with my simplified metadata file and then exported it, but it gave me a .biom file that I can't make any sense of (It opens with TextEditor but its mostly nonsensical):

qiime feature-table filter-samples --i-table ../deblur-filttable4.qza --m-metadata-file sample-metadata-dconly.tsv --o-filtered-table dconly-table

qiime tools export --input-path dconly-table.qza --output-path dconly-tableexp

Clearly I am doing something wrong and I can't seem to figure out what on my own. All help is greatly appreciated!

Hi @ag1170,
You are very close, thanks for putting in the work to learn Qiime2! You need to take the output of your qiime feature-table filter-samples and put it into qiime feature-table filter-seqs
You will need to run the commands from filter-table filter-seqs
The commands should be:

qiime feature-table filter-seqs
--i-data ../deblur-repseqs.qza
--i-table ../deblur-filttable4.qza
--o-filtered-data <output file name here>

Give that a try and let me know if you have any problems. After this step you should be able to visualize your seqs and BLAST.


Thank you for your reply.

So I ran the command you gave, which worked, but it looks like all the samples are still pooled together. How can I discern which sequences are from my specific sample of interest?

Hi @ag1170,
Can you please provide your table where you filtered down to one sample ( should be your output from qiime qiime feature-table filter-sample and your output from qiime feature-table filter-seqs.

qiime feature-table filter-sample should filter down your table to one sample.
qiime feature-table filter-seqs should filter your sequences down to just sequences in that sample.

Hope this help!

Sure, for that I ran:

qiime feature-table filter-samples --i-table ../deblur-filttable4.qza --m-metadata-file sample-metadata-dconly.tsv --o-filtered-table dconly-table

The output is:
dconly-table.qza (129.9 KB)

For filter-seqs I ran:
qiime feature-table filter-seqs --i-data ../deblur-repseqs.qza --i-table dconly-table.qza --o-filtered-data dconly

The output is:
dconly.qza (144.4 KB)

Thanks again!

Hi @ag1170
Looking at your table after you filter you have 2 samples remaining. Is that what you are expecting?

1 Like

Yes, so now I want to separate the rep seqs that are specific to those two samples.

Hi @ag1170
You need to filter down your table to one sample and then filter your rep-seqs using your table.
Run this but there should only be one sample in your metadata.

Then run this to filter down to your one sample table.

That should allow you to blast the sequences for each sample.

1 Like

This worked! Thank you for your help. Some of my confusion was that the filtered vs unfiltered repseqs files looked very similar, but when looking closer I noticed that it did indeed filter, but this particular sample just has many more sequences compared to the other samples!

1 Like

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