Difference between revisions of "Ccp4 ncont"

From PyMOLWiki
Jump to: navigation, search
(Created page with '== ContactsNCONT == 300px|right Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of ContactsNCONT script in PyMOL allows…')
 
m (Authors corrected.)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== ContactsNCONT ==
+
{{Infobox script-repo
 
+
|type      = script
[[File:HhaExample.png|300px|right]]
+
|filename  = ccp4_ncont.py
 
+
|author    = [[User:Dalyte|Gerhard Reitmayr and Dalia Daujotyte]]
Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of ContactsNCONT script in PyMOL allows easy selection of residues and atoms listed in ncont.log file. Interacting protein and DNA residues are colored in red and slate,
+
|license  = GPL
respectively. Atoms in contact are pictured in dots.
+
}}
  
 
== Overview ==
 
== Overview ==
 +
[[File:HhaExample.png|thumb|300px|right|Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of ccp4_ncont script in PyMOL allows easy selection of residues and atoms listed in ncont.log 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 NCONT from CCP4 Program Suite (NCONT analyses contacts between subsets of atoms in a PDB file).
 
The script selects residues and atoms from the list of the contacts found by NCONT from CCP4 Program Suite (NCONT analyses contacts between subsets of atoms in a PDB file).
First, we run NCONT on our pdb file to find interface residues. Then by using the ContactsNCONT script in PyMOL we select listed residues and atoms separately. This generates two selections (atoms and residues) for each interacting chain, allowing quick manipulation of (sometimes) extensive lists in NCONT log file.
+
First, we run NCONT on our pdb file to find interface residues. Then by using the ccp4_ncont 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 NCONT log file.
 
 
  
 +
This script works best for intermolecular contacts (when NCONT target and source selections don't overlap). If crystal contacts (NCONT parameter cell = 1 or 2) are included then additional coding is required to distinguish inter from intramolecular contacts.
 +
   
 
== Usage ==
 
== Usage ==
  
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )
+
ccp4_ncont( contactsfile, selName1 = "source", selName2 = "target" )
  
  
Line 20: Line 22:
  
  
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''
+
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.
''Make sure you've run the ContactsNCONT script first.''
+
Make sure you import the ccp4_ncont script first.
 
   
 
   
 
  fetch 2c7r
 
  fetch 2c7r
  selectContacts ncont.log, selName1=prot, selName2=dna
+
  ccp4_ncont 2c7r.ncont, selName1=prot, selName2=dna
  
 +
[[File:HhaI20example.png|thumb|300px|right|Quick and easy selection of interacting residues and atoms listed in the NCONT 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_ncont_1.pml}}
 +
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_ncont_1.pml" highlight="python" />
  
 +
== Getting a NCONT file ==
  
import re
+
=== Install CCP4 - for Linux ===
+
Goto: http://www.ccp4.ac.uk/download.php <br>
def parseContacts( f ):
+
Click: automated Downloads Pages <br>
    # /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O  [ O]:  3.32
+
Select: Linux, generic linux (x86) <br>
    conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")
+
Select: Customized installation <br>
    mode = 0
+
Select: Only CCP4 Program Suite, Executables -> Continue <br>
    s1 = []
+
No additional packages -> Continue <br>
    s2 = []
+
Download <br>
    pairs = []
+
 
    for line in f:
+
Extract for example to: '''/home/YOU/Software/CCP'''4 <br>
        if mode == 0:
+
Then run: <br>
            if line.strip().startswith("SOURCE ATOMS"):
+
<syntaxhighlight lang="bash">
                mode = 1
+
$ /home/YOU/Software/CCP4/install.sh
        elif mode == 1:
+
</syntaxhighlight>
            mode = 2
+
write yes, read agreement, push y to agree license <br>
        elif mode == 2:
+
For sourcing scripts, say yes. <br>
            matches = conParser.findall(line)
+
See the changes to your environmental virables: <br>
            if len(matches) == 0:
+
<syntaxhighlight lang="bash">
                return (s1, s2, pairs)
+
$ less ~/.bashrc
            if len(matches) == 2:
+
</syntaxhighlight>
                s1.append(matches[0])
+
 
                s2.append(matches[1])
+
=== Use of NCONT - for Linux ===
            elif len(matches) == 1:
+
See here for the NCONT program and options: <br>
                s2.append(matches[0])
+
http://www.ccp4.ac.uk/html/ncont.html <br>
            pairs.append((len(s1)-1, len(s2)-1))
+
http://www.ccp4.ac.uk/html/pdbcur.html#atom_selection <br>
        else:
+
Locate the pdb, and now run in terminal: <br>
            print "Unknown mode", mode
+
<syntaxhighlight lang="bash">
+
$ ncont XYZIN 2c7r.pdb >> 2c7r.ncont << eof  (#press enter)
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):
+
> source A    (#press enter)
    """
+
> target C,D  (#press enter)
    selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.
+
> eof         (#press enter, and now the program runs, and shell saves to 2c7r.ncont)
+
</syntaxhighlight>
    PARAMS
 
        contactsfile
 
            filename of the CCP4 NCONT contacts 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
 
        * 2 selections of interface residues and atoms for each chain are created and named
 
            depending on what you passed into selName1 and selName2
 
 
    AUTHOR:
 
        Gerhard Reitmayr and Dalia Daujotyte, 2009.      
 
    """
 
    # read and parse contacts file into two lists of contact atoms and contact pair list
 
    s1, s2, pairs = parseContacts(open(contactsfile))
 
    # create a selection for the first contact list
 
    resName = selName1 + "_res"
 
    atomName = selName1 + "_atom"
 
    cmd.select(resName, None)
 
    cmd.select(atomName, None)
 
    for (thing, chain, residue, atom) in s1:
 
        cmd.select( resName, resName + " or " + chain+"/"+residue+"/")
 
        cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)
 
 
    # create a selection for the second contact list
 
    resName = selName2 + "_res"
 
    atomName = selName2 + "_atom"
 
    cmd.select(resName, None)
 
    cmd.select(atomName, None)
 
    for (thing, chain, residue, atom) in s2:
 
         cmd.select( resName, resName + " or " + chain+"/"+residue+"/")
 
        cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)
 
 
cmd.extend("selectContacts", selectContacts)
 
  
  
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]
+
[[Category:Script_Library]]
 +
[[Category:ThirdParty Scripts]]
 +
[[Category:Structural Biology Scripts]]
 +
[[Category:Pymol-script-repo]]

Latest revision as of 17:16, 13 February 2012

Type Python Script
Download ccp4_ncont.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. Usage of ccp4_ncont script in PyMOL allows easy selection of residues and atoms listed in ncont.log 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 NCONT from CCP4 Program Suite (NCONT analyses contacts between subsets of atoms in a PDB file). First, we run NCONT on our pdb file to find interface residues. Then by using the ccp4_ncont 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 NCONT log file.

This script works best for intermolecular contacts (when NCONT target and source selections don't overlap). If crystal contacts (NCONT parameter cell = 1 or 2) are included then additional coding is required to distinguish inter from intramolecular contacts.

Usage

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


Examples

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

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

fetch 2c7r, async=0
remove solvent
show_as cartoon, 2c7r

python
if 'PYMOL_GIT_MOD' in os.environ:
    example_dir = os.path.join(os.path.split(os.environ['PYMOL_GIT_MOD'])[0],"files_for_examples")
    ncontfile = os.path.join(example_dir,"2c7r.ncont")
else:
    ncontfile = "2c7r.ncont"
python end

select ligands, organic
select prot, chain A
select ssDNAa, chain C
select ssDNAb, chain D
select dsDNA, chain C+D

ccp4_ncont.ccp4_ncont(ncontfile, selName1="prot", selName2="dsDNA")

# See here to represent nuc acids
#http://www.pymolwiki.org/index.php/Examples_of_nucleic_acid_cartoons
set cartoon_ring_mode, 3
set cartoon_ring_finder, 1
color slate, dsDNA and elem C

show sticks, prot_res
color raspberry, prot_res
show dots,  prot_atom
show dots, dsDNA_atom
orient dsDNA_res
ray

Getting a NCONT 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 NCONT - for Linux

See here for the NCONT program and options:
http://www.ccp4.ac.uk/html/ncont.html
http://www.ccp4.ac.uk/html/pdbcur.html#atom_selection
Locate the pdb, and now run in terminal:

$ ncont XYZIN 2c7r.pdb >> 2c7r.ncont << eof   (#press enter)
> source A    (#press enter)
> target C,D  (#press enter)
> eof         (#press enter, and now the program runs, and shell saves to 2c7r.ncont)