# Rescript 'KeyError'

**URL:** <https://forum.qiime2.org/t/rescript-keyerror/20805>\
**Category:** Library Support\
**Tags:** dereplicate, rescript\
**Created:** [September 20, 2021, 3:32pm UTC](https://forum.qiime2.org/t/rescript-keyerror/20805 "2021-09-20T15:32:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arwqiime](https://forum.qiime2.org/user_avatar/forum.qiime2.org/arwqiime/32/12728_2.png) [@arwqiime](https://forum.qiime2.org/u/arwqiime)\
**Post date:** [September 20, 2021, 3:32pm UTC](https://forum.qiime2.org/t/rescript-keyerror/20805/1 "2021-09-20T15:32:30Z")

</div>

Hello,  
I have imported 16S sequences and a corresponding taxonomy from a database of putative pathogenic bacteria. In order to prepare a taxonomy classifier from these sequences, I extracted 16S fragments (q2 feature-classifier extract-reads). When I run q2 rescript dereplicate, I get a KeyError as shown in the log file, which indicates an issue with the 'Feature ID'.

Plugin error from rescript:  
'16S\_015'

Is there any restriction with feature ids, e.g. the presence of underscores, etc.?  
I attach the log file (changed to \*.txt due to upload restrictions), but I can add some more documents, if necessary.  
Thank your for your comments!

[qiime2-q2cli-err-2r3fb6vc.log.txt](https://forum.qiime2.org/uploads/short-url/mR2rfJvLAXg7Oo3NcbrvuiC7rWx.txt) (4.2 KB)

---

<div class="post-metadata">

**Author:** ![SoilRotifer](https://forum.qiime2.org/user_avatar/forum.qiime2.org/soilrotifer/32/21071_2.png) [@SoilRotifer](https://forum.qiime2.org/u/SoilRotifer)\
**Post date:** [September 20, 2021, 4:49pm UTC](https://forum.qiime2.org/t/rescript-keyerror/20805/2 "2021-09-20T16:49:33Z")

</div>

> [@arwqiime](#):
>
> Is there any restriction with feature ids, e.g. the presence of underscores, etc.?

Yes there are. Here are the [general metadata requirements](https://docs.qiime2.org/2021.8/tutorials/metadata/#metadata-formatting-requirements). More specifically, here are the [identifier requirements](https://docs.qiime2.org/2021.8/tutorials/metadata/#identifier-recommendations).

Basically, you'd want to avoid underscores (`_`) in the sequence labels. Many older tools (_e.g._ QIIME 1) and pipelines _often only consider anything before the first underscore as the sequence or sample label_. There are also inconstancies regarding this approach...

I suspect what is happing is that, one portion of the code is trimming off anything after the underscore, and the other is not. That is `16S_015` is being trimmed to `16S` and saved. Then when another part of the code tries searching for `16S_015` (_i.e._ the key), it is not found because it has been changed to `16S`. This the key error.

---

<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:** [October 21, 2021, 10:49pm UTC](https://forum.qiime2.org/t/rescript-keyerror/20805/3 "2021-10-21T22:49:45Z")

</div>

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