Removal of 2 barcodes and 2 primers using trim.seqs


I have aligned fasta files that I need to remove barcodes and primers. After going over the wiki on trim.seqs it seems that you can only remove one primer and one barcode at a time. Make.contigs would remove 2 primers and 2 barcodes but it will align the sequences, which has already been done in this case. Is there another option? If trim.seqs can remove all at once, could you please provide me with an example of the oligos file?

Many thanks,


Here’s a link to mothur’s oligos file page, The trim.seqs command can trim paired barcodes and primers.

Great, thank you

Just realized I don’t know if trim.seqs can trim several files at the same time as make.contigs does. With make.contigs one does not have to specify a fasta file as long as the file option is in the command. With trim.seqs a fasta file is mandatory and there are a few of them. Do I create a loop or is there a way trim.seqs can do this.
I tried this loop but it didn’t work:

for a in *.trim.contigs.fasta; do mothur “#trim.seqs(fasta=trim.contigs.fasta, oligos=symbiota.oligos.txt, maxambig=0, maxhomop=4, processors=14)”; done


Run it as a loop but it works as:

for a in *.fasta; do b=basename $a .fasta; mothur “#trim.seqs(fasta=$a, minlength=130, maxlength=140, maxambig=0, maxhomop=4, processors=14)”; done