documentation/notes/experiment_GTP_to_GDP.md
## Experiment: GTP to GDP
This experiment is based on a question I received —thank you <ask permission first>.
Given a protein bound to ATP or GTP convert it to ADP+Pi and GDP+Pi.
This _seems_ easy, _i.e._ `Victor(hits=['GTP']).place(gdp_smiles)`.
However, there are two complication:
* PyRosetta knows about nucleotide **polymers**
* the GTP is bonded to the magnesium ion via a donor bond.
In (Py)Rosetta, there are four levels of residues types
(what the code calls params files, called topology files in other communities)
1. The core ones you cannot overwrite (ALA, NME etc.)
2. The ones you provide
3. The regular “database” folder ones (NTPs, but not NDP or PO4)
4. The PDB component database —autogenerated with occasional nasty protonations and that blow up easily
## Download HRAS GTP
The model I chose is HRas as it has been solved bound to different forms:
* 1AA9 GDP + MG no Pi
* 1XD2 GDP + MG + Pi
* 1QRA GTP + MG
So I'll get 1QRA and make it into GDP+PO4 and compare it to 1QRA's GDP.
## Download
I'll clean up the structure in PyRosetta.
The first step has the caveat that toolbox rcsb strips ligands and stuff,
so it needs to be done differently.
```python
import pyrosetta_help as ph
pdb_filename = ph.download_pdb('1QRA')
pose = pyrosetta.pose_from_pdb(pdb_filename)
```
## Save the apo structure
In a first pass I did:
```python
pyrosetta.rosetta.core.pose.remove_nonprotein_residues(pose)
apo_filename = 'apo.pdb'
pose.dump_pdb(apo_filename)
```
The `remove_nonprotein_residues` removes the magnesium, which is bad.
So a more convoluted way is required, _i.e._ select and delete the GTP:
```python
pr_rs = pyrosetta.rosetta.core.select.residue_selector
gtp_sele = pr_rs.ResidueNameSelector()
gtp_sele.set_residue_name3('GTP')
gtp_idx = pr_rs.ResidueVector( gtp_sele.apply(pose) )[1]
pose.delete_residue_slow(gtp_idx)
assert len(pr_rs.ResidueVector( gtp_sele.apply(pose) )) == 0
```
and the waters:
```python
hoh_sele = pr_rs.ResidueNameSelector()
hoh_sele.set_residue_name3('HOH')
for hoh_idx in reversed(list(pr_rs.ResidueVector( hoh_sele.apply(pose) ))):
pose.delete_residue_slow(hoh_idx)
assert len(pr_rs.ResidueVector( hoh_sele.apply(pose) )) == 0
```
before saving:
```python
apo_filename = 'apo.pdb'
pose.dump_pdb(apo_filename)
```
Just to make sure it worked, let's have a gander:
```python
import nglview as nv
view = nv.show_rosetta(pose)
view.add_hyperball(sele='not polymer')
view
```
> Migration to be continued.