# Using trim.seqs with several primers

**URL:** https://forum.mothur.org/t/using-trim-seqs-with-several-primers/673
**Category:** Commands in mothur
**Created:** [October 12, 2011, 11:01am UTC](https://forum.mothur.org/t/using-trim-seqs-with-several-primers/673 "2011-10-12T11:01:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![roey.angel](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@roey.angel](https://forum.mothur.org/u/roey.angel)
#### Post date: [October 12, 2011, 11:01am UTC](https://forum.mothur.org/t/using-trim-seqs-with-several-primers/673/1 "2011-10-12T11:01:23Z")

</div>

Hello,  
I’ve sequenced a mixture of PCR products using 454 titanium.  
The PCR products were synthesised using both archaea and bacteria primers (each pair had individual barcodes) and the 454 adapters were later ligated.  
As a result, I ended up with an output file in which each sequence contains one the 4 primers and some sequences contain both primers of one domain.

As I understood, preparing the oligos file in this format:  
forward CATGCTGCCTCCCGTAGGAGT  
reverse TCAGAGTTTGATCCTGGCTCAG  
barcode AACCAACC ALP50M  
barcode AACCAAGG AZAC1  
barcode AACCATCG ALP2B  
barcode AACCATGC ALP1B  
barcode AACCGCAT ALP80M  
barcode AACCGCTA ALPG2  
barcode AACCGGAA AZ273  
…

and parsing it to trim.seqs() will cause mothur to search for files that contain the forward AND the reverse and throw away those that contain only one of them (or none of them).

I’m looking for an option to parse an oligo file in the following format:  
bac\_forward CATGCTGCCTCCCGTAGGAGT  
bac\_reverse TCAGAGTTTGATCCTGGCTCAG  
arc\_forward TCGYGCASCAGKCGMGAAW  
arc\_reverse CAGGACTACVSGGGTATCTAAT  
barcode AACCAACC ALP50M  
…

And have mothur process it as: find bac\_forward AND/OR bac\_reverse OR arc\_forward AND/OR arc\_reverse.  
So that mothur will recognise all sequences containing only bac\_forward OR only bac\_reverse OR bac\_forward AND bac\_reverse (in revcom form) OR bac\_forward (in revcom form) AND bac\_reverse …

Is that possible in any way?  
Even processing only one pair at a time will do.  
how do people normally deal with sequences produced using ligated adapters?

Thanks in advance,  
Roey

---

<div class="post-metadata">

### Author: ![pschloss](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/pschloss/32/4_2.png) [@pschloss](https://forum.mothur.org/u/pschloss)
#### Post date: [October 14, 2011, 8:01pm UTC](https://forum.mothur.org/t/using-trim-seqs-with-several-primers/673/2 "2011-10-14T20:01:00Z")

</div>

Sounds like a headache. 🙂 I’d say 99% of people are not using ligated adapters but rather have primers synthesized with the adapter, barcode, and primer (in that order). With the ligation you have to do an extra few rounds of PCR that does who knows what to the relative abundances.

To do what you’d want to do, you’d probably want to do something like trim.seqs with the forward primers and flip the sequences. Using the trim.fasta output you’d then run trim.seqs again but with the reverse primers and flip the sequences. You could then also take the original fasta file, trim.seqs with the reverse primers and flip and then run trim.seqs with the forward primers. At this point, I think the sequences would all be in the right direction. You’d have to merge the fasta files and the group files. It might be easier to just write your own scripts to parse this stuff…

Hope this helps,  
Pat

---

<div class="post-metadata">

### Author: ![roey.angel](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@roey.angel](https://forum.mothur.org/u/roey.angel)
#### Post date: [October 19, 2011, 12:25pm UTC](https://forum.mothur.org/t/using-trim-seqs-with-several-primers/673/3 "2011-10-19T12:25:28Z")

</div>

Thanks for the reply.  
I used ligation because I was analyzing 168 samples in parallel.  
Over here in Germany a biotin tagged primer costs about 100 euro a piece, which would make the synthesis costs quite high.

In the end I used trim.seqs twice (one for each domain) and the oligo file contained both fwd and rev primers (5’-3’) but I labelled both ‘forward’ this seems to do the trick.  
Only a negligible number of sequences had the full contig containing both primers so I could skip having to remove the rev-comp version of each primer.

Does it sound reasonable?

Thanks again,  
Roey
