<p>I believe <a href="https://pdb2pqr.readthedocs.io/en/latest/" rel="nofollow noreferrer">PDB2PQR</a> CLI will do the work wonderfully. Don't let the name trick you: PQR files are organized like PDB ones. Under the hood it runs <a href="https://propka.readthedocs.io/en/latest/quickstart.html" rel="nofollow noreferrer">propka</a>, which is state-of-the-art for predicting a protein residues protonation state. The best part is that you can use <a href="https://server.poissonboltzmann.org/pdb2pqr" rel="nofollow noreferrer">PDB2PQR web server</a> and they will give you the corresponding CLI arguments for each option you choose. It also automatically removes water (and other non-protein molecules).</p>
<p>You can also try looking into tutorials on how to setup proteins for dynamics on GROMACS, AMBER or OpenMM and stumble on their own tools for protonating stuff (respectively <code>pdb2gmx</code> (CLI), <code>protonate</code> (CLI), and <code>modeller.addHydrogen</code> (python API)), but as far as I know propka computes residues pKi in a knowledge-based manner and out-performs physics-based (if not just totally automatic, without guess) approaches like these.</p>
<p>For some context: acidic or basic amino-acids in proteins may have different pKi depending on their local environment (i.e. if they are in contact with solvent or not, and residues surrounding them), which is why &quot;adding hydrogen to proteins crystallographic structures at a constant pH&quot; is not as easy as it sounds.</p>

CC BY-SA 4.0
2021-06-17T20:28:45.387Z
2021-06-17T20:47:58.463Z
2021-06-17T20:47:58.463Z
O.Laprevote
<p>I'm trying to dock a ligand to several hundred PDB files (receptors).
I thus need to prepare the those PDB files like removing water and adding hydrogen.</p>
<p>I can do that manually using Autodock or Pymol. But it's too troublesome.
Is there a way to do it programmatically with Python or R or any command line procedure?</p>

CC BY-SA 4.0
2021-06-17T09:52:07.837Z
If you did it manually in PyMOL, it can also be scripted. But note that adding hydrogens is not that simple. There is more than one way of deciding which hydrogens are present (you may consider pH) and what are their coordinates. So I'd first think what method of adding hydrogens to use.
marcin
CC BY-SA 4.0
2021-06-17T10:24:14.507Z
@marcin In pymol I use [**h_add**](https://pymolwiki.org/index.php/H_Add) command. That is not enough? How would you go about scripting it?
littleworth
CC BY-SA 4.0
2021-06-17T13:17:25.363Z
https://chemistry.stackexchange.com/questions/129157/adding-hydrogens-to-multiple-pdb-files-using-openbabel-gui-software here they use openbabel, not scripting but in batch
pippo1980
CC BY-SA 4.0
2021-06-17T13:21:40.613Z
I can't tell if that's enough for what you're doing. `h_add` in Python script would become `pymol.cmd.h_add('all')`
marcin
CC BY-SA 4.0
2021-06-22T03:06:17.857Z
Michael Word's [reduce](https://github.com/rlabduke/reduce) is an established method to do that
Jan Wilamowski
CC BY-SA 4.0
2021-07-30T20:05:56.010Z
GROMACS can add hydrogens. And  water you can filter out with `cat filename | grep -v ...`
Soerendip
<python><protein-structure><docking><pymol><structural-biology>
Programmatically adding hydrogen and remove water to multiple PDB files
# Programmatically adding hydrogen and remove water to multiple PDB files

(Asked by: username_0 on 2021-06-17)

I'm trying to dock a ligand to several hundred PDB files (receptors).
I thus need to prepare the those PDB files like removing water and adding hydrogen.

I can do that manually using Autodock or Pymol. But it's too troublesome.
Is there a way to do it programmatically with Python or R or any command line procedure?

**Tags:** python, protein-structure, docking, pymol, structural-biology
> **Comments:**
> **username_1**: If you did it manually in PyMOL, it can also be scripted. But note that adding hydrogens is not that simple. There is more than one way of deciding which hydrogens are present (you may consider pH) and what are their coordinates. So I'd first think what method of adding hydrogens to use.  
> **username_0**: @marcin In pymol I use [**h_add**](https://pymolwiki.org/index.php/H_Add) command. That is not enough? How would you go about scripting it?  
> **username_2**: https://chemistry.stackexchange.com/questions/129157/adding-hydrogens-to-multiple-pdb-files-using-openbabel-gui-software here they use openbabel, not scripting but in batch  
> **username_1**: I can't tell if that's enough for what you're doing. `h_add` in Python script would become `pymol.cmd.h_add('all')`  
> **username_3**: Michael Word's [reduce](https://github.com/rlabduke/reduce) is an established method to do that  
> **username_4**: GROMACS can add hydrogens. And  water you can filter out with `cat filename | grep -v ...`  

---

## 1 answers

### Answer by username_5 on 2021-06-17. Score: 2

I believe [PDB2PQR](https://pdb2pqr.readthedocs.io/en/latest/) CLI will do the work wonderfully. Don't let the name trick you: PQR files are organized like PDB ones. Under the hood it runs [propka](https://propka.readthedocs.io/en/latest/quickstart.html), which is state-of-the-art for predicting a protein residues protonation state. The best part is that you can use [PDB2PQR web server](https://server.poissonboltzmann.org/pdb2pqr) and they will give you the corresponding CLI arguments for each option you choose. It also automatically removes water (and other non-protein molecules).

You can also try looking into tutorials on how to setup proteins for dynamics on GROMACS, AMBER or OpenMM and stumble on their own tools for protonating stuff (respectively `pdb2gmx` (CLI), `protonate` (CLI), and `modeller.addHydrogen` (python API)), but as far as I know propka computes residues pKi in a knowledge-based manner and out-performs physics-based (if not just totally automatic, without guess) approaches like these.

For some context: acidic or basic amino-acids in proteins may have different pKi depending on their local environment (i.e. if they are in contact with solvent or not, and residues surrounding them), which is why "adding hydrogen to proteins crystallographic structures at a constant pH" is not as easy as it sounds.


---

