https://pymolwiki.org/api.php?action=feedcontributions&user=Jurgenfd&feedformat=atomPyMOLWiki - User contributions [en]2024-03-28T10:15:13ZUser contributionsMediaWiki 1.35.7https://pymolwiki.org/index.php?title=CreateSecondaryStructure&diff=4138CreateSecondaryStructure2007-08-22T14:01:27Z<p>Jurgenfd: </p>
<hr />
<div>===DESCRIPTION===<br />
To build a peptide sequence. <br />
<br />
===SETUP===<br />
run CreateSecondaryStructure.py<br />
<br />
===NOTES / STATUS===<br />
*Tested on Pymolv1.0, Windows platform<br />
*Many bugs to be found<br />
<br />
===USAGE===<br />
*seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
with in the file something like:<br />
MET,-54,-47<br />
PRO,-54,-47<br />
<br />
*seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
*createPeptide(seqInfo)<br />
<br />
===EXAMPLES===<br />
seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
createPeptide(seqInfo)<br />
<br />
===SCRIPTS (CreateSecondaryStructures.py)===<br />
CreateSecondaryStructures.py <br />
<source lang="python"><br />
##############################################<br />
# Original Author: Dan Kulp<br />
# Date : 9/8/2005<br />
# MOdified by Jurgen F. Doreleijers<br />
# For Hamid Eghbalnia <br />
#<br />
#############################################<br />
# Call in window like : <br />
# @C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils\CreateSecondaryStructures.py<br />
# Next line is a pymol directive<br />
python<br />
import string<br />
import urllib<br />
<br />
<br />
# Well I guess one can build a protein with it but the vdw contacts would be horrible.<br />
# Peptide needs to be at least 2 residues.<br />
def createPeptide(seqInfo):<br />
cmd.delete("all")<br />
# Creates residue TWO<br />
editor.attach_amino_acid('pk1',seqInfo[1][0]) <br />
# Creates residue ONE<br />
createSS('resi 2', sequence=seqInfo[0][0],terminal='N')<br />
print "found sequence info for number of residues: ", len(seqInfo)<br />
for i in range(2,len(seqInfo) ):<br />
# resn is the residue number of the new residue<br />
resn = i + 1<br />
print "Adding residue: ", resn, seqInfo[i][0]<br />
# Note that the previous residue is numbered i. <br />
resi = 'resi '+`i`<br />
createSS(resi, sequence=seqInfo[i][0])<br />
for i in range( len(seqInfo) ):<br />
resi = 'resi '+`i+1`<br />
# print "Setting backbone angles for residue: ", (i+1), seqInfo[i][0],seqInfo[i][1],seqInfo[i][2]<br />
set_phipsi(resi,seqInfo[i][1],seqInfo[i][2])<br />
<br />
# Create generic secondary structure, based off a selection<br />
def createSS(sel, sequence='ALA',repeat=1,terminal='C'):<br />
<br />
# Set selection<br />
selection = "%s and name %s" % (sel,terminal)<br />
<br />
# Pick atom for editing - interestingly only need to do this for the first addition<br />
cmd.edit(selection,None,None,None,pkresi=0,pkbond=0)<br />
<br />
# Array of residues<br />
seq = string.split(sequence,",")<br />
<br />
# Get residue numbering .. potential bug here if number is inconsistent.. (Only works at c-terminal)<br />
resi = int(cmd.get_model(sel).atom[0].resi) + 1<br />
# Loop and build new residues<br />
for i in range(1,repeat+1):<br />
for s in seq:<br />
# print "residue[%i]: %s %s" % (i,s,terminal)<br />
editor.attach_amino_acid('pk1',s)<br />
<br />
# Remove extra OXT carboxylate atom (OXT1, OXT2 ?) .. fix as needed<br />
if terminal == 'C':<br />
cmd.remove("%s and name OXT" % sel)<br />
<br />
<br />
def set_phipsi(sel,phi,psi):<br />
# Get atoms from selection<br />
atoms = cmd.get_model("byres ("+sel+")")<br />
<br />
# Loop through atoms in selection <br />
for at in atoms.atom:<br />
if at.name == "N":<br />
# Check for a null chain id (some PDBs contain this) <br />
unit_select = ""<br />
if not at.chain == "":<br />
unit_select = "chain "+str(at.chain)+" and "<br />
<br />
try:<br />
# Define residue selections <br />
residue_def_prev = unit_select+'resi '+str(int(at.resi)-1)<br />
residue_def = unit_select+'resi '+str(at.resi) <br />
# print "residue_def_prev: [%s]" % residue_def_prev<br />
# print "residue_def : [%s]" % residue_def<br />
if at.resn == "PRO":<br />
print "Skipping setting phi for PRO"<br />
else:<br />
old_phi = cmd.get_dihedral(residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C') <br />
cmd.set_dihedral( residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C' ,phi)<br />
print "Changed residue %4s %4s phi: from %6.1f to %6.1f" % (at.resn, at.resi, old_phi, float(phi)) <br />
except:<br />
<br />
print "Note skipping set of phi because of error; this is normal for a N-terminal residue"<br />
try:<br />
residue_def = unit_select+'resi '+str(at.resi)<br />
residue_def_next = unit_select+'resi '+str(int(at.resi)+1)<br />
# print "residue_def : [%s]" % residue_def<br />
# print "residue_def_next: [%s]" % residue_def_next<br />
old_psi = cmd.get_dihedral(residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N')<br />
cmd.set_dihedral( residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N',psi)<br />
print "Changed residue %4s %4s psi: from %6.1f to %6.1f" % (at.resn, at.resi, old_psi, float(psi)) <br />
except:<br />
print "Note skipping set of psi; this is normal for a C terminal residue"<br />
<br />
def getTableFromCsvFile(urlLocation):<br />
result = []<br />
r1 = urllib.urlopen(urlLocation)<br />
data = r1.read()<br />
r1.close() <br />
dataLines = data.split("\n") <br />
for dataLine in dataLines:<br />
if dataLine:<br />
result.append( dataLine.split(',') ) <br />
return result<br />
<br />
# next line is a pymol directive.<br />
python end<br />
<br />
os.chdir("C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils")<br />
seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
createPeptide(seqInfo)<br />
<br />
</source><br />
<br />
<br />
[[Category:Script_Library|CreateSecondaryStructure]]<br />
<br />
[[Category:Structural_Biology_Scripts|CreateSecondaryStructure]]</div>Jurgenfdhttps://pymolwiki.org/index.php?title=CreateSecondaryStructure&diff=4137CreateSecondaryStructure2007-08-21T01:16:41Z<p>Jurgenfd: Added example</p>
<hr />
<div>===DESCRIPTION===<br />
To build a peptide sequence. <br />
<br />
===SETUP===<br />
run CreateSecondaryStructure.py<br />
<br />
===NOTES / STATUS===<br />
*Tested on Pymolv1.0, Windows platform<br />
*Many bugs to be found<br />
<br />
===USAGE===<br />
*seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
with in the file something like:<br />
MET,-54,-47<br />
PRO,-54,-47<br />
<br />
*seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
*createPeptide(seqInfo)<br />
<br />
===EXAMPLES===<br />
seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
createPeptide(seqInfo)<br />
<br />
===SCRIPTS (CreateSecondaryStructures.py)===<br />
CreateSecondaryStructures.py <br />
<source lang="python"><br />
##############################################<br />
# Original Author: Dan Kulp<br />
# Date : 9/8/2005<br />
# MOdified by Jurgen F. Doreleijers<br />
# For Hamid Eghbalnia <br />
#<br />
#############################################<br />
# Call in pymol window like : <br />
# @C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils\CreateSecondaryStructures.py<br />
# Next line is a pymol directive<br />
python<br />
import string<br />
import urllib<br />
<br />
<br />
# Well I guess one can build a protein with it but the vdw contacts would be horrible.<br />
# Peptide needs to be at least 2 residues.<br />
def createPeptide(seqInfo):<br />
cmd.delete("all")<br />
# Creates residue TWO<br />
editor.attach_amino_acid('pk1',seqInfo[1][0]) <br />
# Creates residue ONE<br />
createSS('resi 2', sequence=seqInfo[0][0],terminal='N')<br />
print "found sequence info for number of residues: ", len(seqInfo)<br />
for i in range(2,len(seqInfo) ):<br />
# resn is the residue number of the new residue<br />
resn = i + 1<br />
print "Adding residue: ", resn, seqInfo[i][0]<br />
# Note that the previous residue is numbered i. <br />
resi = 'resi '+`i`<br />
createSS(resi, sequence=seqInfo[i][0])<br />
for i in range( len(seqInfo) ):<br />
resi = 'resi '+`i+1`<br />
print "Setting backbone angles for residue: ", i, seqInfo[i][0],seqInfo[i][1],seqInfo[i][2]<br />
set_phipsi(resi,seqInfo[i][1],seqInfo[i][2])<br />
<br />
# Create generic secondary structure, based off a selection<br />
def createSS(sel, sequence='ALA',repeat=1,terminal='C'):<br />
<br />
# Set selection<br />
selection = "%s and name %s" % (sel,terminal)<br />
<br />
# Pick atom for editing - interestingly only need to do this for the first addition<br />
cmd.edit(selection,None,None,None,pkresi=0,pkbond=0)<br />
<br />
# Array of residues<br />
seq = string.split(sequence,",")<br />
<br />
# Get residue numbering .. potential bug here if number is inconsistent.. (Only works at c-terminal)<br />
resi = int(cmd.get_model(sel).atom[0].resi) + 1<br />
# Loop and build new residues<br />
for i in range(1,repeat+1):<br />
for s in seq:<br />
# print "residue[%i]: %s %s" % (i,s,terminal)<br />
editor.attach_amino_acid('pk1',s)<br />
<br />
# Remove extra OXT carboxylate atom (OXT1, OXT2 ?) .. fix as needed<br />
if terminal == 'C':<br />
cmd.remove("%s and name OXT" % sel)<br />
<br />
<br />
def set_phipsi(sel,phi,psi):<br />
# Get atoms from selection<br />
atoms = cmd.get_model("byres ("+sel+")")<br />
<br />
# Loop through atoms in selection <br />
for at in atoms.atom:<br />
if at.name == "N":<br />
# Check for a null chain id (some PDBs contain this) <br />
unit_select = ""<br />
if not at.chain == "":<br />
unit_select = "chain "+str(at.chain)+" and "<br />
<br />
try:<br />
# Define residue selections <br />
residue_def_prev = unit_select+'resi '+str(int(at.resi)-1)<br />
residue_def = unit_select+'resi '+str(at.resi) <br />
# print "residue_def_prev: [%s]" % residue_def_prev<br />
# print "residue_def : [%s]" % residue_def<br />
if at.resn == "PRO":<br />
print "Skipping setting phi for PRO"<br />
else:<br />
old_phi = cmd.get_dihedral(residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C') <br />
print "Changing phi: "+at.resn+str(at.resi)+" from "+str(old_phi)+" to "+str(phi) <br />
cmd.set_dihedral( residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C' ,phi)<br />
except:<br />
print "Note skipping set of phi; this is normal for a N-terminal residue"<br />
try:<br />
residue_def = unit_select+'resi '+str(at.resi)<br />
residue_def_next = unit_select+'resi '+str(int(at.resi)+1)<br />
# print "residue_def : [%s]" % residue_def<br />
# print "residue_def_next: [%s]" % residue_def_next<br />
old_psi = cmd.get_dihedral(residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N')<br />
print "Changing psi: "+at.resn+str(at.resi)+" from "+str(old_psi)+" to "+str(psi)<br />
cmd.set_dihedral( residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N',psi)<br />
except:<br />
print "Note skipping set of psi; this is normal for a C terminal residue"<br />
<br />
def getTableFromCsvFile(urlLocation):<br />
result = []<br />
r1 = urllib.urlopen(urlLocation)<br />
data = r1.read()<br />
r1.close() <br />
dataLines = data.split("\n") <br />
for dataLine in dataLines:<br />
if dataLine:<br />
result.append( dataLine.split(',') ) <br />
return result<br />
<br />
# next line is a pymol directive.<br />
python end<br />
<br />
os.chdir("C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils")<br />
seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
createPeptide(seqInfo)<br />
<br />
</source><br />
<br />
<br />
[[Category:Script_Library|CreateSecondaryStructure]]<br />
<br />
[[Category:Structural_Biology_Scripts|CreateSecondaryStructure]]</div>Jurgenfdhttps://pymolwiki.org/index.php?title=CreateSecondaryStructure&diff=4136CreateSecondaryStructure2007-08-20T21:55:23Z<p>Jurgenfd: Pretty big rewrite</p>
<hr />
<div>===DESCRIPTION===<br />
To build a peptide sequence. <br />
<br />
===SETUP===<br />
run CreateSecondaryStructure.py<br />
<br />
===NOTES / STATUS===<br />
*Tested on Pymolv1.0, Windows platform<br />
*Many bugs to be found<br />
<br />
===USAGE===<br />
*seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
or<br />
*seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
*createPeptide(seqInfo)<br />
<br />
===EXAMPLES===<br />
seqInfo = [['MET',-57,-47],['PRO',-57,-47]]<br />
createPeptide(seqInfo)<br />
<br />
===SCRIPTS (CreateSecondaryStructures.py)===<br />
CreateSecondaryStructures.py <br />
<source lang="python"><br />
##############################################<br />
# Original Author: Dan Kulp<br />
# Date : 9/8/2005<br />
# MOdified by Jurgen F. Doreleijers<br />
# For Hamid Eghbalnia <br />
#<br />
#############################################<br />
# Call in pymol window like : <br />
# @C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils\CreateSecondaryStructures.py<br />
# Next line is a pymol directive<br />
python<br />
import string<br />
import urllib<br />
<br />
<br />
# Well I guess one can build a protein with it but the vdw contacts would be horrible.<br />
# Peptide needs to be at least 2 residues.<br />
def createPeptide(seqInfo):<br />
cmd.delete("all")<br />
# Creates residue TWO<br />
editor.attach_amino_acid('pk1',seqInfo[1][0]) <br />
# Creates residue ONE<br />
createSS('resi 2', sequence=seqInfo[0][0],terminal='N')<br />
print "found sequence info for number of residues: ", len(seqInfo)<br />
for i in range(2,len(seqInfo) ):<br />
# resn is the residue number of the new residue<br />
resn = i + 1<br />
print "Adding residue: ", resn, seqInfo[i][0]<br />
# Note that the previous residue is numbered i. <br />
resi = 'resi '+`i`<br />
createSS(resi, sequence=seqInfo[i][0])<br />
for i in range( len(seqInfo) ):<br />
resi = 'resi '+`i+1`<br />
print "Setting backbone angles for residue: ", i, seqInfo[i][0],seqInfo[i][1],seqInfo[i][2]<br />
set_phipsi(resi,seqInfo[i][1],seqInfo[i][2])<br />
<br />
# Create generic secondary structure, based off a selection<br />
def createSS(sel, sequence='ALA',repeat=1,terminal='C'):<br />
<br />
# Set selection<br />
selection = "%s and name %s" % (sel,terminal)<br />
<br />
# Pick atom for editing - interestingly only need to do this for the first addition<br />
cmd.edit(selection,None,None,None,pkresi=0,pkbond=0)<br />
<br />
# Array of residues<br />
seq = string.split(sequence,",")<br />
<br />
# Get residue numbering .. potential bug here if number is inconsistent.. (Only works at c-terminal)<br />
resi = int(cmd.get_model(sel).atom[0].resi) + 1<br />
# Loop and build new residues<br />
for i in range(1,repeat+1):<br />
for s in seq:<br />
# print "residue[%i]: %s %s" % (i,s,terminal)<br />
editor.attach_amino_acid('pk1',s)<br />
<br />
# Remove extra OXT carboxylate atom (OXT1, OXT2 ?) .. fix as needed<br />
if terminal == 'C':<br />
cmd.remove("%s and name OXT" % sel)<br />
<br />
<br />
def set_phipsi(sel,phi,psi):<br />
# Get atoms from selection<br />
atoms = cmd.get_model("byres ("+sel+")")<br />
<br />
# Loop through atoms in selection <br />
for at in atoms.atom:<br />
if at.name == "N":<br />
# Check for a null chain id (some PDBs contain this) <br />
unit_select = ""<br />
if not at.chain == "":<br />
unit_select = "chain "+str(at.chain)+" and "<br />
<br />
try:<br />
# Define residue selections <br />
residue_def_prev = unit_select+'resi '+str(int(at.resi)-1)<br />
residue_def = unit_select+'resi '+str(at.resi) <br />
# print "residue_def_prev: [%s]" % residue_def_prev<br />
# print "residue_def : [%s]" % residue_def<br />
if at.resn == "PRO":<br />
print "Skipping setting phi for PRO"<br />
else:<br />
old_phi = cmd.get_dihedral(residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C') <br />
print "Changing phi: "+at.resn+str(at.resi)+" from "+str(old_phi)+" to "+str(phi) <br />
cmd.set_dihedral( residue_def_prev+' and name C',residue_def+' and name N', residue_def+' and name CA',residue_def+' and name C' ,phi)<br />
except:<br />
print "Note skipping set of phi; this is normal for a N-terminal residue"<br />
try:<br />
residue_def = unit_select+'resi '+str(at.resi)<br />
residue_def_next = unit_select+'resi '+str(int(at.resi)+1)<br />
# print "residue_def : [%s]" % residue_def<br />
# print "residue_def_next: [%s]" % residue_def_next<br />
old_psi = cmd.get_dihedral(residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N')<br />
print "Changing psi: "+at.resn+str(at.resi)+" from "+str(old_psi)+" to "+str(psi)<br />
cmd.set_dihedral( residue_def +' and name N',residue_def+' and name CA',residue_def+' and name C', residue_def_next+' and name N',psi)<br />
except:<br />
print "Note skipping set of psi; this is normal for a C terminal residue"<br />
<br />
def getTableFromCsvFile(urlLocation):<br />
result = []<br />
r1 = urllib.urlopen(urlLocation)<br />
data = r1.read()<br />
r1.close() <br />
dataLines = data.split("\n") <br />
for dataLine in dataLines:<br />
if dataLine:<br />
result.append( dataLine.split(',') ) <br />
return result<br />
<br />
# next line is a pymol directive.<br />
python end<br />
<br />
os.chdir("C:\Documents and Settings\jurgen.WHELK.000\workspace\Wattos\python\Wattos\Utils")<br />
seqInfo = getTableFromCsvFile("seqInfo.csv")<br />
createPeptide(seqInfo)<br />
<br />
</source><br />
<br />
<br />
[[Category:Script_Library|CreateSecondaryStructure]]<br />
<br />
[[Category:Structural_Biology_Scripts|CreateSecondaryStructure]]</div>Jurgenfdhttps://pymolwiki.org/index.php?title=CreateSecondaryStructure&diff=4129CreateSecondaryStructure2007-08-16T17:12:51Z<p>Jurgenfd: /* SCRIPTS (CreateSecondaryStructures.py) */</p>
<hr />
<div>*Many bugs found, need to be worked out before further use... stay tuned.<br />
<br />
===DESCRIPTION===<br />
To enable growing of a peptide sequence of one of the terminals. The growing can be set to any secondary structure (phi,psi pairing). Only extendHelix is currently implemented, but it should be rather simple to add more functions in or tweak the existing ones.<br />
<br />
Functions:<br />
*extendHelix<br />
*createSS<br />
*set_phipsi<br />
<br />
===SETUP===<br />
run CreateSecondaryStructure.py<br />
<br />
===NOTES / STATUS===<br />
*Tested on Pymolv0.97, Windows platform<br />
*N-terminal growing doesn't work: adds residues, but doesn't set angles correctly<br />
*Many bugs found, need to be worked out before further use... stay tuned.<br />
<br />
===USAGE===<br />
extendHelix selection,sequence,repeat [, phi] [, psi] [, terminal ]<br />
set_phipsi selection, phi, psi<br />
<br />
===EXAMPLES===<br />
extendHelix('resi 1371', 'ALA,GLN,HIS,ALA', 5)<br />
set_phipsi('resi 1371', -60, -60)<br />
<br />
===SCRIPTS (CreateSecondaryStructures.py)===<br />
CreateSecondaryStructures.py <br />
<source lang="python"><br />
<br />
##############################################<br />
# Author: Dan Kulp<br />
# Date : 9/8/2005<br />
#<br />
#<br />
# Notes: <br />
# - Simple builds a string of residues<br />
# and sets the phi,psi angles.<br />
# - No energies are computed.<br />
# - This will generate a starting point.<br />
# - Defaultly grows from C-term, <br />
# - N-term growing currently broken<br />
#############################################<br />
<br />
import string<br />
<br />
# Wrapper Functions...<br />
print "extendHelix(selection,sequence,repeat)"<br />
print "Example:\n\t extendHelix('resi 1371', 'ALA,GLN,HIS,ALA', 5)"<br />
print "Note: simple build of residue type and phi,psi angle; no energy computed" <br />
<br />
def extendHelix(sel,seq,repeat=1,phi=-60,psi=-60,terminal='C'):<br />
createSS(sel,seq,repeat,phi,psi,string.upper(terminal))<br />
cmd.select("extendedHelix","all")<br />
cmd.deselect()<br />
cmd.save("./extendedHelix.pdb","extendedHelix")<br />
<br />
<br />
# Create generic secondary structure, based off a selection<br />
def createSS(sel, sequence='ALA',repeat=1,phi=-60,psi=-60,terminal='C'):<br />
<br />
# Set selection<br />
selection = "%s and name %s" % (sel,terminal)<br />
<br />
# Pick atom for editing - interestingly only need to do this for the first addition<br />
cmd.edit(selection,None,None,None,pkresi=0,pkbond=0)<br />
<br />
# Array of residues<br />
seq = string.split(sequence,",")<br />
<br />
# Get residue numbering .. potential bug here if number is inconsistent.. (Only works at c-terminal)<br />
resi = int(cmd.get_model(sel).atom[0].resi) + 1<br />
<br />
# Loop and build new residues<br />
for i in range(1,repeat+1):<br />
for s in seq:<br />
print "residue[%i]: %s" % (i,s)<br />
editor.attach_amino_acid('pk1',s)<br />
<br />
# Loop and set phi,psi angles for new residues<br />
if terminal == 'N':<br />
resi -= repeat<br />
<br />
for i in range(0,repeat+1):<br />
for s in seq:<br />
set_phipsi("resi %i" % (resi), phi,psi)<br />
resi += 1<br />
<br />
# Remove extra OXT carboxylate atom (OXT1, OXT2 ?) .. fix as needed<br />
if terminal == 'C':<br />
cmd.remove("%s and name OXT" % sel)<br />
<br />
<br />
def set_phipsi(sel,phi,psi):<br />
<br />
# Set up some variables..<br />
residues = ['dummy'] # Keep track of residues already done<br />
probs = [] # probability of each residue conformation<br />
<br />
# Get atoms from selection<br />
atoms = cmd.get_model("byres ("+sel+")")<br />
<br />
# Loop through atoms in selection <br />
for at in atoms.atom:<br />
try:<br />
# Don't process Glycines or Alanines<br />
if at.resn == 'GLY' or at.chain+":"+at.resn+":"+at.resi in residues:<br />
continue<br />
<br />
residues.append(at.chain+":"+at.resn+":"+at.resi)<br />
<br />
# Check for a null chain id (some PDBs contain this) <br />
unit_select = ""<br />
if not at.chain == "":<br />
unit_select = "chain "+str(at.chain)+" and "<br />
<br />
# Define selections for residue i-1, i and i+1 <br />
residue_def = unit_select+'resi '+str(at.resi)<br />
residue_def_prev = unit_select+'resi '+str(int(at.resi)-1)<br />
# residue_def_next = unit_select+'resi '+str(int(at.resi)+1)<br />
<br />
# Compute phi/psi angle<br />
old_phi = cmd.get_dihedral(residue_def+' and name CB',residue_def+' and name CA',residue_def+' and name N',residue_def_prev+' and name C')<br />
old_psi = cmd.get_dihedral(residue_def+' and name O',residue_def+' and name C',residue_def+' and name CA',residue_def+' and name CB')<br />
<br />
print "Changing "+at.resn+str(at.resi)+" from "+str(old_phi)+","+str(old_psi)+" to "+str(phi)+","+str(psi)<br />
<br />
cmd.set_dihedral(residue_def+' and name CB',residue_def+' and name CA',residue_def+' and name N',residue_def_prev+' and name C',phi)<br />
cmd.set_dihedral(residue_def+' and name O',residue_def+' and name C',residue_def+' and name CA',residue_def+' and name CB', psi)<br />
<br />
except:<br />
print "Exception Thrown"<br />
continue<br />
<br />
<br />
<br />
<br />
</source><br />
<br />
<br />
[[Category:Script_Library|CreateSecondaryStructure]]<br />
<br />
[[Category:Structural_Biology_Scripts|CreateSecondaryStructure]]</div>Jurgenfdhttps://pymolwiki.org/index.php?title=Category:FAQ&diff=4128Category:FAQ2007-08-01T17:01:55Z<p>Jurgenfd: /* Overview */</p>
<hr />
<div>==FAQ==<br />
<br />
===Overview===<br />
Please post your FAQs here. I suggest you write a Q&A style list with a short answer. More involved answers should link to its own page. Just my suggestion. Should we have topics? Please note, not all AQ are FAQ. Also, many answers to frequently recurring problems are probably best sought by searching for your terms in the Wiki.<br />
<br />
----------<br />
<br />
Q: Is there any way to export PyMol models onto CAD standards (autocad, archicad) or 3D modeling software (blender, 3DStudio, Maya)? Thanks a lot.<br />
<br />
<br />
----------<br />
<br />
Q: I am wondering how to change the default settings for a color "spectrum". I would like to color by b-factor but not with the default spectrum but from white-to-red.<br />
<br />
Alex<br />
<br />
<br />
---------<br />
<br />
<br />
Q: I was wondering what the percentage given under the mutengensis wizard means? Thanks...<br />
<br />
<br />
----<br />
Q: I've installed PyMol_0_98 correctly but I can't open my files in .mol2 or .pdb format from the menubar. Instead I can open them with the program. I can't even save the images I create in PyMol and obviously the mivie too.<br />
<br />
Could you help me to solve these problems.<br />
Thanks<br />
Vittorio<br />
<br />
A1: Vittorio, if I understand you correctly, then you need to (a) make sure you have the PDB file on your machine, say Desktop (or home directory, for *nix), then in the GUI click on, "File"->"Open" then use the dialog to find the file you want to load. You can save time if you know where the file is by just using PyMol's "load" command<br />
load fileName, objectName<br />
loads the fileName into a new object called objectName, for example,<br />
load /tmp/1ggz.pdb, 1ggz<br />
<br />
See [[Cmd load|load]], <br />
<br />
A2: To save images you have a couple options. First, to save a quick raw screen dump type, "png fileName" to save a PNG image (IE and other programs can view these files). Or, secondly, if you prefer a higher quality image with ray-traced shadows and textures you can do, "ray" then, the above "png" command.<br />
<br />
See [[Cmd ray|ray]], [[Cmd png|png]], [[:Category:Using_Pymol|Using PyMol]]<br />
<br />
Hope this helps. If it didn't please restate your question to make it more clear.<br />
----<br />
<br />
Q: I've installed PyMol_0_98, and recently my structures have stopped displaying. I've tried uninstalling PyMol_0_98 and installing PyMol_0_97, and yet i've ran into the same problem...my .pdb files no longer display, although it is evident that they are being loaded and I can edit them.<br />
<br />
Does anybody have any clue as to what might be the problem?<br />
Thanks, shebsmehr<br />
<br />
<br />
----<br />
Q: Hi I have a problem. For some reason PyMOl do not display certain areas (several loops) of my .pdb file (1DAN) when in cartoon. When I display the structure in "lines" or "sticks" everything is ok. Furthermore, other .pdb viewers dont have this problem. I have tried several things:<br />
1. Upgraded to the newest version og PyMol.<br />
2. Redefined secondary structure using the "alter command".<br />
3. Imported the .pdb file into SwissViewer, saved as the imported structure as a .pdb file, and then imported into PyMOl.<br />
<br />
None of these things have solved the problem. Help please! (I would hate to have to start using another pdb-viewer!!)<br />
Cheers<br />
Kasper<br />
<br />
----<br />
Q: I want to move one object while keeping another fixed. How do I do this?<br />
<br />
A: Load the proteins as separate objects, put the mouse into 3-button editing mode, then shift-middle click-and-drag on the molecule to translate and shift-left-click-and-drag to rotate. (Warren DeLano answer)<br />
<br />
----<br />
Q: I'd like to select residues that are in contact with a surface, or else be able to select buried/non-buried residues, is there any way to do this ? [[User:Xevi|Xevi]] 03:52, 16 Jun 2006 (CDT)<br />
<br />
<br />
----<br />
Q: I am doing some MD simulations using CHARMM (not AMBER) and would like to visualize the .dcd files output by CHARMM. I understand that PyMol can open .trj files from AMBER but is there a way to open up these .dcd files and if not, are there any plans to implement this? Thank you for your time!<br />
<br />
<br />
----<br />
Q: I would like the distance labels generated with the 'distance' command to be single-digit only, e.g. 2.8 instead of 2.77. How can I do this? Thanks, MindFrog<br />
<br />
A: Setting startup settings and python commands can be done in a file: ~/.pymolrc<br />
E.g. command in there: cmd.set('label_distance_digits',1)<br />
On my windows machine this is in C:\Documents and Settings\jurgen.WHELK.000\.pymolrc</div>Jurgenfdhttps://pymolwiki.org/index.php?title=All_states&diff=1700All states2006-09-14T21:26:00Z<p>Jurgenfd: /* Example */</p>
<hr />
<div>==Overview==<br />
<br />
When set "on", this setting causes PyMOL to display all states or in NMR jargon: all the models in the ensemble.<br />
The 'default' behavior (OFF) can be overridden by placing the "set all_states, on" statement into your '.pymolrc' file, located in your login directory (under all flavors of unix).<br />
<br />
==Syntax==<br />
<source lang="python"><br />
set all_states, on <br />
set all_states, off<br />
</source><br />
==Example==<br />
<source lang="python"><br />
import urllib2<br />
pdbCode = '1BRV'<br />
pdbUrl = 'http://www.rcsb.org/pdb/downloadFile.do?fileFormat=pdb&compression=NO&structureId='+pdbCode<br />
pdbFile = urllib2.urlopen(pdbUrl)<br />
pdbContent = pdbFile.read()<br />
cmd.read_pdbstr(pdbContent, pdbCode)<br />
<br />
set all_states, on<br />
</source></div>Jurgenfdhttps://pymolwiki.org/index.php?title=All_states&diff=1699All states2006-09-14T20:28:09Z<p>Jurgenfd: </p>
<hr />
<div>==Overview==<br />
<br />
When set "on", this setting causes PyMOL to display all states or in NMR jargon: all the models in the ensemble.<br />
The 'default' behavior (OFF) can be overridden by placing the "set all_states, on" statement into your '.pymolrc' file, located in your login directory (under all flavors of unix).<br />
<br />
==Syntax==<br />
<source lang="python"><br />
set all_states, on <br />
set all_states, off<br />
</source><br />
==Example==<br />
<source lang="python"><br />
load 1brv.pdb # Get it locally first by e.g. using the Plugin: "PDB Loader Service"<br />
set all_states, on<br />
</source></div>Jurgenfdhttps://pymolwiki.org/index.php?title=All_states&diff=1698All states2006-09-14T20:26:33Z<p>Jurgenfd: /* Example */</p>
<hr />
<div>==Overview==<br />
<br />
When set "on", this setting causes PyMOL to display all states or in NMR jargon: all the models in the ensemble.<br />
The 'default' behavior (OFF) can be overridden by placing the "set all_states, on" statement into your '.pymolrc' file, located in your login directory (under all flavors of unix).<br />
<br />
==Syntax==<br />
<br />
set all_states, on <br />
set all_states, off<br />
<br />
==Example==<br />
load 1brv.pdb # Get it locally first by e.g. using the Plugin: "PDB Loader Service"<br />
set all_states, on</div>Jurgenfdhttps://pymolwiki.org/index.php?title=All_states&diff=1697All states2006-09-14T20:05:12Z<p>Jurgenfd: </p>
<hr />
<div>==Overview==<br />
<br />
When set "on", this setting causes PyMOL to display all states or in NMR jargon: all the models in the ensemble.<br />
The 'default' behavior (OFF) can be overridden by placing the "set all_states, on" statement into your '.pymolrc' file, located in your login directory (under all flavors of unix).<br />
<br />
==Syntax==<br />
<br />
set all_states, on <br />
set all_states, off<br />
<br />
==Example==<br />
to be added: a read pdb model 1brv<br />
set all_states, on</div>Jurgenfdhttps://pymolwiki.org/index.php?title=Settings&diff=1701Settings2006-09-14T19:59:26Z<p>Jurgenfd: </p>
<hr />
<div>These are all the PyMol settings. If you feel like documenting them, and what they do, feel free. 42 done, 476 to go !<br />
<br />
active_selections ray_default_renderer <br />
[[all_states]] ray_direct_shade <br />
ambient ray_hint_camera <br />
angle_label_position ray_hint_shadow <br />
angle_size ray_improve_shadows <br />
animation ray_interior_color <br />
animation_duration ray_interior_mode <br />
[[antialias]] ray_interior_reflect <br />
async_builds ray_interior_shadows <br />
atom_name_wildcard ray_interior_texture <br />
auto_classify_atoms ray_legacy_lighting <br />
auto_color ray_max_passes <br />
auto_dss [[ray_opaque_background]] <br />
auto_hide_selections [[ray_orthoscopic]] <br />
auto_indicate_flags ray_oversample_cutoff <br />
auto_number_selections ray_pixel_scale <br />
auto_remove_hydrogens [[ray_shadow]] <br />
auto_sculpt ray_shadow_decay_factor <br />
auto_show_lines ray_shadow_decay_range <br />
auto_show_nonbonded ray_shadow_fudge <br />
auto_show_selections [[ray_shadows]] <br />
auto_show_spheres ray_texture <br />
[[auto_zoom]] ray_texture_settings <br />
[[backface_cull]] ray_trace_depth_factor <br />
batch_prefix ray_trace_disco_factor <br />
[[bg_rgb]] [[ray_trace_fog]] <br />
bonding_vdw_cutoff ray_trace_fog_start <br />
button_mode [[ray_trace_frames]] <br />
button_mode_name ray_trace_gain <br />
cache_display ray_trace_mode <br />
cache_frames ray_trace_slope_factor <br />
cache_memory ray_transparency_contrast <br />
[[cartoon_color]] ray_transparency_shadows <br />
[[Cartoon Helix Settings|cartoon_cylindrical_helices]] ray_transparency_spec_cut <br />
cartoon_debug ray_transparency_specular <br />
[[cartoon_discrete_colors]] ray_triangle_fudge <br />
cartoon_dumbbell_length reflect <br />
cartoon_dumbbell_radius reflect_power <br />
cartoon_dumbbell_width retain_order <br />
[[Cartoon Helix Settings|cartoon_fancy_helices]] ribbon_color <br />
[[cartoon_fancy_sheets]] ribbon_nucleic_acid_mode <br />
cartoon_flat_cycles ribbon_power <br />
cartoon_flat_sheets ribbon_power_b <br />
cartoon_helix_radius ribbon_radius <br />
[[cartoon_highlight_color]] [[ribbon_sampling]] <br />
cartoon_ladder_color ribbon_side_chain_helper <br />
cartoon_ladder_mode ribbon_smooth <br />
cartoon_ladder_radius ribbon_throw <br />
cartoon_loop_cap ribbon_trace_atoms <br />
cartoon_loop_quality [[ribbon_width]] <br />
cartoon_loop_radius robust_logs <br />
[[cartoon_nucleic_acid_color]] rock_delay <br />
[[cartoon_nucleic_acid_mode]] roving_byres <br />
cartoon_oval_length roving_cartoon <br />
cartoon_oval_quality roving_delay <br />
cartoon_oval_width roving_detail <br />
cartoon_power roving_isomesh <br />
cartoon_power_b roving_isosurface <br />
cartoon_putty_quality roving_labels <br />
cartoon_putty_radius roving_lines <br />
cartoon_putty_range roving_map1_level <br />
cartoon_putty_scale_max roving_map1_name <br />
cartoon_putty_scale_min roving_map2_level <br />
cartoon_putty_scale_power roving_map2_name <br />
cartoon_rect_length roving_map3_level <br />
cartoon_rect_width roving_map3_name <br />
cartoon_refine roving_nb_spheres <br />
cartoon_refine_normals roving_nonbonded <br />
cartoon_refine_tips roving_origin <br />
cartoon_ring_color roving_origin_z <br />
cartoon_ring_finder roving_origin_z_cushion <br />
[[cartoon_ring_mode]] roving_polar_contacts <br />
cartoon_ring_radius roving_polar_cutoff <br />
[[cartoon_ring_transparency]] roving_ribbon <br />
cartoon_ring_width roving_selection <br />
[[cartoon_round_helices]] roving_spheres <br />
[[cartoon_sampling]] roving_sticks <br />
cartoon_side_chain_helper scene_animation <br />
cartoon_smooth_cycles scene_animation_duration <br />
cartoon_smooth_first scene_current_name <br />
cartoon_smooth_last scene_loop <br />
[[cartoon_smooth_loops]] scene_restart_movie_delay <br />
cartoon_throw scenes_changed <br />
cartoon_trace_atoms sculpt_angl_weight <br />
[[cartoon_transparency]] sculpt_auto_center <br />
cartoon_tube_cap sculpt_avd_excl <br />
cartoon_tube_quality sculpt_avd_gap <br />
cartoon_tube_radius sculpt_avd_range <br />
cavity_cull sculpt_avd_weight <br />
cgo_dot_radius sculpt_bond_weight <br />
cgo_dot_width sculpt_field_mask <br />
cgo_line_radius sculpt_hb_overlap <br />
cgo_line_width sculpt_hb_overlap_base <br />
cgo_ray_width_scale sculpt_line_weight <br />
cgo_sphere_quality sculpt_max_max <br />
cgo_transparency sculpt_max_min <br />
clamp_colors sculpt_max_scale <br />
connect_bonded sculpt_max_weight <br />
connect_cutoff sculpt_memory <br />
connect_mode sculpt_min_max <br />
coulomb_cutoff sculpt_min_min <br />
coulomb_dielectric sculpt_min_scale <br />
coulomb_units_factor sculpt_min_weight <br />
cull_spheres sculpt_nb_interval <br />
[[Dash_Gap]] sculpt_plan_weight <br />
[[Dash_Length]] sculpt_pyra_weight <br />
[[Dash_Radius]] sculpt_tors_tolerance <br />
[[Dash_Round_Ends]] sculpt_tors_weight <br />
dash_width sculpt_tri_max <br />
debug_pick sculpt_tri_min <br />
defer_builds_mode sculpt_tri_mode <br />
defer_updates sculpt_tri_scale <br />
depth_cue sculpt_tri_weight <br />
dihedral_label_position sculpt_vdw_scale <br />
dihedral_size sculpt_vdw_scale14 <br />
direct sculpt_vdw_vis_max <br />
dist_counter sculpt_vdw_vis_mid <br />
distance_exclusion sculpt_vdw_vis_min <br />
dot_color sculpt_vdw_vis_mode <br />
dot_density sculpt_vdw_weight <br />
dot_hydrogens sculpt_vdw_weight14 <br />
dot_lighting sculpting <br />
dot_mode sculpting_cycles <br />
dot_normals secondary_structure <br />
dot_radius security <br />
dot_solvent sel_counter<br />
[[dot_width]] selection_overlay <br />
draw_frames selection_round_points <br />
editor_auto_dihedral selection_visible_only <br />
editor_auto_origin [[selection_width]] <br />
editor_label_fragments selection_width_max <br />
fast_idle selection_width_scale <br />
fetch_path [[seq_view]] <br />
[[Field_Of_View]] seq_view_alignment <br />
fit_iterations seq_view_color <br />
fit_tolerance seq_view_discrete_by_state <br />
float_labels seq_view_fill_char <br />
fog seq_view_fill_color <br />
fog_start seq_view_format <br />
frame seq_view_label_color <br />
full_screen seq_view_label_mode <br />
gamma seq_view_label_spacing <br />
gaussian_b_adjust seq_view_label_start <br />
gaussian_b_floor [[seq_view_location]] <br />
gaussian_resolution seq_view_overlay <br />
gl_ambient seq_view_unaligned_color <br />
h_bond_cone seq_view_unaligned_mode <br />
h_bond_cutoff_center session_file <br />
h_bond_cutoff_edge session_migration <br />
h_bond_exclusion session_version_check <br />
h_bond_max_angle shininess <br />
h_bond_power_a show_alpha_checker <br />
h_bond_power_b show_progress <br />
[[half_bonds]] simplify_display_lists <br />
hash_max single_image <br />
hide_underscore_names slice_dynamic_grid <br />
idle_delay slice_dynamic_grid_resolution<br />
ignore_case slice_grid <br />
ignore_pdb_segi slice_height_map <br />
image_dots_per_inch slice_height_scale <br />
internal_feedback slice_track_camera <br />
[[Internal Gui|internal_gui]] slow_idle <br />
internal_gui_control_size smooth_color_triangle <br />
internal_gui_mode solvent_radius <br />
internal_gui_width spec_count <br />
[[internal_prompt]] spec_direct <br />
isomesh_auto_state spec_direct_power <br />
[[label_color]] spec_power <br />
[[Label_font_id]] [[spec_reflect]] <br />
[[Label_outline_color]] specular <br />
label_position specular_intensity <br />
[[label_shadow_mode]] [[sphere_color]] <br />
[[label_size]] sphere_mode <br />
legacy_mouse_zoom sphere_point_max_size <br />
legacy_vdw_radii sphere_point_size <br />
light sphere_quality <br />
light2 [[sphere_scale]] <br />
light3 sphere_solvent <br />
light4 sphere_transparency <br />
light5 spheroid_fill <br />
light6 spheroid_scale <br />
light7 spheroid_smooth <br />
light8 ss_helix_phi_exclude <br />
light9 ss_helix_phi_include <br />
light_count ss_helix_phi_target <br />
line_radius ss_helix_psi_exclude <br />
[[line_smooth]] ss_helix_psi_include <br />
line_stick_helper ss_helix_psi_target <br />
line_width ss_strand_phi_exclude <br />
log_box_selections ss_strand_phi_include <br />
log_conformations ss_strand_phi_target <br />
logging ss_strand_psi_exclude <br />
matrix_mode ss_strand_psi_include <br />
max_threads ss_strand_psi_target <br />
max_triangles state <br />
mesh_color static_singletons <br />
mesh_lighting stereo <br />
mesh_mode stereo_angle <br />
mesh_normals stereo_double_pump_mono <br />
mesh_quality stereo_mode <br />
mesh_radius stereo_shift <br />
mesh_solvent stick_ball <br />
mesh_type stick_ball_ratio <br />
mesh_width stick_color <br />
min_mesh_spacing stick_fixed_radius <br />
mouse_limit [[stick_nub]] <br />
mouse_restart_movie_delay stick_overlap <br />
mouse_scale stick_quality <br />
mouse_selection_mode stick_radius <br />
movie_delay stick_transparency <br />
movie_loop stick_valence_scale <br />
multiplex stop_on_exceptions <br />
no_idle surface_best <br />
nonbonded_size surface_carve_cutoff <br />
normal_workaround surface_carve_selection <br />
normalize_ccp4_maps surface_carve_state <br />
normalize_grd_maps surface_circumscribe <br />
normalize_o_maps surface_clear_cutoff <br />
nvidia_bugs surface_clear_selection <br />
opaque_background surface_clear_state <br />
[[orthoscopic]] surface_color <br />
overlay surface_debug <br />
overlay_lines surface_miserable <br />
pdb_conect_all surface_mode <br />
pdb_discrete_chains surface_normal <br />
pdb_echo_tags surface_optimize_subsets <br />
pdb_hetatm_sort surface_poor <br />
pdb_honor_model_number surface_proximity <br />
pdb_insertions_go_first surface_quality <br />
pdb_insure_orthogonal surface_ramp_above_mode <br />
pdb_literal_names surface_solvent <br />
pdb_no_end_record surface_trim_cutoff <br />
pdb_reformat_names_mode surface_trim_factor <br />
pdb_retain_ids surface_type <br />
pdb_standard_order suspend_updates <br />
pdb_truncate_residue_name swap_dsn6_bytes <br />
pdb_unbond_cations sweep_angle <br />
pdb_use_ter_records sweep_mode <br />
[[pickable]] sweep_phase <br />
png_file_gamma sweep_speed <br />
png_screen_gamma test1 <br />
power test2 <br />
pqr_no_chain_id text <br />
presentation texture_fonts <br />
presentation_auto_quit [[transparency]] <br />
presentation_auto_start transparency_mode <br />
presentation_mode transparency_picking_mode <br />
preserve_chempy_ids triangle_max_passes <br />
pymol_space_max_blue trim_dots <br />
pymol_space_max_green [[two_sided_lighting]]<br />
pymol_space_max_red use_display_lists <br />
pymol_space_min_factor [[valence]] <br />
raise_exceptions valence_default <br />
rank_assisted_sorts valence_size <br />
ray_blend_blue validate_object_names <br />
ray_blend_colors virtual_trackball <br />
ray_blend_green wildcard <br />
ray_blend_red wizard_prompt_mode <br />
ray_color_ramps wrap_output <br />
<br />
[[Category:Settings|All Settings]]</div>Jurgenfd