# Replace barcode sequence with sample-Id

**URL:** https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314
**Category:** User Support
**Tags:** demux
**Created:** [March 5, 2018, 2:26pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314 "2018-03-05T14:26:23Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![M.Amine.Hassan](https://forum.qiime2.org/user_avatar/forum.qiime2.org/m.amine.hassan/32/19996_2.png) [@M.Amine.Hassan](https://forum.qiime2.org/u/M.Amine.Hassan)
#### Post date: [March 5, 2018, 2:26pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/1 "2018-03-05T14:26:23Z")

</div>

**Hello,**  
**I would like to analyze my MiSeq data with qiime2, but I am encounrteringf challenges.**  
I have demux reads barcoded in the reverse which are indicated below,\*\*

$ head Undetermined\_R1  
@M03511:188:000000000-BN34F:1:2106:8954:1142 1:N:0:NTNNNCCTAAAT  
TGGTAGTCCATGCCGTAAACGATNAGNNNNCGCCCTTGGTCTACNCNNACCAGGGGCCNNNNNNNCGCGTGAAACACTCCGCNNGGGGAGNACGGNTNCAAGACCNNANCTCAAAGGAATTGACGGGGNNCNNNACAAGCGGTNGANNNNNNNNNTTAATTCGATGATACNNNNNNAACCTTACCANGGCNNNNNNNNAGACTGACCNNTNNGNNNNCAGATCTNNNGNNNNACAGTTTANNNNNNNNTNNNTNGTTGTCGNNNNNNNGTGCCGTGAGGTGGNNNNNNNNNTCNNNTAACG  
+  
CCCCCGGGGGGGGGGGGGGGGGG#=C####::DFGGGGGGGGGG#:##::FGGGGGGG#######::CFFGGGGGGGGGGGG##:CFGGG#:CFG#:#:CFGGGG##:#::DFGGGGGGGGGGGGGGG##:###::AFFGGGF#:6#########88@FGFGGGGGGGGF######66@BFGGGEG#6\>:########44=EFCFG\<##/##1####_2:C8DF###/####22:DGDG:########_###0#0.\<:?D:#######(-((49?F0\<?B?(#########--###,--2,

$ head Undetermined\_R2  
@M03511:188:000000000-BN34F:1:2106:8954:1142 2:N:0:NTNNNCCTAAAT  
TCAAAGTTTGCNNNNNNNGTNTTGTTAGAGNNCNNNNNNNNNNTNNCTGGCAANNNNNNNCAGGGGTTGCGCTNNNNNNNNGACTTAACCTGACNNNNNNNNGCACGAGCTGACGNCANNNNNGCNNCACCTTGTAANNNGTNNTGCGAAANNTCTNNNNNNNAATCGGTCANNNNNNNTTTAAGCCTTGGTAAGGTTCCTCGCGTANNNNNNNATTAAACNNNNNNNTCCNCCCNNNNNNNNGGCCCCCNNCAANTCCTTTGGNTTNCGNNNNNGCAACCGTTNNNNNNNGGCGGNGNNT  
+  
CCC\<CGGGGGG#######:=#=CFGGGGGG##:##########6##::DFGGG#######::CFGGGGGGGGE########::CAFGGGGG=FF########9:AFFGDGFGGGG#9A#####88##88DFGGGGGG###66##86AEFEG##+6@#######55@F9EEEA#######44=CFGGGGGGGGGGGGGGGGFFFF4?1#######21:=\>A\*#######(2-#-4(########-(-8?49##--(#--4044:(#-4#((#####(--(449?(#######(---3#-##(

**I do not have a barcode.fastq file but I do know the sequence of my barcodes (96 barcode sequences, 12nt)**

$ head map\_file.txt  
#SampleID BarcodeSequence LinkerPrimerSequence Description  
T0.A.MockArea TCCCTTGTCTCC AGATCGGAAGAGCACACGTCTGAACTCCAGTCA

\*\*I am able to import the sequences using [manifest](https://docs.qiime2.org/2017.12/tutorials/importing/#fastq-manifest-formats), however, I am not able to rename/append the SampleID in the sequences header for downstream analysis and it seems for me that this step is only done by qiime [demux](https://docs.qiime2.org/2018.2/tutorials/atacama-soils/) emp-paired. \*\*  
\*\*Also, I would like to select only the 96 barcode sequences from the pull of reads that I have in the fastq. \*\*  
**Is there a work around this issue using qiime2?**  
**Many thanks for the help**

---

<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: [March 5, 2018, 2:45pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/2 "2018-03-05T14:45:39Z")

</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: [March 6, 2018, 12:23am UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/3 "2018-03-06T00:23:31Z")

</div>

Hi @M.Amine.Hassan!

> [@M.Amine.Hassan](#):
>
> I have demux reads

Are you sure your reads are demultiplexed? Just double-checking, because those filenames imply otherwise.

If they are demultiplexed, you should be able to import them using the manifest format, and you can rename the sample IDs using the first column (`sample-id`) of the manifest file. This column is the sample-id _after importing_! That is how you go about re-identifying your samples.

Once you have imported your demuxed reads, you can use [`q2-cutadapt`](https://docs.qiime2.org/2018.2/plugins/available/cutadapt/trim-paired/) to trim off your barcodes, and any other primers that might be present.

Let us know how that goes for you! 🦖

---

<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: [March 6, 2018, 12:23am UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/4 "2018-03-06T00:23:33Z")

</div>



---

<div class="post-metadata">

### Author: ![M.Amine.Hassan](https://forum.qiime2.org/user_avatar/forum.qiime2.org/m.amine.hassan/32/19996_2.png) [@M.Amine.Hassan](https://forum.qiime2.org/u/M.Amine.Hassan)
#### Post date: [March 7, 2018, 3:02pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/5 "2018-03-07T15:02:36Z")

</div>

I am sorry, but I think I have misstated the question.  
The manifest renames the file.fastq.

$ head manifest  
sample-id,absolute-filepath,direction  
Run1,$PWD/Undetermined\_R1.fastq,forward.

When I generate the qzv, I could see run1 but no hint for the 96 samples.

What I am specifically asking for is that in the in downstream analysis (filtering - otu table) I could not identify the 96 sample Ids provided in the map\_file.txt (i.e. Mock1, Condition1 ...ect)

$ head map\_file.txt  
#SampleID BarcodeSequence LinkerPrimerSequence Description  
Mock1 TCCCTTGTCTCC AGATCGGAAGAGCACACGTCTGAACTCCAGTCA  
Condition1 TCCCTTGTCTCC AGATCGGAAGAGCACACGTCTGAACTCCAGTCA

At anystep described so far I used the map\_file.txt to indicated which barcode sequence correspond to which sample (Mock/Condition) as indicated in the [Moving Pictures](https://docs.qiime2.org/2018.2/tutorials/moving-pictures/)

qiime demux emp-single   
--i-seqs emp-single-end-sequences.qza   
--m-barcodes-file sample-metadata.tsv   
--m-barcodes-column BarcodeSequence   
--o-per-sample-sequences demux.qza

Unless you are suggesting here that I should split my reads by Barcode-Sequnce each in a fastq file, like All reads to Mock1 are in Mock1.fasta ...ect and import all of these as sequences using manifest?

---

<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: [March 7, 2018, 3:06pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/6 "2018-03-07T15:06:41Z")

</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: [March 7, 2018, 9:11pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/7 "2018-03-07T21:11:13Z")

</div>

Hi @M.Amine.Hassan!

> [@M.Amine.Hassan](#):
>
> I think I have misstated the question.
> 
> The manifest renames the file.fastq.

Did you see my question above? I will copy it here in case:

> [@thermokarst](#):
>
> Are you sure your reads are demultiplexed? Just double-checking, because those filenames imply otherwise.

The manifest format is only for already demultiplexed data. It really sounds like your reads aren't demultiplexed, but if you could confirm one way or the other, that would be great. If they aren't demultiplexed, we should be able to import as `MultiplexedPairedEndBarcodeInSequence`, and follow along with the [q2-cutadapt community tutorial](https://forum.qiime2.org/t/demultiplexing-and-trimming-adapters-from-reads-with-q2-cutadapt/2313) to demultiplex these reads.

This is similar to what was suggested to you above:

> [@M.Amine.Hassan](#):
>
> At anystep described so far I used the map\_file.txt to indicated which barcode sequence correspond to which sample (Mock/Condition) as indicated in the Moving Pictures

but I don't think your multiplexed reads are in EMP format, so we can't use the command suggested to you.

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: [March 7, 2018, 9:11pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/8 "2018-03-07T21:11:19Z")

</div>



---

<div class="post-metadata">

### Author: ![M.Amine.Hassan](https://forum.qiime2.org/user_avatar/forum.qiime2.org/m.amine.hassan/32/19996_2.png) [@M.Amine.Hassan](https://forum.qiime2.org/u/M.Amine.Hassan)
#### Post date: [March 8, 2018, 3:42pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/9 "2018-03-08T15:42:32Z")

</div>

> [@thermokarst](#):
>
> The manifest format is only for already demultiplexed data. It really sounds like your reads aren’t demultiplexed, but if you could confirm one way or the other, that would be great. If they aren’t demultiplexed, we should be able to import as MultiplexedPairedEndBarcodeInSequence, and follow along with the q2-cutadapt community tutorial to demultiplex these reads.

Indeed, the reads aren't demultiplexed and I could follow the [q2-cutadapt community](https://forum.qiime2.org/t/demultiplexing-and-trimming-adapters-from-reads-with-q2-cutadapt/2313) tutorial.  
However, this rises the another [issue](https://forum.qiime2.org/t/cutadapt-with-barcodes-in-reverse-read/3310/3)  
Thanks for the 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: [April 8, 2018, 9:42pm UTC](https://forum.qiime2.org/t/replace-barcode-sequence-with-sample-id/3314/10 "2018-04-08T21:42:34Z")

</div>

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