# trim.flows yields duplicate lines with identical seqs and #

**URL:** <https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683>\
**Category:** mothur bugs\
**Created:** [October 24, 2011, 5:26pm UTC](https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683 "2011-10-24T17:26:28Z")\
**Posts on this page:** 4\
**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 24, 2011, 5:26pm UTC](https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683/1 "2011-10-24T17:26:28Z")

</div>

Hi,  
I’m trying to run the following commands:

trim.flows(flow=RTL2011.08.flow, oligos=RTL2011.08.arc.oligos, bdiffs=2, pdiffs=3, minflows=350, maxflows=750, processors=2)  
shhh.flows(file=RTL2011.08.flow.files, processors=2)  
trim.seqs(fasta=RTL2011.08.shhh.fasta, name=RTL2011.08.shhh.names, oligos=RTL2011.08.arc.oligos, pdiffs=3, bdiffs=2, maxhomop=8, minlength=200, flip=T, processors=2)

Eeverything seems to be working fine. The trouble is when I then try to run:  
unique.seqs(fasta=RTL2011.08.shhh.trim.fasta, name=RTL2011.08.shhh.trim.names)  
I get loads (thousands) of errors saying:  
[ERROR]: You already have a sequence named G9SS7BA01CUVAI in your fasta file, sequence names must be unique, please correct.

but the process finishes without crashing.

Searching in the original RTL2011.08.shhh.fasta file for any of these ACC numbers i see that indeed most (maybe all) of my sequences have an identical duplicate somewhere in the file (always 514 lines later).

Now, I can of course remove them manualy with a short perl script (and do the same for the names file where I also have duplicate lines), but that really doesn’t sound like the best way to go about doing this.

The pheonomenon is reprducible with multiple runs I tried to see if the same happens with Scholss’ SOP data but the GQY1XT001.flow isn’t available.

Any ideas as why this is happening?

Thanks in advance,  
Roey

---

<div class="post-metadata">

**Author:** ![westcott](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/westcott/32/18_2.png) [@westcott](https://forum.mothur.org/u/westcott)\
**Post date:** [November 9, 2011, 6:25pm UTC](https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683/2 "2011-11-09T18:25:01Z")

</div>

The trim.flows command is adding the individual flow file names to the RTL2011.08.flow.files more than once. This occurs when you have primers or barcodes with the same name. In your case, the primers both had a blank name. We will correct this in our next release. In the meantime, after you run trim.flows, run “sort RTL2011.08.flow.files | uniq \> RTL2011.08.flow.files” to remove the duplicate names before you run shhh.flows. Thanks for bringing this to our attention!

---

<div class="post-metadata">

**Author:** ![Kirk](https://avatars.discourse-cdn.com/v4/letter/k/f9ae1b/32.png) [@Kirk](https://forum.mothur.org/u/Kirk)\
**Post date:** [December 8, 2011, 2:54pm UTC](https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683/3 "2011-12-08T14:54:06Z")

</div>

> [@westcott](#):
>
> In the meantime, after you run trim.flows, run “sort RTL2011.08.flow.files | uniq \> RTL2011.08.flow.files” to remove the duplicate names before you run shhh.flows. Thanks for bringing this to our attention!

I’m encountering the same problem.  
Could you explain where exactly you have to type the command:

```plaintext
sort xxx.flow.files | uniq > xxx.flow.files

```

is it like this?

```plaintext
mothur > sort xxx.flow.files | uniq > xxx.flow.files

```

Or what exactly do you mean?  
But this can be circumvented by naming your primer, you say?  
like this:  
forward AGAGTTTGATCCTGGCTCAG primername

?

Sorry for the very basic questions!

---

<div class="post-metadata">

**Author:** ![westcott](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.mothur.org/westcott/32/18_2.png) [@westcott](https://forum.mothur.org/u/westcott)\
**Post date:** [December 9, 2011, 1:30pm UTC](https://forum.mothur.org/t/trim-flows-yields-duplicate-lines-with-identical-seqs-and/683/4 "2011-12-09T13:30:12Z")

</div>

Sorry for not being more specific. The “sort RTL2011.08.flow.files | uniq \> RTL2011.08.flow.files” is not a mothur command. You have to run it outside of mothur from a shell. It sorts the results in the flow file and then only outputs the unique lines. Basically, it removes the duplicates for you.

> **[sort (Unix)](https://en.wikipedia.org/wiki/Sort_%28Unix%29)**
>
> In computing, sort is a standard command line program of Unix-like operating systems, that prints the lines of its input or concatenation of all files listed in its argument list in sorted order. Sorting is done based on one or more sort keys extracted from each line of input. By default, the entire input is taken as sort key. Blank space is the default field separator.
> The "-r" flag will reverse the sort order.
> Sort was part of Version 1 Unix. By Version 4 Ken Thompson had modified it to use...

  

> **[uniq](https://en.wikipedia.org/wiki/Uniq)**
>
> uniq is a Unix utility which, when fed a text file, outputs the file with adjacent identical lines collapsed to one.
> First appearing in Version 3 Unix, it is a kind of filter program. Typically it is used after sort. It can also output only the duplicate lines (with the -d option), or add the number of occurrences of each line (with the -c option).
> An example: To see the list of lines in a file, sorted by the number of times each occurs:
> Using uniq like this is common when building pipelines ...

You are correct about the primer name. Mothur is looking for something like:

forward primerString primerName
