# How to remove primer and index from demux.qza

**URL:** https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162
**Category:** Technical Support
**Tags:** demux, trim, primers, cutadapt
**Created:** [April 19, 2023, 1:53pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162 "2023-04-19T13:53:37Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [April 19, 2023, 1:53pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/1 "2023-04-19T13:53:37Z")

</div>

I have imported my raw sequences using manifest files. But Now problem is how I will remove primer and index sequences from my samples. Is it possible to remove from demux.qza. If not How I will then process my raw reads. Please help me. I am attaching below my index sequences and forward and reverse sequences.

 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/c/c5284d32929b3bb936822a30c3b464d68a89e55d.png)

My primer sequences  
 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/2/2d123fcd2e22e6ac3fb4491c878581b7cb4c52a6.png)  
Please help me!  
@timanix @gregcaporaso

Thanks  
Rishikesh

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [April 19, 2023, 4:16pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/2 "2023-04-19T16:16:14Z")

</div>

Hi @Rishikesh12,  
Here is a [cutadapt tutorial](https://forum.qiime2.org/t/demultiplexing-and-trimming-adapters-from-reads-with-q2-cutadapt/2313). This will help with trimming primers off your sequences and there is a option to use demultiplexed sequences as input!

Hope that helps!  
🐢

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [April 20, 2023, 3:20am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/3 "2023-04-20T03:20:36Z")

</div>

Yes But How to remove this index sequences how I will map a tsv file so that it can read these index sequences and remove it.

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [April 20, 2023, 5:50pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/4 "2023-04-20T17:50:31Z")

</div>

Hi @Rishikesh12  
You will hand in your metadata and barcode/index column name to q2-cutadapt and it will map those indexes and trim them for you!

hope that helps!  
🐢

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [April 21, 2023, 6:24am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/5 "2023-04-21T06:24:13Z")

</div>

![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/8/845bbabc7daeadd33f2bc3844103b3493b01baca.png)  
In Above image could you please tell me where I will map my metadata. If I will make meta data file like this  
 ![image](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/2/266dcf6dee4e952af4ff9898df9af6f79cb47cda.png)  
It will take or not. Then for primer should I make two more column with reverse and forward heading?

Please tell me in which option I will map my metadata.

Thank You  
Rishikesh

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [April 21, 2023, 6:32pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/6 "2023-04-21T18:32:53Z")

</div>

Hi @Rishikesh12,  
it looks like i\_7 and i\_5 are typical dual index barcode names. i\_5\_1 and i\_5\_2 are reverse compliments of each other so i am not sure which one is in your sequences, but its one of those.

You will provide your metadata and your forward barcode column to these parameters

 ![Screenshot 2023-04-21 at 11.28.47 AM](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/c/cb6d58c2de93a11a174c4ca80281b1869f55b07b.png)  
and provide your metadata and your reverse barcode column to these parameters  
 ![Screenshot 2023-04-21 at 11.31.02 AM](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/e/ee06b2cf5ca06a5e5214c7a6ed10d7cb1918aa64.png)

Hope that helps!  
🐢

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [April 22, 2023, 6:01am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/7 "2023-04-22T06:01:19Z")

</div>

Thank You so much for your help. I will try this, But is there any way that I can know my barcodes are removed from raw reads or not. So that I can play with by changing the column of `index_5_1` with `index_5_2`. Now last but not least can you please tell me how i will remove my primers, which option i will use. My forward primer is - `GTACTCCTACGGGAGGCAGCA` and my reverse primer is - `GTGGACTACHVGGGTWTCTAAT`

Thank You  
Rishikesh

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [April 24, 2023, 3:10pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/8 "2023-04-24T15:10:17Z")

</div>

Hi @Rishikesh12,  
qiime cutadapt trim-paired should do the trick. [trim-paired: Find and remove adapters in demultiplexed paired-end sequences. — QIIME 2 2023.2.0 documentation](https://docs.qiime2.org/2023.2/plugins/available/cutadapt/trim-paired/)

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [May 2, 2023, 10:59am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/9 "2023-05-02T10:59:48Z")

</div>

I face this issue while removing barcodes from my demux file.

```auto
(1/1) Invalid value for '--i-seqs': Expected an artifact of at least type
  MultiplexedPairedEndBarcodeInSequence. An artifact of type
  SampleData[PairedEndSequencesWithQuality] was provided.

```

Firstly I trimmed primer sequences from my demux file using that cutadapt trim-paired option there after I want to remove my barcode sequences. but unable to trim it. and Got error, which was i have mentioned above.  
My command is

> qiime cutadapt demux-paired \
> 
> > --i-seqs trimmed\_demux.qza   
> > --m-forward-barcodes-file Index\_file.txt   
> > --m-forward-barcodes-column index\_i7   
> > --m-reverse-barcodes-file Index\_file.txt   
> > --m-reverse-barcodes-column index\_i5\_1   
> > --p-cores 4   
> > --o-per-sample-sequences trim\_new\_demux.qza   
> > --o-untrimmed-sequences remove-barcodes.qza

Thank you  
Rishi

---

<div class="post-metadata">

### Author: ![lizgehret](https://forum.qiime2.org/user_avatar/forum.qiime2.org/lizgehret/32/17128_2.png) [@lizgehret](https://forum.qiime2.org/u/lizgehret)
#### Post date: [May 3, 2023, 3:38pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/10 "2023-05-03T15:38:17Z")

</div>



---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [May 3, 2023, 6:09pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/11 "2023-05-03T18:09:09Z")

</div>

Hi @Rishikesh12,

Basically what this error is saying is that your input for `qiime cutadapt demux-paired` is already demultiplexed. You need to input multiplexed data into `qiime cutadapt demux-paired` so that the command can demultiplex your data.  
I can see two ways this possibly happened. However I am not sure exactly what steps you took given the information you provided.

1. You imported already demultiplexed data. If this happened you would probably not have barcodes in your sequences and you would just skip the `qiime cutadapt demux-paired` command.
2. You imported multiplexed sequences and then you ran a command that demultipexed your sequence. Then you used cutadapt trim-paired and now you are trying to demultiplex again.  
If this is the case, I would highly suggest that you re-read the [Demultiplexing and Trimming Adapters from Reads with q2-cutadapt](https://forum.qiime2.org/t/demultiplexing-and-trimming-adapters-from-reads-with-q2-cutadapt/2313) tutorial that I linked above and here. These steps need to be followed in a specific order or else the types of inputs are going to be wrong like you see in the error message you sent.

In order to help you more on this, I would need to know all the commands that you ran to get to this error. Please list all of them in your next reply.

Hope this helps!  
🐢

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [May 3, 2023, 6:09pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/12 "2023-05-03T18:09:16Z")

</div>



---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [May 8, 2023, 10:13am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/13 "2023-05-08T10:13:22Z")

</div>

Thank You for your guidance.

Regards  
Rishi

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [May 10, 2023, 6:36am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/14 "2023-05-10T06:36:58Z")

</div>

I have tried using the Cutadapt plugin to demultiplex my samples and remove primers. However, after following the Cutadapt plugin tutorial, I noticed that the quality of my reads was poor, and there was a significant loss in the number of reads per sample. I would appreciate it if you could take a look into this issue.  
As per your suggestion, I experimented with the reverse barcodes by using `index_i5_1` and `index_i5_2`. I have attached the quality of reads below. Please note that I demultiplexed both `trim-seqs-1` and `trim-seqs-2` separately. trim-seqs-1 is after removing index\_i5\_1 and trim-seqs-2 is after removing index\_i5\_2.

 ![trim-seqs-1.qzv](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/5/50e9bdb85f235e5fabd745823e93c3f6d0ceedea.png)  
 ![trim-seqs-2.qzv](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/0/08f1d572a825542d27b3e03d70100b438e001bc2.png)  
command for demultiplexing

qiime cutadapt demux-paired \

> --i-seqs multiplexed-seqs.qza   
> --m-forward-barcodes-file Index\_file.txt   
> --m-forward-barcodes-column index\_i7   
> --m-reverse-barcodes-file Index\_file.txt   
> --m-reverse-barcodes-column index\_i5\_2   
> --p-error-rate 0   
> --o-per-sample-sequences demultiplexed-seqs-2.qza   
> --o-untrimmed-sequences untrimmed-2.qza   
> --verbose

 ![trim-seqs-1.qzv](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/4/433d57b850b95c648f432bd3fbd0494579741779.png)  
 ![trim-seqs-2.qzv](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/2X/8/8a9d2c43dc167ff17a59e83033592475bf1a67b6.png)

Thanks  
Rishi

---

<div class="post-metadata">

### Author: ![cherman2](https://forum.qiime2.org/user_avatar/forum.qiime2.org/cherman2/32/17129_2.png) [@cherman2](https://forum.qiime2.org/u/cherman2)
#### Post date: [May 10, 2023, 4:56pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/15 "2023-05-10T16:56:24Z")

</div>

Hi @Rishikesh12,  
I agree, these are not very strong read qualities. I would say that trim-seqs-2 looks like it uses the right barcodes. There reason I say this is because your sequence counts for trim-seqs-2 are evenly distributed across samples. In trim-seqs-1, we are seeing that most samples only ended up with a few sequences which leads me to think there was a barcode mismatch.

As for the quality, there is not much to be done at this point. Sometimes the quality is the quality and there is not a lot that can be done. 🤷 Sorry to not be much help on that front. My advise would be to mess around with dada2 trim/trunc and filtering parameters to try to optimize the amount of reads you can keep.

Again, sorry to not be more helpful!  
🐢

---

<div class="post-metadata">

### Author: ![Rishikesh12](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/r/94ad74/32.png) [@Rishikesh12](https://forum.qiime2.org/u/Rishikesh12)
#### Post date: [May 12, 2023, 10:32am UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/16 "2023-05-12T10:32:41Z")

</div>

😕 😟 Ok I will check with dada2 parameters.

Thank you for your help.

---

<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 12, 2023, 4:33pm UTC](https://forum.qiime2.org/t/how-to-remove-primer-and-index-from-demux-qza/26162/17 "2023-06-12T16:33:02Z")

</div>

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