# Getting error message while dealing with pdb\_selchain.py

**URL:** <https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451>\
**Category:** PDB-tools\
**Created:** [September 18, 2020, 1:55pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451 "2020-09-18T13:55:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![archi](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archi](https://ask.bioexcel.eu/u/archi)\
**Post date:** [September 18, 2020, 1:55pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/1 "2020-09-18T13:55:07Z")

</div>

Hi,  
So I was following doing the tutorial for docking the multi-chain complexes. I followed all the steps in the tutorial. However, when I use the pdb\_selchain.py command I get the following error message:  
traceback (most recent call last):  
File “/home/archi/temp/pdb-tools/pdbtools/pdb\_selchain.py”, line 157, in   
main()  
File “/home/archi/temp/pdb-tools/pdbtools/pdb\_selchain.py”, line 136, in main  
for lineno, line in enumerate(new\_pdb):  
File “/home/archi/temp/pdb-tools/pdbtools/pdb\_selchain.py”, line 121, in select\_chain  
if line[21] not in chain\_set:  
IndexError: string index out of range

Could you please suggest how to deal with this problem?

Thank you

---

<div class="post-metadata">

**Author:** ![amjjbonvin](https://dub1.discourse-cdn.com/flex013/user_avatar/ask.bioexcel.eu/amjjbonvin/32/23_2.png) [@amjjbonvin](https://ask.bioexcel.eu/u/amjjbonvin)\
**Post date:** [September 20, 2020, 7:53am UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/2 "2020-09-20T07:53:06Z")

</div>

Could be a python version problem.

You could try instead to use our new PDB-tools web server:

[https://wenmr.science.uu.nl/pdbtools](https://wenmr.science.uu.nl/pdbtools)

Or install locally our PDB-tools from:

[http://www.bonvinlab.org/pdb-tools/](http://www.bonvinlab.org/pdb-tools/)

---

<div class="post-metadata">

**Author:** ![archi](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@archi](https://ask.bioexcel.eu/u/archi)\
**Post date:** [September 20, 2020, 4:24pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/3 "2020-09-20T16:24:23Z")

</div>

Hi,

Thank you for the response. I’ll try to use the PDB-tools web server for the protein preparation.

Also I’m not sure if it is due to a Python version problem as the other python files of pdb-tools are working properly.

---

<div class="post-metadata">

**Author:** ![kbierstedt](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kbierstedt](https://ask.bioexcel.eu/u/kbierstedt)\
**Post date:** [June 22, 2021, 2:43pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/4 "2021-06-22T14:43:16Z")

</div>

Hello,  
@archi do you happen to know what version of python you are using? I’m getting the exact same error using python 3.6.13.

---

<div class="post-metadata">

**Author:** ![kbierstedt](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kbierstedt](https://ask.bioexcel.eu/u/kbierstedt)\
**Post date:** [June 22, 2021, 3:29pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/5 "2021-06-22T15:29:59Z")

</div>

Hello Dr. Bonvin,  
I encountered the same error as archi posted above. I then used pip install --upgrade pdb-tools to ensure that my pdb-tools were up to date. I also checked my python version (3.6.13) which I believe is appropriate for using the pdb tools. Do you have any ideas on how I could resolve this error?

---

<div class="post-metadata">

**Author:** ![HAKpdb](https://avatars.discourse-cdn.com/v4/letter/h/d26b3c/32.png) [@HAKpdb](https://ask.bioexcel.eu/u/HAKpdb)\
**Post date:** [January 31, 2022, 12:59pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/6 "2022-01-31T12:59:46Z")

</div>

Could you guys share the pdb files that you encounter the reported problem? This error is not due to the version of python or the version of the tool that you guys have, but due to the errors (some are not really errors, but incompatible with the format that pdb\_selchain.py looks for) in pdb format. e.g. if you end one chain with TER but without filling the rest of the line you will get the above error.

---

<div class="post-metadata">

**Author:** ![joaomcteixeira](https://dub1.discourse-cdn.com/flex013/user_avatar/ask.bioexcel.eu/joaomcteixeira/32/480_2.png) [@joaomcteixeira](https://ask.bioexcel.eu/u/joaomcteixeira)\
**Post date:** [February 14, 2022, 3:20pm UTC](https://ask.bioexcel.eu/t/getting-error-message-while-dealing-with-pdb-selchain-py/2451/7 "2022-02-14T15:20:14Z")

</div>

Hi, could you use `pdb_validate` in your PDB files to see which errors are reported? as @HAKpdb said, this is almost surely an error with the PDB itself. Let us know, thanks.
