# How to address multiple controls, in which a particular control relates to only one sample?

**URL:** https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944
**Category:** User Support
**Tags:** contaminant, filtering
**Created:** [April 26, 2018, 6:16pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944 "2018-04-26T18:16:08Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![fstudart](https://forum.qiime2.org/user_avatar/forum.qiime2.org/fstudart/32/6430_2.png) [@fstudart](https://forum.qiime2.org/u/fstudart)
#### Post date: [April 26, 2018, 6:16pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/1 "2018-04-26T18:16:08Z")

</div>

Hi Everyone,

In the past, I have filtered out sequences from my samples that were found in controls (PCR blank control), using the amazing support offered here in the forum ([MOCK sample and PCR blanks - #14 by Nicholas\_Bokulich](https://forum.qiime2.org/t/mock-sample-and-pcr-blanks/1113/14)). For this approach, the same control was related to a set of samples, making it easier to remove potential contaminants.

I just received another dataset with several fastaq files, which are actually bronchoalveolar lavage (BAL) samples. For this study, for each BAL sample, before the procedure started, a channel wash from the scope (saline) had been collected. So each channel wash control relates to only one BAL sample.

So, I'd like to filter out the sequences in each pair of samples (channel wash --\> BAL sample).

Which would be the easiest way to address this?

Thanks in advance,  
FS

---

<div class="post-metadata">

### Author: ![antgonza](https://forum.qiime2.org/user_avatar/forum.qiime2.org/antgonza/32/1236_2.png) [@antgonza](https://forum.qiime2.org/u/antgonza)
#### Post date: [April 27, 2018, 2:06pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/2 "2018-04-27T14:06:51Z")

</div>



---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [April 30, 2018, 10:48pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/3 "2018-04-30T22:48:48Z")

</div>

Hey there @fstudart!

> [@fstudart](#):
>
> So, I’d like to filter out the sequences in each pair of samples (channel wash --\> BAL sample).

Just a quick word of caution here - this process isn't without its own caveats - you risk filtering out relevant biological signal. There is a lot of discussion from @Nicholas_Bokulich sprinkled [all throughout the forum](https://forum.qiime2.org/search?q=contaminants) on this topic, he goes into a bit more detail about some of these considerations.

Okay, with that caveat out of the way...

> [@fstudart](#):
>
> Which would be the easiest way to address this?

I can't think of a particularly easy way to filter, because it sounds like this is a paired-sample approach (please correct me if I misunderstood!).

I think, it would look like this:

1. For each sample (BAL set and channel wash set), filter the feature table & representative sequences to just that particular sample. You will wind up with one feature table and one rep-seqs file per sample (2 \* n samples).
2. For each sample pair:  
a) filter your sequences to exclude the features found in the wash sample.  
b) filter your feature table to only include the features left in the filtered sequences
3. Recombine all of your rep-seqs & all of your feature tables

Yikes, that sounds like a lot of work!

@Nicholas_Bokulich or @ebolyen might have some alternative suggestions.

Keep us posted! 🦖

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [April 30, 2018, 10:49pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/4 "2018-04-30T22:49:22Z")

</div>



---

<div class="post-metadata">

### Author: ![fstudart](https://forum.qiime2.org/user_avatar/forum.qiime2.org/fstudart/32/6430_2.png) [@fstudart](https://forum.qiime2.org/u/fstudart)
#### Post date: [May 3, 2018, 5:15pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/5 "2018-05-03T17:15:02Z")

</div>

Hi @thermokarst,

Thanks for your feedback. Our idea is to to a paired-sample approach, as we are considering that any sequences found in the channel wash for a particular sample should be considered potential contaminants. To do this, I'd have to the sames steps for each sample (one by one). I'm just wondering if it would be possible to use a script inside Qiime2 to do these filtering steps and merging the reads automatically.

Thanks,  
Fernando Studart

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [May 4, 2018, 11:57am UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/6 "2018-05-04T11:57:20Z")

</div>



---

<div class="post-metadata">

### Author: ![colinbrislawn](https://forum.qiime2.org/user_avatar/forum.qiime2.org/colinbrislawn/32/6221_2.png) [@colinbrislawn](https://forum.qiime2.org/u/colinbrislawn)
#### Post date: [May 4, 2018, 6:47pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/7 "2018-05-04T18:47:50Z")

</div>

Hello Fernando,

Matt already mentioned to this, but while removing contamination using controls sounds easy, it's really hard to do well and [has unintended consequences](https://forum.qiime2.org/t/filter-controls-or-not-to-filter-controls/1832). Be careful! 🙀

> [@fstudart](#):
>
> I’m just wondering if it would be possible to use a script inside Qiime2 to do these filtering steps and merging the reads automatically.

Yes! The [`qiime quality-control evaluate-composition`](https://docs.qiime2.org/2018.4/tutorials/quality-control/#evaluating-quality-of-samples-with-known-composition) plugin comes to mind. Let's see what @ebolyen recommends.

* * *

Or maybe you could treat your controls like a treatment group. In this method, you keep all your samples in your cohort, but when you perform statistical testing, you pass Treatment (channel wash control vs real sample) along with your main biological categories. When you get the results, you will be able to compare the effect size of biological differences like pH, timepoint to the artificial differences (channel wash control vs real sample). Plugins like [`qiime longitudinal`](https://docs.qiime2.org/2018.4/tutorials/longitudinal/?) should elegantly support this.

Let me know what you think! I'm also curious how @ebolyen would make use of matched negative controls. 🤔

Colin

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [May 8, 2018, 6:03pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/8 "2018-05-08T18:03:52Z")

</div>

I don't think I have any particularly great advice on the topic, your suggestion of tracking via metadata sounds like a good way to know if there is a problem. It may also be worth checking out this preprint:

> **[Simple statistical identification and removal of contaminant sequences in...](https://www.biorxiv.org/content/10.1101/221499v1)**
>
> The accuracy of microbial community surveys based on marker-gene and metagenomic sequencing (MGS) suffers from the presence of contaminants — DNA sequences not truly present in the sample. Contaminants come from a variety of sources, including...

It uses control samples and frequencies to identify contamination, but it's not available in QIIME 2 (yet!).

---

<div class="post-metadata">

### Author: ![ebolyen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ebolyen/32/11_2.png) [@ebolyen](https://forum.qiime2.org/u/ebolyen)
#### Post date: [May 8, 2018, 6:03pm UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/9 "2018-05-08T18:03:55Z")

</div>



---

<div class="post-metadata">

### Author: ![fstudart](https://forum.qiime2.org/user_avatar/forum.qiime2.org/fstudart/32/6430_2.png) [@fstudart](https://forum.qiime2.org/u/fstudart)
#### Post date: [May 9, 2018, 12:03am UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/10 "2018-05-09T00:03:59Z")

</div>

Thanks for the suggestion. I'm going to check this composition plugin.

Thanks very much,  
FS

---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [June 9, 2018, 6:03am UTC](https://forum.qiime2.org/t/how-to-address-multiple-controls-in-which-a-particular-control-relates-to-only-one-sample/3944/11 "2018-06-09T06:03:59Z")

</div>

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