Question: Fred's metabarcoding pipeline : Build the OTU table / keyerror in python script
gravatar for jojo_ezz
19 months ago by
jojo_ezz10 wrote:

Hello, I am using Frédéric Mahé's metabarcoding pipeline at: .

Everything worked fine until I reached the last step. Unfortunately I am stuck at "Build the OTU" table step. When I launch the bash script that reads intermediary files and a python script (bash script below):


python \
    "${SCRIPT}" \
    "${STATS}" \
    "${SWARMS}" \
    "${UCHIME}" \
    "${QUALITY}" \
    "${ASSIGNMENTS}" \
    Smpl[0-9]*.fas > "${OTU_TABLE}"

I get in my terminal this error:

> root@Precision-Tower-7910:/home/coldsunshine/Desktop/mahe_translem#
> bash   Traceback (most recent call last):   File
> "", line 262, in <module>
>     main()   File "", line 249, in main
>     seeds, stampa)   File "", line 184, in print_table
>     for amplicons in swarms[seed]: KeyError: '57ad7eeb4e072adfc4543438061d7e87c8ce7dc5'

Is anyone familiar with this kind of error when using this pipeline or anyone can help me figure out what is happening since I am no expert in python. The python script can be found on the same Internet page as the bash script at

Please help me, I am stuck at the last step...

ADD COMMENTlink modified 19 months ago by Frédéric Mahé3.0k • written 19 months ago by jojo_ezz10
gravatar for Frédéric Mahé
19 months ago by
France, Montpellier, CIRAD
Frédéric Mahé3.0k wrote:

Hi, the regular expression that is used to parse swarm's output needed to be updated to reflect the fact that vsearch does not write a ";" at the end of fasta header lines anymore (">foo;size=123;" is now ">foo;size=123"). The python script at has been modified to accommodate that.

ADD COMMENTlink written 19 months ago by Frédéric Mahé3.0k
gravatar for jojo_ezz
19 months ago by
jojo_ezz10 wrote:

Thankfully Frédéric Mahé who developed this pipeline answered me.

The error was a missing "?" in the script.

Just added a ? to the separator and the script worked perfectly:

separator = "_[0-9]+|;size=[0-9]+;| "

Need to be like this:

separator = "_[0-9]+|;size=[0-9]+;?| "

ADD COMMENTlink written 19 months ago by jojo_ezz10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1297 users visited in the last hour