# Discarded results produced by q2-cutadapt's trim-paired when working with mixed-orientation reads

**URL:** https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570
**Category:** Announcements
**Tags:** data-integrity-bug
**Created:** [November 24, 2020, 2:13pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570 "2020-11-24T14:13:47Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![q2d2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/q2d2/32/613_2.png) [@q2d2](https://forum.qiime2.org/u/q2d2)
#### Post date: [November 24, 2020, 2:13pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/1 "2020-11-24T14:13:47Z")

</div>

## Summary

We recently discovered a bug related to the `q2-cutadapt` plugin's `demux-paired` command that, in certain situations, can unnecessarily discard a significant portion of reads, when the command is run with the `--p-mixed-orientation` flag.

## Impact

This issue impacts the following versions of `q2-cutadapt`:

- 2020.6
- 2020.8

If you think you may have been impacted please check your provenance at [https://view.qiime2.org](https://view.qiime2.org) for the versions listed above to verify that you ran `demux-paired` with the `mixed-orientation` flag enabled (we are happy to help with identification, please share a `demux summarize` visualization with us).

## Details

Mixed orientation reads are produced by some sequencing protocols, where R1 and R2 multiplexed files don't necessarily correspond to forward and reverse reads (that is to say, the orientation is "mixed" in both files). In general we haven't seen this strategy very often (but if you use this, let us know - we'd like to learn more about the use case for this functionality)!

Internally, q2-cutadapt follows a mixed-orientation demux protocol based on:

> **[\--revcomp - User guide — Cutadapt 5.2 documentation](https://cutadapt.readthedocs.io/en/stable/guide.html#demultiplexing-paired-end-reads-in-mixed-orientation)**
>
> Cutadapt supports demultiplexing, which means that reads are written to different output files depending on which adapter was found in them. To use this, include the string {name} in the name of the output file and give each adapter a name. The path...

Essentially, we demux the mixed-orientation reads in two rounds. In the first round we treat R1 and R2 as forward and reverse reads, respectively, as in a typical paired-end demultiplexing workflow. This will produce per-sample demultiplexed R1 and R2 files, as well as new multiplexed files ("unknown"), containing all of the reads that weren't able to be demultiplexed. We then demultiplex the unknown reads, but swapping R1 and R2 so that R2 is treated as the forward reads and R1 as the reverse reads in the second demultiplexing round.

While making unrelated changes to q2-cutadapt, we discovered that on the second demultiplexing round, rather than appending reads to the results of the first round of demultiplexing, we were overwriting those results. As a result, any reads that were demultiplexed in round 1 were discarded, if additional reads were matched to a sample during round 2.

## Resolution

We have [implemented a fix for this issue](https://github.com/qiime2/q2-cutadapt/pull/41) which will be available next week as part of the QIIME 2 2020.11 release.

We apologize for any inconvenience this may have caused, and are happy to discuss further if you have any questions, or need help determining if you have been impacted by this bug.

---

<div class="post-metadata">

### Author: ![alison](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/a/e0b2c6/32.png) [@alison](https://forum.qiime2.org/u/alison)
#### Post date: [March 2, 2021, 2:52pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/2 "2021-03-02T14:52:27Z")

</div>

I have data like this!

I wasn't involved in generating it - but I think the background was that at the time it was cheaper/easier to ligate on the barcodes and sequencing adaptors after amplifying all samples with the same primers, as compared to incorporating all that into really long primers.

In Qiime1 we used to just run demultiplexing twice, followed by reverse complimenting one set and then concatenating them - just getting started with Qiime2.

With cut-adapt and the mixed-orientation flag, will the reads which are "backwards" (found in the second round) get reverse-complimented and switched R1/R2, before they are combined with the "forwards" ones, or do you end up with a mix of orientations in the output fastq files?

---

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [March 2, 2021, 4:43pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/3 "2021-03-02T16:43:39Z")

</div>

Hi @alison,

You can use this approach and see if it helps:

> [@q2-cutadapt output](https://forum.qiime2.org/t/q2-cutadapt-output/17031/24):
>
> Good news @jessica.song! I think I solved this. fireworks First, thank you for sending me the PDF describing the protocol. I noticed a key statement: pairs of primers (Fw-Rev or Rev-Fw) had to be present in the sequence fragments That is, this particular sequencing facility must expect mixed orientation reads. rotating_light Therefore you need to enter in both primers for each of the --p-front-\* commands (in 5' - 3' orientation). dna Like so: qiime cutadapt trim-paired \ --i-demu…

-Mike

---

<div class="post-metadata">

### Author: ![alison](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/a/e0b2c6/32.png) [@alison](https://forum.qiime2.org/u/alison)
#### Post date: [March 3, 2021, 9:30am UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/4 "2021-03-03T09:30:05Z")

</div>

> [@q2-cutadapt output](https://forum.qiime2.org/t/q2-cutadapt-output/17031/24):
>
> `qiime cutadapt trim-paired`

Thanks Mike!

That seems like it will work to get all the primers removed. But half of the sequences would still be in the reverse orientation, right? I'll be using dada2 to denoise and make ASV's - would having half of the sequences reversed make problems, or is dada2 able to take that possibility into consideration?

---

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [March 3, 2021, 4:39pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/5 "2021-03-03T16:39:54Z")

</div>

> [@alison](#):
>
> would having half of the sequences reversed make problems

I forgot that the issue outlined here appears to have been fixed in [qiime2-2020.11](https://forum.qiime2.org/t/qiime-2-2020-11-is-now-available/17711). So you should be fine.

However, if you ever run into a case in which you need to re-orient your sequences you can use [RESCRIPt's `orient-seqs`](https://forum.qiime2.org/t/processing-filtering-and-evaluating-the-silva-database-and-other-reference-sequence-data-with-rescript/15494#heading--thirteenth-header) command.

EDIT: I forgot that the `orient-seqs` command will currently only run on FASTA inputs. We hope to work on a solution for FASTQ.

-Mike

---

<div class="post-metadata">

### Author: ![Lamm-a](https://forum.qiime2.org/user_avatar/forum.qiime2.org/lamm-a/32/14078_2.png) [@Lamm-a](https://forum.qiime2.org/u/Lamm-a)
#### Post date: [September 8, 2022, 3:58pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/6 "2022-09-08T15:58:19Z")

</div>

Hi @SoilRotifer

So to clarify, Alison's concern of half the reads being in the reverse complement is no longer an issue? That being as part of this function, it would re-orient any miss oriented read?

-Rob

---

<div class="post-metadata">

### Author: ![Pikula](https://forum.qiime2.org/user_avatar/forum.qiime2.org/pikula/32/16769_2.png) [@Pikula](https://forum.qiime2.org/u/Pikula)
#### Post date: [July 10, 2023, 3:37pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/8 "2023-07-10T15:37:07Z")

</div>

I have the same question as Lamm-a.  
@SoilRotifer @Nicholas_Bokulich Does "qiime cutadapt trim-paired" re-orient the sequence or it is not yet possible to do in Qiime2 as RESCRIPt's orient-seqs command works only on FASTA file?

---

<div class="post-metadata">

### Author: ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)
#### Post date: [July 10, 2023, 3:51pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/9 "2023-07-10T15:51:59Z")

</div>

> [@Pikula](#):
>
> RESCRIPt's orient-seqs command works only on FASTA file?

Currently, this is still the case.

---

<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: [July 13, 2023, 6:44pm UTC](https://forum.qiime2.org/t/discarded-results-produced-by-q2-cutadapts-trim-paired-when-working-with-mixed-orientation-reads/17570/10 "2023-07-13T18:44:18Z")

</div>

3 off-topic replies have been split into a new topic: [RESCRIPt: accepting FASTQ as input to `orient-seqs`](https://forum.qiime2.org/t/rescript-accepting-fastq-as-input-to-orient-seqs/27064)

Please keep replies on-topic in the future.
