Ccp4 contact: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
(added a new script to parse and select CONTACT output)
 
m (Authors corrected.)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:HhaExample.png|thumb|300px|right|Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT, but similar results can be obtained using this script and CONTACT output. Usage of selectCONTACTContacts script in PyMOL allows easy selection of residues and atoms listed in the output file. Interacting protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.]]
{{Infobox script-repo
|type      = script
|filename  = ccp4_contact.py
|author    = [[User:Dalyte|Gerhard Reitmayr and Dalia Daujotyte]]
|license  = GPL
}}


== Overview ==
== Overview ==
[[File:HhaExample.png|thumb|300px|right|Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT, but similar results can be obtained using this script and CONTACT output. Usage of ccp4_contact script in PyMOL allows easy selection of residues and atoms listed in the output file. Interacting protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.]]


The script selects residues and atoms from the list of the contacts found by CONTACT from CCP4 Program Suite (CONTACT analyses contacts between subsets of atoms in a PDB file).
The script selects residues and atoms from the list of the contacts found by CONTACT from CCP4 Program Suite (CONTACT analyses contacts between subsets of atoms in a PDB file).
First, we run CONTACT on our pdb file to find interface residues. Then by using the selectCONTACTContacts script in PyMOL we separately select residues and atoms listed in a ncont.log file. This generates two selections (atoms and residues) for each interacting chain, allowing quick manipulation of (sometimes) extensive lists in CONTACT log file.
First, we run CONTACT on our pdb file to find interface residues. Then by using the ccp4_contact script in PyMOL we separately select residues and atoms listed in the output file. This generates two selections (atoms and residues) for each interacting chain, allowing quick manipulation of (sometimes) extensive lists in CONTACT log file.
      
      
== Usage ==
== Usage ==


selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" )
ccp4_contact( contactsfile, selName1 = "source", selName2 = "target" )




== Examples ==
== Example 1 ==
 
First use CONTACT to find interface residues/atoms in the pdb file. Once you have the log file proceed to PyMOL.
 
Make sure you import the ccp4_contact script first.
First use CONTACT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.
Make sure you've run the selectCONTACTContacts script first.
   
   
  fetch 2c7r
  fetch 2c7r
  selectCONTACTContacts ncont.log, selName1=prot, selName2=dna
  ccp4_contact 2c7r.contact, selName1=prot, selName2=dna


[[File:HhaI20example.png|thumb|300px|right|Quick and easy selection of interacting residues and atoms listed in the CONTACT log file. Protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.]]
[[File:HhaI20example.png|thumb|300px|right|Quick and easy selection of interacting residues and atoms listed in the CONTACT log file. Protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.]]


== The Code ==
{{Template:PymolScriptRepoDownload|examples/ccp4_contact_1.pml}}
<source lang="python">
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_contact_1.pml" highlight="python" />
import re
 
def parseCONTACTContacts( f ):
    # Lys    24A  ca  Asp  263D  CG  ...  4.94    [  -1B  ]  3: -X,  Y+1/2,  -Z+1/2
    conParser = re.compile("(\S*)\s*(\d+)([A-Z])\s*(\w+)")
    s1 = []
    s2 = []
    for line in f:
        if line.startswith('#'):
            continue
        matches = conParser.findall(line)
        if len(matches) == 2:
            s1.append(matches[0])
            s2.append(matches[1])
        elif len(matches) == 1:
            s2.append(matches[0])
           
    return (s1, s2)
 
def selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" ):
    """
    selectCONTACTContacts -- parses CCP4/CONTACT log file and selects residues and atoms.
    http://www.ccp4.ac.uk/html/contact.html
    PARAMS
        contactsfile
            filename of the CCP4/CONTACT log file
        selName1
            the name prefix for the _res and _atom selections returned for the
            source set of chain
        selName2
            the name prefix for the _res and _atom selections returned for the
            target set of chain
 
    RETURNS
        4 selections of interface residues and atoms are created and named
        depending on what you passed into selName1 and selName2
 
    REPOSITORY
        https://github.com/GerhardR/pymol-scripts
 
    AUTHOR
        Gerhard Reitmayr and Dalia Daujotyte, 2011.
    """
    # read and parse contacts file into two lists of contact atoms and contact pair list
    s1, s2 = parseCONTACTContacts(open(contactsfile))
   
    # create a selection for the first contact list
   
    # create the PYMOL selection macros for the residues
    resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s1]
    # put them in a set to remove duplicates and then join with 'or'
    resSel = " or ".join(frozenset(resNames))
    # finally select them under the new name
    cmd.select(selName1 + "_res", resSel)
   
    atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s1]
    atomSel = " or ".join(frozenset(atomNames))
    cmd.select(selName1 + "_atom", atomSel)
   
    # create a selection for the second contact list


    resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s2]
== Getting a CONTACT file ==
    resSel = " or ".join(frozenset(resNames))
    cmd.select(selName2 + "_res", resSel)
   
    atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s2]
    atomSel = " or ".join(frozenset(atomNames))
    cmd.select(selName2 + "_atom", atomSel)


cmd.extend("selectCONTACTContacts", selectCONTACTContacts)
=== Install CCP4 - for Linux ===
</source>
Goto: http://www.ccp4.ac.uk/download.php <br>
Click: automated Downloads Pages <br>
Select: Linux, generic linux (x86) <br>
Select: Customized installation <br>
Select: Only CCP4 Program Suite, Executables -> Continue <br>
No additional packages -> Continue <br>
Download <br>


== Code repository ==
Extract for example to: '''/home/YOU/Software/CCP'''4 <br>
Then run: <br>
<syntaxhighlight lang="bash">
$ /home/YOU/Software/CCP4/install.sh
</syntaxhighlight>
write yes, read agreement, push y to agree license <br>
For sourcing scripts, say yes. <br>
See the changes to your environmental virables: <br>
<syntaxhighlight lang="bash">
$ less ~/.bashrc
</syntaxhighlight>


The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.
=== Use of CONTACT - for Linux ===
See here for the CONTACT program and options: http://www.ccp4.ac.uk/html/contact.html <br>
Locate the pdb, and now run in terminal: <br>
<syntaxhighlight lang="bash">
$ contact XYZIN 2c7r.pdb >> 2c7r.contact << eof  (#press enter)
> MODE ISUB  (#press enter)
> ATYPE NON-CARBON  (#press enter)
> eof        (#press enter, and now the program runs, and shell saves to 2c7r.contact)
</syntaxhighlight>


[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]
[[Category:Script_Library]]
[[Category:ThirdParty Scripts]]
[[Category:Structural Biology Scripts]]
[[Category:Pymol-script-repo]]

Latest revision as of 18:15, 13 February 2012

Type Python Script
Download ccp4_contact.py
Author(s) Gerhard Reitmayr and Dalia Daujotyte
License GPL
This code has been put under version control in the project Pymol-script-repo

Overview

Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT, but similar results can be obtained using this script and CONTACT output. Usage of ccp4_contact script in PyMOL allows easy selection of residues and atoms listed in the output file. Interacting protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.

The script selects residues and atoms from the list of the contacts found by CONTACT from CCP4 Program Suite (CONTACT analyses contacts between subsets of atoms in a PDB file). First, we run CONTACT on our pdb file to find interface residues. Then by using the ccp4_contact script in PyMOL we separately select residues and atoms listed in the output file. This generates two selections (atoms and residues) for each interacting chain, allowing quick manipulation of (sometimes) extensive lists in CONTACT log file.

Usage

ccp4_contact( contactsfile, selName1 = "source", selName2 = "target" )


Example 1

First use CONTACT to find interface residues/atoms in the pdb file. Once you have the log file proceed to PyMOL. Make sure you import the ccp4_contact script first.

fetch 2c7r
ccp4_contact 2c7r.contact, selName1=prot, selName2=dna
Quick and easy selection of interacting residues and atoms listed in the CONTACT log file. Protein and DNA residues are colored in red and slate, respectively. Atoms in contact are shown in dots.
Download: examples/ccp4_contact_1.pml
This code has been put under version control in the project Pymol-script-repo

<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_contact_1.pml" highlight="python" />

Getting a CONTACT file

Install CCP4 - for Linux

Goto: http://www.ccp4.ac.uk/download.php
Click: automated Downloads Pages
Select: Linux, generic linux (x86)
Select: Customized installation
Select: Only CCP4 Program Suite, Executables -> Continue
No additional packages -> Continue
Download

Extract for example to: /home/YOU/Software/CCP4
Then run:

$ /home/YOU/Software/CCP4/install.sh

write yes, read agreement, push y to agree license
For sourcing scripts, say yes.
See the changes to your environmental virables:

$ less ~/.bashrc

Use of CONTACT - for Linux

See here for the CONTACT program and options: http://www.ccp4.ac.uk/html/contact.html
Locate the pdb, and now run in terminal:

$ contact XYZIN 2c7r.pdb >> 2c7r.contact << eof   (#press enter)
> MODE ISUB  (#press enter)
> ATYPE NON-CARBON  (#press enter)
> eof        (#press enter, and now the program runs, and shell saves to 2c7r.contact)