3
$\begingroup$

I would like to delete everything from a PDB file except a specific ligand that I know the PDB code for. Is there a simple way to using free Linux-compatible software? If you want a specific example for your answer 1YAT and its ligand FK5 (tacrolimus) is an example I'm presently working on. I think PyMOL might have this capability using the delete command but running:

delete /1YAT/A

which should delete the macromolecule (chain A) at least but I saw no visually-obvious change. I have viewed the PyMOL Wiki article on the delete command but it was not helpful as what name meant was not obvious to me.

By free software I mean free of charge not free as in freedom. One piece of software that I used to do this with on Windows was Accelrys (or BIOVIA) Discovery Studio Visualizer, tried to run it on Arch Linux, however, as it has a Linux binary, but it failed to run. This is presumably because it is for Red Hat Enterprise Linux/SUSE Linux Enterprise which has too old of system libraries for Arch Linux compatibility.

$\endgroup$
4
  • 2
    $\begingroup$ The PDB is human readable, so the quickest way is just to use a text editor and delete all the bits you don't want; its messy but if you have only to do it once then probably ok. Alternatively if you have many files use python (with, say, Atom(apple mac) or notepad++(PC) code editors) to read line by line and print same for only the header parts (those not starting with word 'ATOM' ) and then print the 'HETATM' parts you want. Python, Atom and Notepad++ are all free and there is lots of online help to use python. $\endgroup$
    – porphyrin
    Jul 25, 2017 at 10:40
  • 2
    $\begingroup$ Sed and/or vim. $\endgroup$ Jul 25, 2017 at 20:59
  • $\begingroup$ I'm having trouble envisioning why you want to get the conformation of the ligand using this method. There is a plethora of open-source, linux-compatible chemoinformatic software to do this. Here's an example using rdkit: nbviewer.jupyter.org/github/tentrillion/ipython_notebooks/blob/… . (Note that you should be able to pan/zoom with the mouse on "Out[6]" to look at the conformation in detail). There are similar capabilities, I'm sure, in cdk and other software. $\endgroup$
    – Curt F.
    Jul 25, 2017 at 23:46
  • 1
    $\begingroup$ I usually use Avogadro, Jmol, Mercury and PyMOL only and I was unaware of ways to remove everything but the ligand with any of these pieces of software. Guessing that was what you were asking since your rdkit example was along the line of suggesting another method of doing this. If you're asking why this method of determining the 3D structure as opposed to optimization and other methods well I want to draw structures for Wikipedia (e.g. here is one of mine commons.wikimedia.org/wiki/File:Tianeptine-xtal-2012.png) and crystal structures are preferred there. $\endgroup$
    – Josh Pinto
    Jul 26, 2017 at 0:12

5 Answers 5

8
$\begingroup$

grep

Substitute AAA with the name of the residue you want:

grep -w " AAA " file.pdb > ligand.pdb
$\endgroup$
3
  • $\begingroup$ While you don't get visual confirmation of the ligand match, I think this is a nice hack. :-) $\endgroup$ Jul 26, 2017 at 14:05
  • 1
    $\begingroup$ Well, usually before redirecting the output to a file you try few things. grep -w is not immediate, one learns it step by step. First you grep only and then you refine the command, maybe even piping to sed or head or whatever. Or you redirect using tee. Or maybe I misunderstood and you meant "visual" as in "actually visualizing the structure"...but I don't think it's really necessary! $\endgroup$
    – Anon
    Jul 26, 2017 at 16:15
  • 1
    $\begingroup$ I meant "actually visualizing the structure" but agree that all the points you mention are important in building up such hacks. $\endgroup$ Jul 26, 2017 at 20:59
7
$\begingroup$

Avogadro

  1. Open the PDB file. Then choose SelectSelect by Residue:

    Select by Residue menu option

  2. Pick SelectInvert Selection followed by EditClear.

  3. Done. Well, save the new file… :-)

$\endgroup$
3
  • 1
    $\begingroup$ I'll note that there must be some way to do this with PyMol, but it's pretty easy to do in Avogadro. $\endgroup$ Jul 25, 2017 at 18:56
  • $\begingroup$ Is it possible to do this with Avogadro2? I don't see a "Select by Residue" option in is Select menu, only All, None and Invert Selection. $\endgroup$
    – Josh Pinto
    May 19, 2018 at 19:26
  • 1
    $\begingroup$ @BH2017 - Avogadro2 at the moment is in beta and has no residue/biomolecule support yet. $\endgroup$ May 19, 2018 at 20:06
3
$\begingroup$

PyMOL

  1. Create a new object for your residue:

    create myobj, r. fk5
    
  2. Delete the original object with the entire protein:

    delete 1yat
    
$\endgroup$
2
$\begingroup$

Jmol/JSmol

  1. Load your file:

    load "=1YAT"
    
  2. Select the residue:

    select FK5
    
  3. Write all the selected coordinates. The file name is arbitrary except for the extension .pdb:

    write ligandFK5.pdb
    
$\endgroup$
2
$\begingroup$

I have written some simple code in python to do what you ask, keeping just FK5.

# remove rows from pdb file

import numpy as np

dataname = '1yat.pdb'
keyword = 'FK5' # keep row with this in col 4

isatom = False
with open(dataname) as f:
    for line in f:
        vals = new_str.split(' ')

        if vals[3]==keyword: 
            print(line, end= ' ')
$\endgroup$
8
  • 1
    $\begingroup$ For me this script returns the error (and yes 1yat.pdb does exist in the folder where I am running the script) shown here gist.github.com/fusion809/11278bea129cee1adfa495e0767c8439. The script is also shown at that gist. $\endgroup$
    – Josh Pinto
    Jul 25, 2017 at 16:49
  • 1
    $\begingroup$ Does indenting the whole thing by four spaces, to enable code formatting, not make it render correctly? $\endgroup$
    – hBy2Py
    Jul 25, 2017 at 16:59
  • $\begingroup$ I used tabs but I did use it for each separate level. So, for example, for the if vals[0] line I used two tabs as it is level 2. While for line in f: is level 1 so one tab. $\endgroup$
    – Josh Pinto
    Jul 25, 2017 at 17:02
  • $\begingroup$ Oh, sorry, @BH2017, I wasn't referring to the error you observed; I was asking porphyrin about his troubles getting the code to render correctly in his post here. $\endgroup$
    – hBy2Py
    Jul 25, 2017 at 17:09
  • $\begingroup$ @BH2017 It looks like you're running this as a shells script instead of a python script. To fix this, add the following line as the first line of the script: #!/usr/bin/python3 $\endgroup$
    – chipbuster
    Jul 25, 2017 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.