https://pymolwiki.org/api.php?action=feedcontributions&user=Dalyte&feedformat=atomPyMOLWiki - User contributions [en]2024-03-29T10:49:49ZUser contributionsMediaWiki 1.35.7https://pymolwiki.org/index.php?title=Ccp4_pisa&diff=10535Ccp4 pisa2012-02-13T22:17:21Z<p>Dalyte: Authors corrected.</p>
<hr />
<div>{{Infobox script-repo<br />
|type = script<br />
|filename = ccp4_pisa.py<br />
|author = [[User:Dalyte|Gerhard Reitmayr and Dalia Daujotyte]]<br />
|license = GPL<br />
}}<br />
<br />
== Overview ==<br />
<br />
The script selects atoms from the list of the contacts found by PISA.<br />
First, we run PISA on our pdb file to find the interfaces. Then by using the ccp4_pisa script in PyMOL we separately select atoms for all interface types and individual interfaces. This generates many selections, two for each interface, allowing quick manipulation of (sometimes) extensive lists in PISA log file.<br />
<br />
== Usage ==<br />
<br />
ccp4_pisa( pisafile )<br />
<br />
<br />
== Example 1 ==<br />
<br />
The script parses the XML output files from the PISA service or command line tool. A short description of how to download the XML output files is available here http://www.ebi.ac.uk/msd-srv/prot_int/pi_download.html. <br />
<br />
(For example, the following URL downloads the interfaces in 2c7r.pdb http://www.ebi.ac.uk/pdbe/pisa/cgi-bin/interfaces.pisa?2c7r)<br />
<br />
Make sure you import the ccp4_pisa script first.<br />
<br />
{{Template:PymolScriptRepoDownload|examples/ccp4_pisa_1.pml}}<br />
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_pisa_1.pml" highlight="python" /><br />
<br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:ThirdParty Scripts]]<br />
[[Category:Structural Biology Scripts]]<br />
[[Category:Pymol-script-repo]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=10534Ccp4 ncont2012-02-13T22:16:29Z<p>Dalyte: Authors corrected.</p>
<hr />
<div>{{Infobox script-repo<br />
|type = script<br />
|filename = ccp4_ncont.py<br />
|author = [[User:Dalyte|Gerhard Reitmayr and Dalia Daujotyte]]<br />
|license = GPL<br />
}}<br />
<br />
== Overview ==<br />
[[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.]]<br />
<br />
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).<br />
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.<br />
<br />
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.<br />
<br />
== Usage ==<br />
<br />
ccp4_ncont( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you import the ccp4_ncont script first.<br />
<br />
fetch 2c7r<br />
ccp4_ncont 2c7r.ncont, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
{{Template:PymolScriptRepoDownload|examples/ccp4_ncont_1.pml}}<br />
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_ncont_1.pml" highlight="python" /><br />
<br />
== Getting a NCONT file ==<br />
<br />
=== Install CCP4 - for Linux ===<br />
Goto: http://www.ccp4.ac.uk/download.php <br><br />
Click: automated Downloads Pages <br><br />
Select: Linux, generic linux (x86) <br><br />
Select: Customized installation <br><br />
Select: Only CCP4 Program Suite, Executables -> Continue <br><br />
No additional packages -> Continue <br><br />
Download <br><br />
<br />
Extract for example to: '''/home/YOU/Software/CCP'''4 <br><br />
Then run: <br><br />
<syntaxhighlight lang="bash"><br />
$ /home/YOU/Software/CCP4/install.sh<br />
</syntaxhighlight><br />
write yes, read agreement, push y to agree license <br> <br />
For sourcing scripts, say yes. <br><br />
See the changes to your environmental virables: <br><br />
<syntaxhighlight lang="bash"><br />
$ less ~/.bashrc<br />
</syntaxhighlight><br />
<br />
=== Use of NCONT - for Linux ===<br />
See here for the NCONT program and options: <br><br />
http://www.ccp4.ac.uk/html/ncont.html <br><br />
http://www.ccp4.ac.uk/html/pdbcur.html#atom_selection <br><br />
Locate the pdb, and now run in terminal: <br><br />
<syntaxhighlight lang="bash"><br />
$ ncont XYZIN 2c7r.pdb >> 2c7r.ncont << eof (#press enter)<br />
> source A (#press enter)<br />
> target C,D (#press enter)<br />
> eof (#press enter, and now the program runs, and shell saves to 2c7r.ncont)<br />
</syntaxhighlight><br />
<br />
<br />
[[Category:Script_Library]]<br />
[[Category:ThirdParty Scripts]]<br />
[[Category:Structural Biology Scripts]]<br />
[[Category:Pymol-script-repo]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_contact&diff=10533Ccp4 contact2012-02-13T22:15:26Z<p>Dalyte: Authors corrected.</p>
<hr />
<div>{{Infobox script-repo<br />
|type = script<br />
|filename = ccp4_contact.py<br />
|author = [[User:Dalyte|Gerhard Reitmayr and Dalia Daujotyte]]<br />
|license = GPL<br />
}}<br />
<br />
== Overview ==<br />
[[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.]]<br />
<br />
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).<br />
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.<br />
<br />
== Usage ==<br />
<br />
ccp4_contact( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Example 1 ==<br />
First use CONTACT to find interface residues/atoms in the pdb file. Once you have the log file proceed to PyMOL.<br />
Make sure you import the ccp4_contact script first.<br />
<br />
fetch 2c7r<br />
ccp4_contact 2c7r.contact, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
{{Template:PymolScriptRepoDownload|examples/ccp4_contact_1.pml}}<br />
<include src="https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/examples/ccp4_contact_1.pml" highlight="python" /><br />
<br />
== Getting a CONTACT file ==<br />
<br />
=== Install CCP4 - for Linux ===<br />
Goto: http://www.ccp4.ac.uk/download.php <br><br />
Click: automated Downloads Pages <br><br />
Select: Linux, generic linux (x86) <br><br />
Select: Customized installation <br><br />
Select: Only CCP4 Program Suite, Executables -> Continue <br><br />
No additional packages -> Continue <br><br />
Download <br><br />
<br />
Extract for example to: '''/home/YOU/Software/CCP'''4 <br><br />
Then run: <br><br />
<syntaxhighlight lang="bash"><br />
$ /home/YOU/Software/CCP4/install.sh<br />
</syntaxhighlight><br />
write yes, read agreement, push y to agree license <br> <br />
For sourcing scripts, say yes. <br><br />
See the changes to your environmental virables: <br><br />
<syntaxhighlight lang="bash"><br />
$ less ~/.bashrc<br />
</syntaxhighlight><br />
<br />
=== Use of CONTACT - for Linux ===<br />
See here for the CONTACT program and options: http://www.ccp4.ac.uk/html/contact.html <br><br />
Locate the pdb, and now run in terminal: <br><br />
<syntaxhighlight lang="bash"><br />
$ contact XYZIN 2c7r.pdb >> 2c7r.contact << eof (#press enter)<br />
> MODE ISUB (#press enter)<br />
> ATYPE NON-CARBON (#press enter)<br />
> eof (#press enter, and now the program runs, and shell saves to 2c7r.contact)<br />
</syntaxhighlight><br />
<br />
[[Category:Script_Library]]<br />
[[Category:ThirdParty Scripts]]<br />
[[Category:Structural Biology Scripts]]<br />
[[Category:Pymol-script-repo]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_pisa&diff=9167Ccp4 pisa2011-06-27T21:17:14Z<p>Dalyte: Minor edit</p>
<hr />
<div>== Overview ==<br />
<br />
The script selects atoms from the list of the contacts found by PISA.<br />
First, we run PISA on our pdb file to find the interfaces. Then by using the selectPISAContacts script in PyMOL we separately select atoms for all interface types and individual interfaces. This generates many selections, two for each interface, allowing quick manipulation of (sometimes) extensive lists in PISA log file.<br />
<br />
== Usage ==<br />
<br />
selectPISAContacts( pisafile )<br />
<br />
<br />
== Examples ==<br />
<br />
The script parses the XML output files from the PISA service or command line tool. A short description of how to download the XML output files is available here http://www.ebi.ac.uk/msd-srv/prot_int/pi_download.html. <br />
<br />
(For example, the following URL downloads the interfaces in 2c7r.pdb http://www.ebi.ac.uk/pdbe/pisa/cgi-bin/interfaces.pisa?2c7r)<br />
<br />
Make sure you've run the selectPISAContacts script first.<br />
<br />
fetch 2c7r<br />
selectPISAContacts interfaces_2c7r.pisa<br />
<br />
== The Code ==<br />
<source lang="python"><br />
from xml.etree import ElementTree<br />
<br />
def parseElement( element ):<br />
""" creates a dict for the sub elements of the element"""<br />
result = { }<br />
for l in range(len(element)):<br />
if element[l].text != None:<br />
result[element[l].tag.strip()] = element[l].text.strip()<br />
return result;<br />
<br />
def parseBond( elementDir ):<br />
""" puts bond information into tuples"""<br />
return ((elementDir['chain-1'], elementDir['seqnum-1'], elementDir['atname-1']), (elementDir['chain-2'], elementDir['seqnum-2'], elementDir['atname-2']))<br />
<br />
def parseInterface( interface, bondname ):<br />
""" parses a single interface into the interface id, the two chain names connected <br />
and two lists of atoms for each chain"""<br />
bonds = interface.findall(bondname)<br />
id = interface.find('id').text.strip()<br />
if len(bonds) == 0:<br />
return None<br />
left = []<br />
right = []<br />
for b in bonds:<br />
l, r = parseBond(parseElement(b))<br />
left.append(l)<br />
right.append(r)<br />
left_chain = left[0][0]<br />
right_chain = right[0][0]<br />
if left_chain > right_chain:<br />
return id, (right_chain, left_chain), right, left<br />
return id, (left_chain, right_chain), left, right<br />
<br />
def createSelectionList( atomlist ):<br />
"""creates a PYMOL selection string for a list of atoms"""<br />
atomnames = [chain+'/'+res+'/'+atom for chain, res, atom in atomlist]<br />
return " or ".join(atomnames)<br />
<br />
def createInterfaceSelection( interface, prefix ):<br />
"""creates two selections for an interfaces"""<br />
id, e, l, r = interface<br />
leftname = prefix+'_' + str(id) + '_' + e[0] + e[1]<br />
rightname = prefix+'_' + str(id) + '_' + e[1] + e[0]<br />
if e[0] == e[1]:<br />
leftname = leftname + '1'<br />
rightname = rightname + '2'<br />
leftlist = createSelectionList(l)<br />
rightlist = createSelectionList(r)<br />
try:<br />
cmd.select(leftname, leftlist)<br />
cmd.select(rightname, rightlist)<br />
except:<br />
print leftname, '\t', leftlist<br />
print rightname, '\t', rightlist<br />
return leftname, rightname<br />
<br />
def parsePISAContacts( filename ):<br />
""" parse a PISA contact file and create atoms selections for all interfaces<br />
<br />
For each interface, two selections are created containing the atoms of <br />
the interface on each chain. The selection names follow the convention <br />
bondtype_#Id_Chain1Chain2. If Chain1 equals Chain2 then the two selections are <br />
numbered. <br />
<br />
bondtype corresponds to h-bonds, salt-bridges, ss-bonds and cov-bonds and<br />
are marked with the prefixes hb, sb, ss and cov.<br />
<br />
For example, all h-bonds in interface 3 between chain A and D create the selections<br />
hb_3_AD and hb_3_DA.<br />
<br />
Salt-bridges in interface 4 between chain A and a symmetry copy of A creates the selections<br />
sb_4_AA1 and sb_4_AA2.<br />
<br />
PARAMS<br />
filename <br />
filename of the PISA contacts file<br />
<br />
RETURNS<br />
a set of selections in PYMOL. <br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2011.<br />
"""<br />
<br />
bond_types = [<br />
('h-bonds', 'h-bonds/bond', 'hb'),<br />
('salt-bridges', 'salt-bridges/bond', 'sb'),<br />
('ss-bonds', 'ss-bonds/bond', 'ss'),<br />
('cov-bonds', 'cov-bonds/bond', 'cv')<br />
]<br />
<br />
tree = ElementTree.parse(open(filename))<br />
interfaces = tree.findall('//interface')<br />
<br />
result = []<br />
for name, path, prefix in bond_types:<br />
allcontacts = [edge for edge in [parseInterface(i, path) for i in interfaces] if edge != None]<br />
<br />
allselections = []<br />
for c in allcontacts:<br />
allselections.extend( createInterfaceSelection(c, prefix) )<br />
<br />
result.append(len(allselections)/2)<br />
if len(allselections) > 0:<br />
try:<br />
cmd.select(name, " or ".join(allselections))<br />
except:<br />
print name, '\t', " or ".join(allselections)<br />
<br />
print 'selectPISAContacts found interfaces with', <br />
for number, type in zip(result, bond_types):<br />
print number, type[0], ",",<br />
<br />
try:<br />
cmd.extend("selectPISAContacts", parsePISAContacts)<br />
except:<br />
# for debugging<br />
parsePISAContacts('../pisa/interfaces_2c7r.pisa')<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_contact&diff=9153Ccp4 contact2011-06-20T09:09:51Z<p>Dalyte: Minor fixes</p>
<hr />
<div>[[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.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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 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.<br />
<br />
== Usage ==<br />
<br />
selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use CONTACT to find interface residues/atoms in the pdb file. Once you have the log file proceed to PyMOL.<br />
Make sure you've run the selectCONTACTContacts script first.<br />
<br />
fetch 2c7r<br />
selectCONTACTContacts cont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseCONTACTContacts( f ):<br />
# Lys 24A ca Asp 263D CG ... 4.94 [ -1B ] 3: -X, Y+1/2, -Z+1/2<br />
conParser = re.compile("(\S*)\s*(\d+)([A-Z])\s*(\w+)")<br />
s1 = []<br />
s2 = []<br />
for line in f:<br />
if line.startswith('#'):<br />
continue<br />
matches = conParser.findall(line)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
<br />
return (s1, s2)<br />
<br />
def selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectCONTACTContacts -- parses CCP4/CONTACT log file and selects residues and atoms.<br />
http://www.ccp4.ac.uk/html/contact.html<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4/CONTACT log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
4 selections of interface residues and atoms are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2011.<br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2 = parseCONTACTContacts(open(contactsfile))<br />
<br />
# create a selection for the first contact list<br />
<br />
# create the PYMOL selection macros for the residues <br />
resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s1]<br />
# put them in a set to remove duplicates and then join with 'or'<br />
resSel = " or ".join(frozenset(resNames))<br />
# finally select them under the new name<br />
cmd.select(selName1 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s1]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName1 + "_atom", atomSel)<br />
<br />
# create a selection for the second contact list<br />
<br />
resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s2]<br />
resSel = " or ".join(frozenset(resNames))<br />
cmd.select(selName2 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s2]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName2 + "_atom", atomSel)<br />
<br />
cmd.extend("selectCONTACTContacts", selectCONTACTContacts)<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_pisa&diff=9150Ccp4 pisa2011-06-19T20:45:06Z<p>Dalyte: added new script to parse PISA output</p>
<hr />
<div>== Overview ==<br />
<br />
The script selects atoms from the list of the contacts found by PISA.<br />
First, we run PISA on our pdb file to find the interfaces. Then by using the selectPISAContacts script in PyMOL we separately select atoms for all interface types and individual interfaces. This generates many selections, two for each interface, allowing quick manipulation of (sometimes) extensive lists in PISA log file.<br />
<br />
== Usage ==<br />
<br />
selectPISAContacts( pisafile )<br />
<br />
<br />
== Examples ==<br />
<br />
The script parses the XML output files from the PISA service or command line tool. A short description of how to download the XML output files is available here http://www.ebi.ac.uk/msd-srv/prot_int/pi_download.html. <br />
<br />
(For example, the following URL downloads the interfaces in 2c7r.pdb http://www.ebi.ac.uk/pdbe/pisa/cgi-bin/interfaces.pisa?2c7r)<br />
<br />
Make sure you've run the selectPISAContacts script first.<br />
<br />
fetch 2c7r<br />
selectPISAContacts interfaces_2c7r.pisa<br />
<br />
== The Code ==<br />
<source lang="python"><br />
from xml.etree import ElementTree<br />
<br />
def parseElement( element ):<br />
""" creates a dict for the sub elements of the element"""<br />
result = { }<br />
for l in range(len(element)):<br />
if element[l].text != None:<br />
result[element[l].tag.strip()] = element[l].text.strip()<br />
return result;<br />
<br />
def parseBond( elementDir ):<br />
""" puts bond information into tuples"""<br />
return ((elementDir['chain-1'], elementDir['seqnum-1'], elementDir['atname-1']), (elementDir['chain-2'], elementDir['seqnum-2'], elementDir['atname-2']))<br />
<br />
def parseInterface( interface, bondname ):<br />
""" parses a single interface into the interface id, the two chain names connected <br />
and two lists of atoms for each chain"""<br />
bonds = interface.findall(bondname)<br />
id = interface.find('id').text.strip()<br />
if len(bonds) == 0:<br />
return None<br />
left = []<br />
right = []<br />
for b in bonds:<br />
l, r = parseBond(parseElement(b))<br />
left.append(l)<br />
right.append(r)<br />
left_chain = left[0][0]<br />
right_chain = right[0][0]<br />
if left_chain > right_chain:<br />
return id, (right_chain, left_chain), right, left<br />
return id, (left_chain, right_chain), left, right<br />
<br />
def createSelectionList( atomlist ):<br />
"""creates a PYMOL selection string for a list of atoms"""<br />
atomnames = [chain+'/'+res+'/'+atom for chain, res, atom in atomlist]<br />
return " or ".join(atomnames)<br />
<br />
def createInterfaceSelection( interface, prefix ):<br />
"""creates two selections for an interfaces"""<br />
id, e, l, r = interface<br />
leftname = prefix+'_' + str(id) + '_' + e[0] + e[1]<br />
rightname = prefix+'_' + str(id) + '_' + e[1] + e[0]<br />
if e[0] == e[1]:<br />
leftname = leftname + '1'<br />
rightname = rightname + '2'<br />
leftlist = createSelectionList(l)<br />
rightlist = createSelectionList(r)<br />
try:<br />
cmd.select(leftname, leftlist)<br />
cmd.select(rightname, rightlist)<br />
except:<br />
print leftname, '\t', leftlist<br />
print rightname, '\t', rightlist<br />
return leftname, rightname<br />
<br />
def parsePISAContacts( filename ):<br />
""" parse a PISA contact file and create atoms selections for all interfaces<br />
<br />
For each interface, two selections are created containing the atoms of <br />
the interface on each chain. The selection names follow the convention <br />
bondtype_#Id_Chain1Chain2. If Chain1 equals Chain2 then the two selections are <br />
numbered. <br />
<br />
bondtype corresponds to h-bonds, salt-bridges, ss-bonds and cov-bonds and<br />
are marked with the prefixes hb, sb, ss and cov.<br />
<br />
For example, all h-bonds in interface 3 between chain A and D create the selections<br />
hb_3_AD and hb_3_DA.<br />
<br />
Salt-bridges in interface 4 between chain A and a symmetry copy of A creates the selections<br />
sb_4_AA1 and sb_4_AA2.<br />
<br />
PARAMS<br />
filename <br />
filename of the PISA contacts file<br />
<br />
RETURNS<br />
a set of selections in PYMOL. <br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2011.<br />
"""<br />
<br />
bond_types = [<br />
('h-bonds', 'h-bonds/bond', 'hb'),<br />
('salt-bridges', 'salt-bridges/bond', 'sb'),<br />
('ss-bonds', 'ss-bonds/bond', 'ss'),<br />
('cov-bonds', 'cov-bonds/bond', 'cv')<br />
]<br />
<br />
tree = ElementTree.parse(open(filename))<br />
interfaces = tree.findall('//interface')<br />
<br />
result = []<br />
for name, path, prefix in bond_types:<br />
allcontacts = [edge for edge in [parseInterface(i, path) for i in interfaces] if edge != None]<br />
<br />
allselections = []<br />
for c in allcontacts:<br />
allselections.extend( createInterfaceSelection(c, prefix) )<br />
<br />
result.append(len(allselections)/2)<br />
if len(allselections) > 0:<br />
try:<br />
cmd.select(name, " or ".join(allselections))<br />
except:<br />
print name, '\t', " or ".join(allselections)<br />
<br />
print 'selectPISAContacts found interfaces with', <br />
for number, type in zip(result, bond_types):<br />
print number, type[0], ",",<br />
<br />
try:<br />
cmd.extend("selectPISAContacts", parsePISAContacts)<br />
except:<br />
# for debugging<br />
parsePISAContacts('../pisa/interfaces_2uz4.pisa')<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_contact&diff=9149Ccp4 contact2011-06-19T20:34:45Z<p>Dalyte: added a new script to parse and select CONTACT output</p>
<hr />
<div>[[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.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
== Usage ==<br />
<br />
selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use CONTACT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the selectCONTACTContacts script first.<br />
<br />
fetch 2c7r<br />
selectCONTACTContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseCONTACTContacts( f ):<br />
# Lys 24A ca Asp 263D CG ... 4.94 [ -1B ] 3: -X, Y+1/2, -Z+1/2<br />
conParser = re.compile("(\S*)\s*(\d+)([A-Z])\s*(\w+)")<br />
s1 = []<br />
s2 = []<br />
for line in f:<br />
if line.startswith('#'):<br />
continue<br />
matches = conParser.findall(line)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
<br />
return (s1, s2)<br />
<br />
def selectCONTACTContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectCONTACTContacts -- parses CCP4/CONTACT log file and selects residues and atoms.<br />
http://www.ccp4.ac.uk/html/contact.html<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4/CONTACT log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
4 selections of interface residues and atoms are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2011.<br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2 = parseCONTACTContacts(open(contactsfile))<br />
<br />
# create a selection for the first contact list<br />
<br />
# create the PYMOL selection macros for the residues <br />
resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s1]<br />
# put them in a set to remove duplicates and then join with 'or'<br />
resSel = " or ".join(frozenset(resNames))<br />
# finally select them under the new name<br />
cmd.select(selName1 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s1]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName1 + "_atom", atomSel)<br />
<br />
# create a selection for the second contact list<br />
<br />
resNames = [chain+"/"+residue+"/" for (type, residue, chain, atom) in s2]<br />
resSel = " or ".join(frozenset(resNames))<br />
cmd.select(selName2 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, residue, chain, atom) in s2]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName2 + "_atom", atomSel)<br />
<br />
cmd.extend("selectCONTACTContacts", selectCONTACTContacts)<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=9148Ccp4 ncont2011-06-19T20:21:43Z<p>Dalyte: fixed long comment</p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of selectNCONTContacts 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.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
First, we run NCONT on our pdb file to find interface residues. Then by using the selectNCONTContacts 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.<br />
<br />
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.<br />
<br />
== Usage ==<br />
<br />
selectNCONTContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the selectNCONTContacts script first.<br />
<br />
fetch 2c7r<br />
selectNCONTContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseNCONTContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
# * in the second group is needed when chain code is blank<br />
conParser = re.compile("\s*/(\d+)/([A-Z]*)/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectNCONTContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4/NCONT log file and selects residues and atoms.<br />
http://www.ccp4.ac.uk/html/ncont.html<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4/NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
4 selections of interface residues and atoms are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009.<br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseNCONTContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
<br />
# create the PYMOL selection macros for the residues <br />
resNames = [chain+"/"+residue+"/" for (type, chain, residue, atom) in s1]<br />
# put them in a set to remove duplicates and then join with 'or'<br />
resSel = " or ".join(frozenset(resNames))<br />
# finally select them under the new name<br />
cmd.select(selName1 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, chain, residue, atom) in s1]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName1 + "_atom", atomSel)<br />
<br />
# create a selection for the second contact list<br />
<br />
resNames = [chain+"/"+residue+"/" for (type, chain, residue, atom) in s2]<br />
resSel = " or ".join(frozenset(resNames))<br />
cmd.select(selName2 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, chain, residue, atom) in s2]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName2 + "_atom", atomSel)<br />
<br />
cmd.extend("selectNCONTContacts", selectNCONTContacts)<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=9147Ccp4 ncont2011-06-19T20:19:12Z<p>Dalyte: updated script with faster selection and naming scheme.</p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of selectNCONTContacts 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.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
First, we run NCONT on our pdb file to find interface residues. Then by using the selectNCONTContacts 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.<br />
<br />
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.<br />
<br />
== Usage ==<br />
<br />
selectNCONTContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the selectNCONTContacts script first.<br />
<br />
fetch 2c7r<br />
selectNCONTContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseNCONTContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z]*)/\s*(\d+).*?/\s*([A-Z0-9]*).*?:") # * in the second group is needed when chain code is blank<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectNCONTContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4/NCONT log file and selects residues and atoms.<br />
http://www.ccp4.ac.uk/html/ncont.html<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4/NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
4 selections of interface residues and atoms are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
REPOSITORY<br />
https://github.com/GerhardR/pymol-scripts<br />
<br />
AUTHOR<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009.<br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseNCONTContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
<br />
# create the PYMOL selection macros for the residues <br />
resNames = [chain+"/"+residue+"/" for (type, chain, residue, atom) in s1]<br />
# put them in a set to remove duplicates and then join with 'or'<br />
resSel = " or ".join(frozenset(resNames))<br />
# finally select them under the new name<br />
cmd.select(selName1 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, chain, residue, atom) in s1]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName1 + "_atom", atomSel)<br />
<br />
# create a selection for the second contact list<br />
<br />
resNames = [chain+"/"+residue+"/" for (type, chain, residue, atom) in s2]<br />
resSel = " or ".join(frozenset(resNames))<br />
cmd.select(selName2 + "_res", resSel)<br />
<br />
atomNames = [chain+"/"+residue+"/"+atom for (type, chain, residue, atom) in s2]<br />
atomSel = " or ".join(frozenset(atomNames))<br />
cmd.select(selName2 + "_atom", atomSel)<br />
<br />
cmd.extend("selectNCONTContacts", selectNCONTContacts)<br />
</source><br />
<br />
== Code repository ==<br />
<br />
The latest version of this script and related scripts is available at https://github.com/GerhardR/pymol-scripts.<br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=ContactsNCONT&diff=9146ContactsNCONT2011-06-19T20:14:06Z<p>Dalyte: moved ContactsNCONT to SelectNCONTContacts: unify naming scheme for new scripts</p>
<hr />
<div>#REDIRECT [[SelectNCONTContacts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=9145Ccp4 ncont2011-06-19T20:14:06Z<p>Dalyte: moved ContactsNCONT to SelectNCONTContacts: unify naming scheme for new scripts</p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
First, we run NCONT on our pdb file to find interface residues. Then by using the ContactsNCONT 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.<br />
<br />
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.<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the ContactsNCONT script first.<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
# conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
conParser = re.compile("\s*/(\d+)/([A-Z]*)/\s*(\d+).*?/\s*([A-Z0-9]*).*?:") # * is needed when chain code is blank<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7649Ccp4 ncont2009-11-20T15:41:34Z<p>Dalyte: </p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
First, we run NCONT on our pdb file to find interface residues. Then by using the ContactsNCONT 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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the ContactsNCONT script first.<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7648Ccp4 ncont2009-11-20T15:05:38Z<p>Dalyte: </p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the ContactsNCONT script first.<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
[[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.]]<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7646Ccp4 ncont2009-11-20T14:51:31Z<p>Dalyte: </p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the ContactsNCONT script first.<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:ThirdParty Scripts]] [[Category:Structural Biology Scripts]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7645Ccp4 ncont2009-11-20T14:48:20Z<p>Dalyte: </p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.<br />
Make sure you've run the ContactsNCONT script first.<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7644Ccp4 ncont2009-11-20T14:47:33Z<p>Dalyte: </p>
<hr />
<div>[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''<br />
''Make sure you've run the ContactsNCONT script first.''<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7643Ccp4 ncont2009-11-20T14:46:59Z<p>Dalyte: </p>
<hr />
<div>== ContactsNCONT ==<br />
<br />
[[File:HhaExample.png|thumb|300px|right|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, respectively. Atoms in contact are shown in dots.]]<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''<br />
''Make sure you've run the ContactsNCONT script first.''<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7642Ccp4 ncont2009-11-20T14:45:03Z<p>Dalyte: </p>
<hr />
<div>== ContactsNCONT ==<br />
<br />
[[File:HhaExample.png|300px|right]]<br />
<br />
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, <br />
respectively. Atoms in contact are pictured in dots.<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''<br />
''Make sure you've run the ContactsNCONT script first.''<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<source lang="python"><br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
</source><br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=Ccp4_ncont&diff=7641Ccp4 ncont2009-11-20T14:40:45Z<p>Dalyte: Created page with '== ContactsNCONT == right Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of ContactsNCONT script in PyMOL allows…'</p>
<hr />
<div>== ContactsNCONT ==<br />
<br />
[[File:HhaExample.png|300px|right]]<br />
<br />
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, <br />
respectively. Atoms in contact are pictured in dots.<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''<br />
''Make sure you've run the ContactsNCONT script first.''<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<br />
<br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
<br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=Category_talk:Script_Library&diff=7640Category talk:Script Library2009-11-20T14:13:30Z<p>Dalyte: </p>
<hr />
<div>= Requests =<br />
Please place your PyMOL script requests here. A few other people might have the same request and someone might just code it up for free (viz. all these other scripts). There are no guarantees that someone will write your script, but it doesn't hurt asking.<br />
<br />
'''ExampleScriptTitle'''<br />
:: Example text of what the new awesome script is supposed to do in PyMOL. Consider posting some contact information, so once the script is posted you are apprised.<br />
<br />
<br />
==Instruction request==<br />
Would it be possible to add short instructions to category page for new users how to run scripts in pymol...(?)<br />
<br />
= Policy =<br />
== Rules ==<br />
We want the script library to be as valuable as possible to the public. Therefore, please follow these rules when posting code to the wiki:<br />
* Only post code if you have the legal right to do so<br />
* All posted code must be released under some [http://www.opensource.org/licenses|open source license] or freer (public domain).<br />
** Authors may maintain copyright<br />
** Only post links to code that is not open source licensed, do not copy it onto the wiki<br />
<br />
== Depositing Scripts ==<br />
* Create a new page for your script<br />
* Please provide<br />
** an overview of what the script does<br />
** any usage comments or hints<br />
** the source code<br />
* Please add the following to the bottom of your new page:<br><nowiki>[[Category:Script_Library]]<br />
[[Category:PUT_SUBCATEGORY_NAME_HERE]]</nowiki><br />
<br />
<br />
= General Notes =<br />
== Notes ==<br />
* Feel free to add scripts (see [[#Rules|rules]] below).<br />
* Feel free to add new categories<br />
* You can make script requests on this page's discussion page<br />
* [http://github.com/jlec/Pymol-script-repo GIT Repository] of all our scripts: <source lang="python">git clone git://github.com/jlec/Pymol-script-repo.git</source><br />
<br />
== GitHub for Pymol-scripts==<br />
I created a github for the pymol scripts. I think this is a good way to to collect and enlarge the collection of scripts. The repo is public accessible so contribute. If you need help on git just write me an email.<br />
<br />
http://github.com/jlec/Pymol-script-repo</div>Dalytehttps://pymolwiki.org/index.php?title=Category_talk:Script_Library&diff=7639Category talk:Script Library2009-11-20T14:11:00Z<p>Dalyte: </p>
<hr />
<div>= Requests =<br />
Please place your PyMOL script requests here. A few other people might have the same request and someone might just code it up for free (viz. all these other scripts). There are no guarantees that someone will write your script, but it doesn't hurt asking.<br />
<br />
'''ExampleScriptTitle'''<br />
:: Example text of what the new awesome script is supposed to do in PyMOL. Consider posting some contact information, so once the script is posted you are apprised.<br />
<br />
<br />
==Instruction request==<br />
Would it be possible to add short instructions to category page for new users how to run scripts in pymol...(?)<br />
<br />
= Policy =<br />
== Rules ==<br />
We want the script library to be as valuable as possible to the public. Therefore, please follow these rules when posting code to the wiki:<br />
* Only post code if you have the legal right to do so<br />
* All posted code must be released under some [http://www.opensource.org/licenses|open source license] or freer (public domain).<br />
** Authors may maintain copyright<br />
** Only post links to code that is not open source licensed, do not copy it onto the wiki<br />
<br />
== Depositing Scripts ==<br />
* Create a new page for your script<br />
* Please provide<br />
** an overview of what the script does<br />
** any usage comments or hints<br />
** the source code<br />
* Please add the following to the bottom of your new page:<br><nowiki>[[Category:Script_Library]]<br />
[[Category:PUT_SUBCATEGORY_NAME_HERE]]</nowiki><br />
<br />
<br />
= General Notes =<br />
== Notes ==<br />
* Feel free to add scripts (see [[#Rules|rules]] below).<br />
* Feel free to add new categories<br />
* You can make script requests on this page's discussion page<br />
* [http://github.com/jlec/Pymol-script-repo GIT Repository] of all our scripts: <source lang="python">git clone git://github.com/jlec/Pymol-script-repo.git</source><br />
<br />
== GitHub for Pymol-scripts==<br />
I created a github for the pymol scripts. I think this is a good way to to collect and enlarge the collection of scripts. The repo is public accessible so contribute. If you need help on git just write me an email.<br />
<br />
http://github.com/jlec/Pymol-script-repo<br />
<br />
== ContactsNCONT ==<br />
<br />
[[File:HhaExample.png]]<br />
<br />
Interface residues (at cutoff <4A) in the 2c7r.pdb were found using NCONT. Usage of ContactsNCONT script in PyMOL allows easy <br />
selection of residues and atoms listed in ncont.log file. Interacting protein and DNA residues are colored in red and slate, <br />
respectively. Atoms in contact are in dots.<br />
<br />
== Overview ==<br />
<br />
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).<br />
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.<br />
<br />
<br />
== Usage ==<br />
<br />
selectContacts( contactsfile, selName1 = "source", selName2 = "target" )<br />
<br />
<br />
== Examples ==<br />
<br />
<br />
''First use NCONT to find interface residues/atoms in the same pdb file. Once you have ncont.log file proceed to PyMOL.''<br />
''Make sure you've run the ContactsNCONT script first.''<br />
<br />
fetch 2c7r<br />
selectContacts ncont.log, selName1=prot, selName2=dna<br />
<br />
<br />
== The Code ==<br />
<br />
<br />
import re<br />
<br />
def parseContacts( f ):<br />
# /1/B/ 282(PHE). / CE1[ C]: /1/E/ 706(GLN). / O [ O]: 3.32<br />
conParser = re.compile("\s*/(\d+)/([A-Z])/\s*(\d+).*?/\s*([A-Z0-9]*).*?:")<br />
mode = 0<br />
s1 = []<br />
s2 = []<br />
pairs = []<br />
for line in f:<br />
if mode == 0:<br />
if line.strip().startswith("SOURCE ATOMS"):<br />
mode = 1<br />
elif mode == 1:<br />
mode = 2<br />
elif mode == 2:<br />
matches = conParser.findall(line)<br />
if len(matches) == 0:<br />
return (s1, s2, pairs)<br />
if len(matches) == 2:<br />
s1.append(matches[0])<br />
s2.append(matches[1])<br />
elif len(matches) == 1:<br />
s2.append(matches[0])<br />
pairs.append((len(s1)-1, len(s2)-1))<br />
else:<br />
print "Unknown mode", mode<br />
<br />
def selectContacts( contactsfile, selName1 = "source", selName2 = "target" ):<br />
"""<br />
selectContacts -- parses CCP4 NCONT log file and selects residues and atoms from the list of the contacts found.<br />
<br />
PARAMS<br />
contactsfile<br />
filename of the CCP4 NCONT contacts log file<br />
<br />
selName1<br />
the name prefix for the _res and _atom selections returned for the<br />
source set of chain<br />
<br />
selName2<br />
the name prefix for the _res and _atom selections returned for the <br />
target set of chain<br />
<br />
RETURNS<br />
* 2 selections of interface residues and atoms for each chain are created and named<br />
depending on what you passed into selName1 and selName2<br />
<br />
AUTHOR:<br />
Gerhard Reitmayr and Dalia Daujotyte, 2009. <br />
"""<br />
# read and parse contacts file into two lists of contact atoms and contact pair list<br />
s1, s2, pairs = parseContacts(open(contactsfile))<br />
# create a selection for the first contact list<br />
resName = selName1 + "_res"<br />
atomName = selName1 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s1:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
# create a selection for the second contact list<br />
resName = selName2 + "_res"<br />
atomName = selName2 + "_atom"<br />
cmd.select(resName, None)<br />
cmd.select(atomName, None)<br />
for (thing, chain, residue, atom) in s2:<br />
cmd.select( resName, resName + " or " + chain+"/"+residue+"/")<br />
cmd.select( atomName, atomName + " or " + chain+"/"+residue+"/"+atom)<br />
<br />
cmd.extend("selectContacts", selectContacts)<br />
<br />
<br />
[[Category:Script_Library]] [[Category:Third Party]] [[Category:Structural Biology]]</div>Dalytehttps://pymolwiki.org/index.php?title=File:HhaExample.png&diff=7629File:HhaExample.png2009-11-18T16:40:38Z<p>Dalyte: </p>
<hr />
<div></div>Dalytehttps://pymolwiki.org/index.php?title=File:HhaI20example.png&diff=7628File:HhaI20example.png2009-11-18T16:25:29Z<p>Dalyte: </p>
<hr />
<div></div>Dalyte