X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=source%2Fpymol%2Fshow_UNRES.py;h=e922779ca98bc0f26c7ee0a302e9c50ce72c18e1;hb=34d3ad3987785642be58fb2f26557d3314215577;hp=a6097a43c8677363e2ee01472b1a33385adeff41;hpb=f690e8b70bab14132839afebf080d4a28363b226;p=unres.git diff --git a/source/pymol/show_UNRES.py b/source/pymol/show_UNRES.py index a6097a4..e922779 100644 --- a/source/pymol/show_UNRES.py +++ b/source/pymol/show_UNRES.py @@ -27,67 +27,84 @@ def show_UNRES(sl='(all)'): p_radius = 0.6 e_size = 1.0 # residue dictionary - # resn = [color_Red, color_Green, color_Blue, elipsoid_side_width ] - resdb = { 'CYS': [1.000, 1.000, 0.000, 2.96868], - 'MET': [0.000, 1.000, 0.000, 3.08863], - 'PHE': [0.000, 0.392, 0.000, 3.04238], - 'ILE': [0.000, 1.000, 0.000, 3.17389], - 'LEU': [0.000, 1.000, 0.000, 2.52078], - 'VAL': [0.000, 1.000, 0.000, 2.68924], - 'TRP': [0.000, 0.392, 0.000, 3.47403], - 'TYR': [0.596, 0.984, 0.596, 3.35434], - 'ALA': [0.000, 1.000, 0.000, 1.72686], - 'GLY': [1.000, 1.000, 1.000, 1.11383], - 'THR': [1.000, 0.000, 1.000, 2.59210], - 'SER': [1.000, 0.000, 1.000, 1.68800], - 'GLN': [1.000, 0.000, 1.000, 2.22201], - 'ASN': [1.000, 0.000, 1.000, 2.24946], - 'GLU': [1.000, 0.000, 0.000, 2.05551], - 'ASP': [1.000, 0.000, 0.000, 1.77556], - 'HIS': [1.000, 0.000, 1.000, 3.02627], - 'ARG': [0.000, 0.000, 1.000, 3.25143], - 'LYS': [0.000, 0.000, 1.000, 4.50054], - 'PRO': [0.000, 1.000, 1.000, 2.20525] + # resn = [color_Red, color_Green, color_Blue, ellipsoid_width, ellipsoid_length ] + resdb = { 'CYS': [1.000, 1.000, 0.000, 1.33741, 2.96868], + 'MET': [0.000, 1.000, 0.000, 1.36694, 3.08863], + 'PHE': [0.000, 0.392, 0.000, 1.48323, 3.04238], + 'ILE': [0.000, 1.000, 0.000, 1.44098, 3.17389], + 'LEU': [0.000, 1.000, 0.000, 1.51054, 2.52078], + 'VAL': [0.000, 1.000, 0.000, 1.42072, 2.68924], + 'TRP': [0.000, 0.392, 0.000, 1.23867, 3.47403], + 'TYR': [0.596, 0.984, 0.596, 1.23060, 3.35434], + 'ALA': [0.000, 1.000, 0.000, 1.23266, 1.72686], + 'GLY': [1.000, 1.000, 1.000, 1.24626, 1.11383], + 'THR': [1.000, 0.000, 1.000, 1.28674, 2.59210], + 'SER': [1.000, 0.000, 1.000, 1.22820, 1.68800], + 'GLN': [1.000, 0.000, 1.000, 1.24239, 2.22201], + 'ASN': [1.000, 0.000, 1.000, 1.24447, 2.24946], + 'GLU': [1.000, 0.000, 0.000, 1.25448, 2.05551], + 'ASP': [1.000, 0.000, 0.000, 1.25417, 1.77556], + 'HIS': [1.000, 0.000, 1.000, 1.21103, 3.02627], + 'ARG': [0.000, 0.000, 1.000, 1.13573, 3.25143], + 'LYS': [0.000, 0.000, 1.000, 1.22604, 4.50054], + 'PRO': [0.000, 1.000, 1.000, 1.35131, 2.20525] } # Get pseudo-peptide group positions atoms=cmd.get_model(sl+" & n. CA").atom p=[] - for i in range(0,len(atoms)-1): + for i in xrange(0,len(atoms)-1): p.append( [atoms[i].coord[0]+(atoms[i+1].coord[0]-atoms[i].coord[0])/2, atoms[i].coord[1]+(atoms[i+1].coord[1]-atoms[i].coord[1])/2, atoms[i].coord[2]+(atoms[i+1].coord[2]-atoms[i].coord[2])/2 ] ) obj=[] - for i in range(0,len(p)): + for i in xrange(0,len(p)): obj.extend( [ COLOR, 0.643, 0.933, 0.960 ] ) obj.extend( [ SPHERE, p[i][0], p[i][1], p[i][2], p_radius ] ) # Get Sidechain elipsoids positions atoms=cmd.get_model(sl+" & n. CB").atom e=[] - for i in range(0,len(atoms)): + for i in xrange(0,len(atoms)): ca=cmd.get_model(sl+" & n. CA & resn "+atoms[i].resn+" & resi "+atoms[i].resi).atom e.append( [ atoms[i].resn, atoms[i].coord[0], atoms[i].coord[1], atoms[i].coord[2], atoms[i].coord[0]-ca[0].coord[0], atoms[i].coord[1]-ca[0].coord[1], atoms[i].coord[2]-ca[0].coord[2] ] ) + obj.extend([NORMAL, 0.0, 1.0, 0.0]) # This is from pymol devel example cgo07.py form http://pymol.sourcearchive.com/documentation/1.2r1/cgo07_8py-source.html # # [ ELLIPSOID, x_pos, y_pos, z_pos, size, x0, y0, z0, x1, y1, z2, x2, y2, z2 ] # where the xyz vectors are orthogonal and of length 1.0 or less. - for i in range(0,len(e)): + for i in xrange(0,len(e)): # vactor CB->CA tmp0=[e[i][4], e[i][5], e[i][6]] - l=cpv.length(tmp0) + #l=cpv.length(tmp0) # random vector tmp1 = cpv.random_vector() # orthogonal vector to tmp0 and tmp1 tmp2 = cpv.cross_product(tmp1, tmp0) tmp3 = cpv.cross_product(tmp0, tmp2) + tmp0 = cpv.normalize(tmp0) tmp2 = cpv.normalize(tmp2) tmp3 = cpv.normalize(tmp3) - tmp2 = cpv.scale(tmp2,0.9*resdb[e[i][0]][3]) - tmp3 = cpv.scale(tmp3,0.9*resdb[e[i][0]][3]) - + tmp0 = cpv.scale(tmp0,resdb[e[i][0]][4]) + tmp2 = cpv.scale(tmp2,resdb[e[i][0]][3]) + tmp3 = cpv.scale(tmp3,resdb[e[i][0]][3]) + factor = 1.0 / max( cpv.length(tmp0), cpv.length(tmp2), cpv.length(tmp3)) + tmp0 = cpv.scale(tmp0, factor) + tmp2 = cpv.scale(tmp2, factor) + tmp3 = cpv.scale(tmp3, factor) obj.extend( [ COLOR, resdb[e[i][0]][0], resdb[e[i][0]][1], resdb[e[i][0]][2] ] ) - obj.extend( [ ELLIPSOID, e[i][1], e[i][2], e[i][3], e_size, ] + tmp0 + tmp2 + tmp3 ) + obj.extend( [ ELLIPSOID, e[i][1], e[i][2], e[i][3], 1.0/factor, ] + tmp0 + tmp2 + tmp3 ) + + # Get Glicynes positions + atoms=cmd.get_model(sl+' & n. CA & resn GLY').atom + g=[] + for i in xrange(0,len(atoms)): + g.append( [ atoms[i].resn, atoms[i].coord[0], atoms[i].coord[1], atoms[i].coord[2] ]) + # Draw the glicyne spheres + for i in xrange(0, len(g)): + obj.extend( [ COLOR, resdb[g[i][0]][0], resdb[g[i][0]][1], resdb[g[i][0]][2] ] ) + obj.extend( [ SPHERE, g[i][1], g[i][2], g[i][3], resdb[g[i][0]][3]]) + cmd.set('cgo_ellipsoid_quality', 2) cmd.load_cgo(obj,'UNRES_'+sl)