Exemple #1
0
def create_hbonds( lines, name ):

	model = cmd.get_model(name)

	# Ron Jacak's cool monster regex, borrowed from the Rosetta Pymol Plugin
	hb_re = re.compile("(?:PROT|BASE) \s*[A-Z]+ \s*\d+ \s*(\d+) ([ A-Z]) \s*([A-Z0-9]+) \s*[A-Z]+ \s*\d+ \s*(\d+) ([ A-Z]) \s*([A-Z0-9]+)\s* (-?[\d\.]*)")
	hbonds = []
	for line in lines:
		match = hb_re.search(line)
		if match == None: continue
		(d_resi, d_chain, d_atom, a_resi, a_chain, a_atom, energy) = match.groups()
		energy = float(energy)

		if energy < -0.05: # ingores very weak "hydrogen bonds"

			d_addr = '/%s//%s/%s/%s' % ( name, d_chain, d_resi, d_atom )
			a_addr = '/%s//%s/%s/%s' % ( name, a_chain, a_resi, a_atom )

			d_atm = model.atom[ cmd.index(d_addr)[0][1] - 1 ]
			a_atm = model.atom[ cmd.index(a_addr)[0][1] - 1 ]

			if energy <= -0.9: colorscale = 1.0
			else: colorscale = -1 * energy + 0.1 # ratio to strong, with offset
			hbonds.extend( hbond( d_atm, a_atm, colorscale, colorscale, 0.0 ) )
	cmd.load_cgo( hbonds, 'hb_%s' % name )
def draw_axis(x=None, y=None, z=None, i=None, j=None, k=None, length=20.0, r=1.0, g=1.0, b=1.0, width=1.0 ):
   if x == None or y == None or z == None or i == None or j == None or k== None :
       print 'Usage: draw_axis x,y,z, i,k,j, length, r,g,b, width'
       print 'draw a line centered at (x,y,z) with the direction vector (i,j,k)'
       print 'length, color (r,g,b), and width arguments are optional'
#        print 'For a fun example of the command, run draw_axis_example'
   else :
       x,y,z = float(x), float(y), float(z)
       i,j,k = float(i), float(j), float(k)
       r,g,b = float(r), float(g), float(b)
       width = float(width)
       length = float(length) / 2.0
 
       x1,y1,z1 = (x+i*length,y+j*length,z+k*length)
       x2,y2,z2 = (x-i*length,y-j*length,z-k*length)
 
       obj = [
           LINEWIDTH, width,
           BEGIN, LINES,
 
           COLOR,   r,  g,  b,
           VERTEX, x1, y1, z1,
           VERTEX, x2, y2, z2,
 
           END
           ]
 
       cmd.load_cgo(obj,'axis'+str(counter.state))
       counter.state += 1
def show_points(points, color = [1.0, 0.0, 0.0], selection='all', name = 'samples', labels=[]):
    view = cmd.get_view(quiet=not DEBUG)

    # adjust radius to size of bounding box
    bb = cmd.get_extent(selection, quiet=not DEBUG)
    ll = vec3(bb[0])
    tr = vec3(bb[1])
    diag = tr - ll
    r = diag.length() / 2.0

    # origin of rotation in model space
    #o = vec3(view[12:15])
    c = com.COM(selection)
    o = vec3(c)
    #spheres = [BEGIN, TRIANGLE_STRIP]
    spheres = [COLOR]
    spheres.extend(color)
    i = 0.0
    j = 0
    for p in points:
        
        #spheres.extend([COLOR, 1.0, 1 - scaled_value, 1 - scaled_value])
        spheres.extend([SPHERE, o[0]+r*p[0], o[1]+r*p[1], o[2]+r*p[2], 1.25])
        #drawVector(o, o + r * vec3(p))
        #spheres.extend([VERTEX, o[0]+r*p[0], o[1]+r*p[1], o[2]+r*p[2]])
        #i += 1.0/len(values)
        l = 1.1
        if (len(labels) > j):
            cmd.pseudoatom(labels[j] + "_label", pos = [o[0]+l * r*p[0], o[1]+l*r*p[1], o[2]+l*r*p[2], 1.25], label = labels[j])    

        j += 1

    #spheres.extend([END])
    cmd.load_cgo(spheres, name, 1)
Exemple #4
0
def showcom(sel="all"):
    global numcom
    c = com(sel)
    print "Center of mass: ", c
    cgo = [pymol.cgo.COLOR, 1.0, 1.0, 1.0, SPHERE, c.x, c.y, c.z, 1.0]  ## white sphere with 3A radius
    cmd.load_cgo(cgo, "com%i" % numcom)
    numcom += 1
Exemple #5
0
def cartoonize(color, rep):
    """draw a cartoon representation of glycans"""
    stored.ResiduesNumber = []
    cmd.iterate('name c1', 'stored.ResiduesNumber.append((resi))')
    resn_list = [int(i) for i in stored.ResiduesNumber]
    bonds = get_glyco_bonds(resn_list[0], resn_list[-1]+1)
    con_matrix = writer(bonds)
    #con_matrix = writer2(bonds)
    rings = find_rings(resn_list)
    rings_coords = get_ring_coords(resn_list, rings)
    bonds_coords = get_bonds_coords(resn_list, con_matrix)
    colors = get_colors_c1(resn_list, color)
    bonds_colors = get_bonds_colors(resn_list, con_matrix, color)
    cmd.set('suspend_updates', 'on')
    for state, coords in enumerate(rings_coords):
        obj = []
        if rep == 'beads':
            radius_s = 1.8
            radius_b = 0.18
            obj = beads(obj, coords, colors[state], radius_s)
            obj = cylinder(obj, bonds_coords[state], bonds_colors[state], radius_b)
        else:
            if rep == 'cartoon':
                radius = 0.075
            else: 
                radius = 0.035
            obj = hexagon(obj, coords, colors[state], rep, radius)
            obj = cylinder(obj, bonds_coords[state], bonds_colors[state], radius)
        cmd.load_cgo(obj,'cgo01', state+1)

    cmd.select('glycan', 'byres name C1')
    cmd.delete('glycan')
    cmd.delete('tmp')
    cmd.set('two_sided_lighting', 1)
    cmd.set('suspend_updates', 'off')
Exemple #6
0
def axes(name='axes'):
    '''
DESCRIPTION

    Puts coordinate axes to the lower left corner of the viewport.
    '''
    from pymol import cgo

    auto_zoom = cmd.get('auto_zoom')
    cmd.set('auto_zoom', 0)

    w = 0.06 # cylinder width
    l = 0.75 # cylinder length
    h = 0.25 # cone hight
    d = w * 1.618 # cone base diameter

    obj = [cgo.CYLINDER, 0.0, 0.0, 0.0,   l, 0.0, 0.0, w, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0,
           cgo.CYLINDER, 0.0, 0.0, 0.0, 0.0,   l, 0.0, w, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0,
           cgo.CYLINDER, 0.0, 0.0, 0.0, 0.0, 0.0,   l, w, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0,
           cgo.CONE,   l, 0.0, 0.0, h+l, 0.0, 0.0, d, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0,
           cgo.CONE, 0.0,   l, 0.0, 0.0, h+l, 0.0, d, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0,
           cgo.CONE, 0.0, 0.0,   l, 0.0, 0.0, h+l, d, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0]

    PutCenterCallback(name, 1).load()
    cmd.load_cgo(obj, name)

    cmd.set('auto_zoom',auto_zoom)
Exemple #7
0
	def showLine(self, msi0, msi1, name='conn') :
		from pymol import cmd
		from pymol.cgo import BEGIN, END, LINES, VERTEX, COLOR, CYLINDER, SPHERE
		mean0, mean1, mid = [0.,0.,0.], [0., 0., 0.], [0.,0.,0.,]
		for si in self.master2slave[msi0] :
			mean0[0] = mean0[0] + self.sites[si][0]
			mean0[1] = mean0[1] + self.sites[si][1]
			mean0[2] = mean0[2] + self.sites[si][2]
		mean0[0] = mean0[0] / len(self.master2slave[msi0])
		mean0[1] = mean0[1] / len(self.master2slave[msi0])
		mean0[2] = mean0[2] / len(self.master2slave[msi0])
		for si in self.master2slave[msi1] :
			mean1[0] = mean1[0] + self.sites[si][0]
			mean1[1] = mean1[1] + self.sites[si][1]
			mean1[2] = mean1[2] + self.sites[si][2]
		mean1[0] = mean1[0] / len(self.master2slave[msi1])
		mean1[1] = mean1[1] / len(self.master2slave[msi1])
		mean1[2] = mean1[2] / len(self.master2slave[msi1])
		mid[0] = (mean0[0] + mean1[0]) / 2.
		mid[1] = (mean0[1] + mean1[1]) / 2.
		mid[2] = (mean0[2] + mean1[2]) / 2.
		clr0, clr1 = self.chem2clr[self.mschems[msi0]], self.chem2clr[self.mschems[msi1]]
		lobj = [CYLINDER, ] + list(mean0) + list(mean1) + [self.conwidth,] + list(clr0) + list(clr1)
		lobj = lobj + [COLOR,] + list(clr0) + [SPHERE,] + list(mean0) + [2*self.conwidth,] + [COLOR,] + list(clr1) + [SPHERE,] + list(mean1) + [2*self.conwidth,]
		print lobj
		#lobj = [BEGIN, LINES, COLOR,] + list(clr0) + [VERTEX,] + list(mean0) + [VERTEX,] + list(mid) + [COLOR,] + list(clr1) + [VERTEX,] + list(mid) + [VERTEX,] + list(mean1) + [END,]
		cmd.load_cgo(lobj, name)
    def plot(self, coords, freqs, min, max, min_r, max_r, col_min, col_max, out_obj):
        
        widths = []
        cgo = []
        nsteps = 200
        gradient = []
        cols = []

        #gradient = self.make_gradient("sbcol", array(cmd.get_color_tuple(self.interpret_color(col_min))), array(cmd.get_color_tuple(self.interpret_color(col_max))), nsteps )
        gradient = self.make_gradient("sbcol", array(col_min), array(col_max), nsteps )
        
        for i,freq in enumerate(freqs):
            if freq < min:
                freqs[i] = min
            elif freq > max: 
                freqs[i] = max
            widths.append( (freqs[i] - min)*((max_r - min_r) / (max - min)) + min_r )
            cols.append(gradient[int(round(freqs[i]/max*(nsteps-1)))])

        for i in range(0, len(coords), 2):
            cgo.append(CYLINDER)
            cgo.extend(coords[i])
            cgo.extend(coords[i+1])
            cgo.append(widths[i/2])
            cgo.extend(cmd.get_color_tuple(self.interpret_color(cols[i/2])))
            cgo.extend(cmd.get_color_tuple(self.interpret_color(cols[i/2])))

        
            
        cmd.load_cgo(cgo,out_obj)
Exemple #9
0
def rpcSpheres(sphereD, id='cgo', extend=1):
  """ create a sphere
 
    Arguments:
      sphereD: a series of (pos,rad,color,transparent,transparency) tuples
      id: (OPTIONAL) the name of the object to be created
      extend: (OPTIONAL) if this is nonzero, the object will be cleared
        before adding the new sphere.  Otherwise the sphere is appended
        to the ojbect
  """
  if extend:
    obj = cgoDict.get(id, [])
  else:
    obj = []
  for pos, rad, color, transparent, transparency in sphereD:
    r, g, b = color
    x, y, z = pos
    if not transparent:
      o = []
    else:
      o = [cgo.ALPHA, 1 - transparency]
    o.extend([cgo.COLOR, r, g, b, cgo.SPHERE, x, y, z, rad])
    obj.extend(o)
  cgoDict[id] = obj
  cmd.load_cgo(obj, id, 1)
  return 1
Exemple #10
0
def rpcSphere(pos, rad, color, id='cgo', extend=1, transparent=0, transparency=0.5):
  """ create a sphere
 
    Arguments:
      pos: a 3 tuple with the position of the sphere
      rad: a float with the radius
      color: a 3 tuple with the color of the sphere. (1,1,1) is white
      id: (OPTIONAL) the name of the object to be created
      extend: (OPTIONAL) if this is nonzero, the object will be cleared
        before adding the new sphere.  Otherwise the sphere is appended
        to the ojbect
      transparent: (OPTIONAL) sets the object to be transparent
      transparency: (OPTIONAL) the percent transparency of the object
  """
  r, g, b = color
  x, y, z = pos
  if extend:
    obj = cgoDict.get(id, [])
  else:
    obj = []
  if not transparent:
    o = []
  else:
    o = [cgo.ALPHA, 1 - transparency]
  o.extend([cgo.COLOR, r, g, b, cgo.SPHERE, x, y, z, rad])
  obj.extend(o)
  cgoDict[id] = obj
  cmd.load_cgo(obj, id, 1)
  return 1
Exemple #11
0
def draw_spheres(coords, model, frame, radius=0.5):
    spheres = []
    for x in coords.reshape(coords.size / 3, 3):
        spheres.extend([cgo.COLOR, 1.0, 0.0, 0.0])
        spheres.extend([cgo.SPHERE, x[0], x[1], x[2], radius])

    cmd.load_cgo(spheres, model, frame)
Exemple #12
0
def load_cmap():
   file_cmap= open_it()

   m=cmd.get_model('all')
   trans={}
   for ii in range(len(m.atom)):
      trans[m.atom[ii].id]=ii


   ElasticNet = [ BEGIN, LINES, COLOR, 1.0, 0.4, 0.0 ]

   for line in open(file_cmap,'r'):
      contact=map(float,line.split())

      aa=trans[contact[0]]
      bb=trans[contact[1]]

      ElasticNet.append(VERTEX)
      ElasticNet.append(m.atom[aa].coord[0])
      ElasticNet.append(m.atom[aa].coord[1])
      ElasticNet.append(m.atom[aa].coord[2])
      ElasticNet.append(VERTEX)
      ElasticNet.append(m.atom[bb].coord[0])
      ElasticNet.append(m.atom[bb].coord[1])
      ElasticNet.append(m.atom[bb].coord[2])



   ElasticNet.append(END)

   cmd.load_cgo(ElasticNet,'ElasticNet')
Exemple #13
0
def plot_axis(center_obj=None, length=20, radius=0.1):
	# create the axes object, draw axes with cylinders coloured red, green,
	#blue for X, Y and Z
	com = (0.0, 0.0, 0.0)
	if center_obj:
	 	com = center_of_mass.get_com(center_obj)
	u_vec = com/np.linalg.norm(com)

	print 'Origin ', com
	print 'Unit vector ', u_vec

	obj = [
	   CYLINDER, com[0] - length, com[1], com[2], com[0] + length, com[1], com[2], radius, 1, 0, 0, 1, 0, 0,
	   CYLINDER, com[0], com[1] - length, com[2], com[0], com[1] + length, com[2], radius, 0, 1, 0, 0, 1, 0, 
	   CYLINDER, com[0], com[1], com[2]  - length, com[0], com[1], com[2] + length, radius,0, 0, 1, 0, 0, 1,
	   ]
	 
	# add labels to axes object (requires pymol version 0.8 or greater, I
	# believe
	 
	cyl_text(obj,plain,[com[0] - length, com[1], com[2]],'X',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
	cyl_text(obj,plain,[com[0], com[1] - length, com[2]],'Y',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
	cyl_text(obj,plain,[com[0], com[1], com[2]  - length],'Z',0.20,axes=[[3,0,0],[0,3,0],[0,0,3]])
	 
	# then we load it into PyMOL
	if center_obj:
		cmd.load_cgo(obj, center_obj + '_axes')
	else:
		cmd.load_cgo(obj,  'axes')
Exemple #14
0
def ellipsoid(name,x,y,z, rx,ry,rz,segs=40,color="red",transformation=None,_self=cmd):
        """Create an ellipsoid

        Arguments
        =========
        x,y,z:          center coordinates
        rx,ry,rz:       length of axes
        n:              north-south exponent
        e:              east-west exponent
        u1,u2:          start and end angles in the east-west direction
        v1,v2:          start and end angles in the north-south direction
        u_segs:         Number of segments in the east-west direction
        v_segs:         Number of segments in the north-south direction
        color:          Either one (solid color) or six (-x,-y,-z,+x,+y,+z)
                        colors. Colors may be either a space-separated list of
                        pymol color names, or a list of tuples with RGB color
                        for the ellipsoid (0-1.0).
        transformation: a 16-element list giving the 4x4 transformation matrix,
                        in row-major order, as described in get_object_matrix()
                        {default: identity matrix}

        """
        cgo = makeSuperQuadricEllipsoid(x, y, z, rx,ry,rz, 1.0, 1.0,
                        u_segs=int(segs)/2,v_segs=segs,color=color,transformation=transformation)
        cmd.load_cgo(cgo,name)
def visualize_orientation(direction, center=[0, 0, 0], scale=1.0, symmetric=False, color="green", color2="red"):
    """
    Draw an arrow. Helper function for "helix_orientation" etc.
    """
    from pymol import cgo

    color_list = cmd.get_color_tuple(color)
    color2_list = cmd.get_color_tuple(color2)
    if symmetric:
        scale *= 0.5
    end = cpv.add(center, cpv.scale(direction, scale))
    radius = 0.3
    obj = [cgo.SAUSAGE]
    obj.extend(center)
    obj.extend(end)
    obj.extend([radius, 0.8, 0.8, 0.8])
    obj.extend(color_list)
    if symmetric:
        start = cpv.sub(center, cpv.scale(direction, scale))
        obj.append(cgo.SAUSAGE)
        obj.extend(center)
        obj.extend(start)
        obj.extend([radius, 0.8, 0.8, 0.8])
        obj.extend(color2_list)
    coneend = cpv.add(end, cpv.scale(direction, 4.0 * radius))
    if cmd.get_version()[1] >= 1.2:
        obj.append(cgo.CONE)
        obj.extend(end)
        obj.extend(coneend)
        obj.extend([radius * 1.75, 0.0])
        obj.extend(color_list * 2)
        obj.extend([1.0, 1.0])  # Caps
    cmd.load_cgo(obj, get_unused_name("oriVec"), zoom=0)
Exemple #16
0
def veccgofrompoint(a, c, lbl):
    cmd.load_cgo(
        [
            COLOR,
            1.0,
            1.0,
            1.0,
            SPHERE,
            c.x,
            c.y,
            c.z,
            0.2,
            CYLINDER,
            c.x,
            c.y,
            c.z,
            c.x + a.x,
            c.y + a.y,
            c.z + a.z,
            0.1,
            1,
            1,
            1,
            1,
            1,
            1,
        ],
        lbl,
    )
Exemple #17
0
	def showSurf(self,name,msis) :
		from pymol import cmd
		assert len(self.chem2clr.items()) > 0
		totarea, msobj, FIs, faceclr, lineclr = 0., [], [], [], []
		for msi0 in self.msadj.keys() :
			if re.compile('HOH').search(self.msnames[msi0]) : continue ## no waters
			if len(msis) > 0 and msi0 not in msis : continue
			for msi1 in self.msadj[msi0].keys() :
				#if len(msis) > 0 and msi1 not in msis : continue
				#if msi1 >= msi0 : continue
				#print self.msadj[msi0][msi1]
				for fi in self.msadj[msi0][msi1] :
					if fi in FIs : FIs.remove(fi)
					else : FIs.append(fi)
		for msi0 in self.msadj.keys() :
			if len(msis) > 0 and msi0 not in msis : continue
			if re.compile('HOH').search(self.msnames[msi0]) : continue ## no waters
			for msi1 in self.msadj[msi0].keys() :
				#if msi1 >= msi0 : continue
				#if len(msis) > 0 and msi1 not in msis : continue
				for fi in self.msadj[msi0][msi1] :
					if fi in FIs :
						totarea = totarea + self.areas[fi]
						faceclr, lineclr = self.chem2clr[self.mschems[msi0]], self.chem2clr[self.mschems[msi1]] ## own clr for surface
						msobj = msobj + self.makeFacePymolObj(self.vcen, self.faces[fi], faceclr, lineclr)
		cmd.load_cgo(msobj, name)
		return totarea
Exemple #18
0
def load_msms_surface(filename, name="", _colors=None):
    """
DESCRIPTION

    Load MSMS .vert and .face files as a CGO
    """
    from pymol import cgo
    from pymol.cgo import NORMAL, VERTEX, COLOR

    if _colors:
        _colors = [cmd.get_color_tuple(c) for c in _colors]

    if filename.endswith(".vert") or filename.endswith(".face"):
        filename = filename[:-5]

    # vertex file
    line_iter = iter(open(filename + ".vert"))

    # skip header
    for line in line_iter:
        if not line.startswith("#"):
            break

    # read vertices
    vertices = [None]  # make 1-indexable
    for line in line_iter:
        data = line.split()
        vertex = [float(x) for x in data[0:3]]
        normal = [float(x) for x in data[3:6]]
        sphere = int(data[7]) - 1
        vertices.append((vertex, normal, sphere))

    # faces file
    line_iter = iter(open(filename + ".face"))

    # skip header
    for line in line_iter:
        if not line.startswith("#"):
            break

    cgobuf = [cgo.BEGIN, cgo.TRIANGLES]

    # read triangles
    for line in line_iter:
        for index in line.split()[:3]:
            data = vertices[int(index)]
            if _colors:
                cgobuf.append(COLOR)
                cgobuf.extend(_colors[data[2]])
            cgobuf.append(NORMAL)
            cgobuf.extend(data[1])
            cgobuf.append(VERTEX)
            cgobuf.extend(data[0])

    cgobuf.append(cgo.END)

    if not name:
        name = cmd.get_unused_name("msmssurf")

    cmd.load_cgo(cgobuf, name)
Exemple #19
0
def plane_orientation(selection, state=-1, visualize=1, quiet=1):
    '''
DESCRIPTION

    Fit plane (for example beta-sheet). Can also be used with
    angle_between_helices (even though this does not fit helices).

    Returns center and normal vector of plane.
    '''
    try:
        import numpy
    except ImportError:
        print ' Error: numpy not available'
        raise CmdException

    state, visualize, quiet = int(state), int(visualize), int(quiet)

    coords = list()
    cmd.iterate_state(state, '(%s) and guide' % (selection),
            'coords.append([x,y,z])', space=locals())

    if len(coords) < 3:
        print 'not enough guide atoms in selection'
        raise CmdException

    x = numpy.array(coords)
    U,s,Vh = numpy.linalg.svd(x - x.mean(0))

    # normal vector of plane is 3rd principle component
    vec = cpv.normalize(Vh[2])
    if cpv.dot_product(vec, x[-1] - x[0]) < 0:
        vec = cpv.negate(vec)

    center = x.mean(0).tolist()
    _common_orientation(selection, center, vec, visualize, 4.0, quiet)

    # plane visualize
    if visualize:
        from pymol import cgo

        dir1 = cpv.normalize(Vh[0])
        dir2 = cpv.normalize(Vh[1])
        sx = [max(i/4.0, 2.0) for i in s]

        obj = [ cgo.BEGIN, cgo.TRIANGLES, cgo.COLOR, 0.5, 0.5, 0.5 ]
        for vertex in [
                cpv.scale(dir1, sx[0]),
                cpv.scale(dir2, sx[1]),
                cpv.scale(dir2, -sx[1]),
                cpv.scale(dir1, -sx[0]),
                cpv.scale(dir2, -sx[1]),
                cpv.scale(dir2, sx[1]),
                ]:
            obj.append(cgo.VERTEX)
            obj.extend(cpv.add(center, vertex))
        obj.append(cgo.END)
        cmd.load_cgo(obj, cmd.get_unused_name('planeFit'))

    return center, vec
Exemple #20
0
def plot3d(ary):
	assert ary.shape[1]==3
	cmd.delete("plot")
	print "plotting",ary.shape[0],"points"
	obj = list()
	obj.extend( [ cgo.BEGIN, cgo.POINTS , cgo.COLOR, 1.0, 1.0, 1.0 ] )
	for i in xrange(ary.shape[0]):
		obj.extend([cgo.VERTEX, ary[i,0], ary[i,1], ary[i,2] ])
	cmd.load_cgo(obj, "plot")
Exemple #21
0
def selbycomp(trn=0):
	cmd.select("TRI1","TRI and chain A+B+C")
	cmd.select("TRI2","TRI and chain D+E+F")
	cmd.select("TRI3","TRI and chain G+H+I")
	cmd.select("TRI4","TRI and chain J+K+L")
	cmd.select("TRI5","TRI and chain M+N+O")
	cmd.select("TRI6","TRI and chain P+Q+R")
	cmd.select("TRI7","TRI and chain S+T+U")
	cmd.select("TRI8","TRI and chain V+W+X")
	cmd.select("DIM1","DIM and chain A+D")
	cmd.select("DIM2","DIM and chain B+G")
	cmd.select("DIM3","DIM and chain C+J")
	cmd.select("DIM4","DIM and chain E+U")
	cmd.select("DIM5","DIM and chain F+R")
	cmd.select("DIM6","DIM and chain H+T")
	cmd.select("DIM7","DIM and chain I+O")
	cmd.select("DIM8","DIM and chain K+Q")
	cmd.select("DIM9","DIM and chain L+N")
	cmd.select("DIM10","DIM and chain M+V")
	cmd.select("DIM11","DIM and chain P+W")
	cmd.select("DIM12","DIM and chain X+S")
	cmd.delete("LINE*")
	cmd.delete("serf*")

	cmd.do("""alter all, b=50
	alter all, q=1
	set gaussian_resolution,8""")
	ISO="""map_new map%s, gaussian, 2, %s, 10
	isosurface surf%s, map%s"""


	for i in range(1, 9): 
		cmd.do(ISO%(("TRI%i"%i,)*4))
		cmd.color(COLORS[i-1],"surfTRI%i"%i)
		c = com("TRI%i"%i)
		# trans("TRI%i"%i,trn*c.normalized())
		obj = [
			CYLINDER, 
		   	0.0, 0.0, 0.0,
		   	1.6*c.x, 1.6*c.y, 1.6*c.z,
			1.5,
			0.1,0.1,0.1,0.1,0.1,0.1,
		]                                                                                            
		cmd.load_cgo(obj,'LINETRI%i'%i)
	for i in range(1,13): 
		cmd.do(ISO%(("DIM%i"%i,)*4))
		cmd.color(COLORS[i+7],"surfDIM%i"%i)
		c = com("DIM%i"%i)
		# trans("DIM%i"%i,trn*com("DIM%i"%i).normalized())
		obj = [
			CYLINDER, 
		   	0.0, 0.0, 0.0,
		   	1.3*c.x, 1.3*c.y, 1.3*c.z,
			1.0,
			0,0,1,0,0,1
		]                                                                                            
		cmd.load_cgo(obj,'LINEDIM%i'%i)
Exemple #22
0
def showCycles() :
	resnames1, resnames2, intnames = [],[],[]
	for i in range(pyncData.resSel1.size()) : resnames1.append(pyncData.resSel1.get(i))
	for i in range(pyncData.resSel2.size()) : resnames2.append(pyncData.resSel2.get(i))
	for i in pyncData.intlist.curselection() : intnames.append(pyncData.intlist.get(i))
	res, pos, edges = [], [], []
	curfile = pyncData.curfile.get()
	for int in pyncData.files[curfile][0] :
		if not int.res1 in resnames1 : continue
		if not int.res2 in resnames2 : continue
		if len(intnames) > 0 and not int.name in intnames : continue
		if not int.res1 in res :
			res.append(int.res1)
			pos.append(list(int.p1))
		if not int.res2 in res :
			res.append(int.res2)
			pos.append(list(int.p2))
		edges.append((res.index(int.res1), res.index(int.res2)))
	if posRepeat(pos, res) : assert(0)
	fn = mktemp()[1]
	print fn
	f = open(fn, 'w')
	f.write("%d\n" % len(res))
	f.write("%d\n" % len(edges))
	for i in range(len(edges)) : f.write("%d %d\n" % edges[i])
	f.close()
	c = popen2.Popen3("/tmp/horton %s" % fn)
	edgeCycleBase = []
	for l in c.fromchild.readlines() :
		if not re.compile('Edges in cycle:').search(l) : continue
		cycle = []
		flds = string.split( re.sub('Edges in cycle:', '', l) )
		for fl in flds : cycle.append(string.atoi(fl))
		edgeCycleBase.append(cycle)
	if len(edgeCycleBase) == 0 :
		print "No cycles found !!"
		return
	edgeCycles = getAllCycles(edgeCycleBase, edges)
	from pymol import cmd
	from pymol.cgo import BEGIN,LINES,END,VERTEX,COLOR
	objname = pyncData.objname.get()
	if not objname or objname == '' : objname = 'cycles'
	for c in edgeCycleBase :
		obj = [BEGIN,LINES]
		for ce in c :
			obj = obj + [VERTEX,] + list(pos[edges[ce][0]]) + [VERTEX,] + list(pos[edges[ce][1]])
		obj = obj + [END]
		cmd.load_cgo(obj, objname)
	objname = pyncData.objname.get()
	if not objname or objname == '' : objname = 'cycles'
	objname = "all_" + objname
	for c in edgeCycles :
		obj = [BEGIN,LINES]
		for ce in c :
			obj = obj + [VERTEX,] + list(pos[edges[ce][0]]) + [VERTEX,] + list(pos[edges[ce][1]])
		obj = obj + [END]
		cmd.load_cgo(obj, objname)
Exemple #23
0
def rpcCylinder(end1, end2, rad, color1, id='cgo', color2=None, extend=1, transparent=0,
                transparency=0.5):
  """ create a cylinder
 
    Arguments:
      end1: a 3 tuple with the position of end1 of the sphere
      end2: a 3 tuple with the position of end1 of the sphere
      rad: a float with the radius
      color1: a 3 tuple with the color of end1 of the sphere. (1,1,1) is white
      id: (OPTIONAL) the name of the object to be created
      color2: (OPTIONAL) a 3 tuple with the color of end2 of the sphere. (1,1,1) 
is white
      extend: (OPTIONAL) if this is nonzero, the object will be cleared
        before adding the new sphere.  Otherwise the sphere is appended
        to the ojbect
      transparent: (OPTIONAL) sets the object to be transparent
      transparency: (OPTIONAL) the percent transparency of the object
 
    NOTE: the reason that color2 follows id is that I think clients are
    going to be interested in setting the id more often than they are going
    to care about the second color.
 
  """
  global cgoDict

  if color2 is None:
    color2 = color1
  r1, g1, b1 = color1
  r2, g2, b2 = color2
  x1, y1, z1 = end1
  x2, y2, z2 = end2
  if extend:
    obj = cgoDict.get(id, [])
  else:
    obj = []
  if not transparent:
    o = []
  else:
    o = [cgo.ALPHA, 1 - transparency]
  o.extend([cgo.CYLINDER,
            x1,
            y1,
            z1,
            x2,
            y2,
            z2,
            rad,
            r1,
            g1,
            b1,
            r2,
            g2,
            b2, ])
  obj.extend(o)
  cgoDict[id] = obj
  cmd.load_cgo(obj, id, 1)
  return 1
Exemple #24
0
	def showvs(self, msi0, name) :
		assert len(self.chem2clr.items()) > 0
		from pymol import cmd
		msobj = []
		for msi1 in self.msadj[msi0].keys() :
			faceclr, lineclr, faceobj = self.chem2clr[self.mschems[msi1]], self.chem2clr[self.mschems[msi0]], []
			for fi in self.msadj[msi0][msi1] :
				faceobj = faceobj + self.makeFacePymolObj(self.vcen, self.faces[fi], faceclr, lineclr)
			msobj = msobj + faceobj
		cmd.load_cgo(msobj, name)
Exemple #25
0
    def view(self, name="external graphics"):
        """
        Load the scene into PyMOL

        @param name: the name of the PyMOL object corresponding to the scene
        """
        pymol_objects = []
        for o in self.objects:
            pymol_objects.extend(o.getPymolObjects())
        cmd.load_cgo(pymol_objects, name)
def draw_axis(chA, chB, scale_factor=20, w=0.6, r1=1, g1=1, b1=1, r2=1, g2=0, b2=0):
    T = transf_matrix(chA, chB)
    angle=angle_axis(chA, chB)
    angle_degrees=(angle*180)/math.pi
    axis1=[direction_cosines(chA, chB)[0], direction_cosines(chA, chB)[1], direction_cosines(chA, chB)[2]]
    p = nearest_point_to_axis(chA, chB)
    x1, y1, z1 = p[0] + (3*scale_factor*axis1[0]), p[1] + (3*scale_factor*axis1[1]), p[2] + (3*scale_factor*axis1[2])
    x2, y2, z2 = p[0] - (3*scale_factor*axis1[0]), p[1] - (3*scale_factor*axis1[1]), p[2] - (3*scale_factor*axis1[2])
    obj = [cgo.CYLINDER, x1, y1, z1, x2, y2, z2, w, r1, g1, b1, r2, g2, b2, 0.0]
    cmd.load_cgo(obj, angle_degrees)

    cmA=center_of_Mass(chA)
    cmB=cmW
    cmAver=(cmB+cmA)/2
    vector=numpy.array([(cmB[0]-cmA[0]), (cmB[1]-cmA[1]), (cmB[2]-cmA[2])])
    moduli_vector=numpy.linalg.norm(vector)
    vector_director=numpy.array([(cmB[0]-cmA[0])/moduli_vector, (cmB[1]-cmA[1])/moduli_vector, (cmB[2]-cmA[2])/moduli_vector])
    pC_A = proyeccion_centroide(chA, chA, chB)
    pC_B = proyeccion_centroide_working(chA, chB)


    trans_vector = numpy.array([(pC_B[0]-pC_A[0]), (pC_B[1]-pC_A[1]), (pC_B[2]-pC_A[2])])
    modu_tr = numpy.linalg.norm(trans_vector)
    rota_centroid_rad=numpy.dot(vector_director, axis1)
    rota_centroid = (rota_centroid_rad*180)/math.pi
    rota_centroid_absol_0= numpy.absolute(rota_centroid)
    rota_centroid_absol=round(rota_centroid_absol_0,2)


    if rota_centroid_absol == 0.00:
        p1 = '_1'
        p2 = '_2'
        p3 = '_3'
        cmd.pseudoatom (pos=[cmA[0], cmA[1], cmA[2]], object=p1)
        cmd.pseudoatom (pos=[pC_A[0], pC_A[1], pC_A[2]], object=p2)
        cmd.pseudoatom (pos=[cmB[0], cmB[1], cmB[2]], object=p3)
        cmd.angle(None, p1, p2, p3)
        print_information(T, axis1, angle_degrees,  moduli_vector, obj, x1, y1, z1, x2, y2, z2, w, r1, g1, b1, r2, g2, b2)

    if rota_centroid_absol != 0:
        p1 = '_1'
        p2 = '_2'
        p3 = '_3'
        p4 = '_4'
        cmd.pseudoatom (pos=[cmA[0], cmA[1], cmA[2]], object=p1)
        cmd.pseudoatom (pos=[pC_A[0], pC_A[1], pC_A[2]], object=p2)
        cmd.pseudoatom (pos=[pC_B[0], pC_B[1], pC_B[2]], object=p3)
        cmd.pseudoatom (pos=[cmB[0], cmB[1], cmB[2]], object=p4)
        cmd.dihedral(None, p1, p2, p3, p4)
        cmd.distance(None, p2, p3)
        print_information(T, axis1, angle_degrees,  moduli_vector, obj, x1, y1, z1, x2, y2, z2, w, r1, g1, b1, r2, g2, b2, modu_tr)

    cmd.create('working', chA)
    cmd.super('working', chB)
def show_peaks(unit_cell, clusters, radius=2.0):
  go = []
  go.extend([cgo.COLOR, 1, 0, 0,])
  height0 = None
  for site,height in zip(clusters.sites(), clusters.heights()):
    print "%8.5f %8.5f %8.5f" % site, height
    if (height0 == None): height0 = height
    go.extend(  [cgo.SPHERE]
              + list(unit_cell.orthogonalize(site))
              + [radius*height/height0])
  cmd.load_cgo(go, "peaks")
def ie_build(sele, name='iellipsoid', col='[0.5, 0.5, 0.5]', scale='1'):
    # data = cmd.get_coords(sele)  # only for 1.7.4 and higher
    data = np.array(cmd.get_model(sele, 1).get_coord_list())
    col = eval(col, {'__builtins__': None}, {})
    scale = float(scale) * 0.0001

    r0 = data.mean(axis=0)
    x, y, z = (data - r0).transpose()
    Jxx = sum(y ** 2 + z ** 2)
    Jyy = sum(x ** 2 + z ** 2)
    Jzz = sum(x ** 2 + y ** 2)
    Jxy, Jxz, Jyz = sum(x * y), sum(x * z), sum(y * z)
    
    ws, vs = linalg.eig(np.array([
        [Jxx, -Jxy, -Jxz],
        [-Jxy, Jyy, -Jyz],
        [-Jxz, -Jyz, Jzz]
        ]))
    M = linalg.inv(vs)
    a1, a2, a3 = ws * scale

    u_segs = 12
    v_segs = 12
    mesh = [BEGIN, TRIANGLES, COLOR]
    mesh.extend(col)
    dU = math.pi / u_segs
    dV = 2 * math.pi / v_segs
    U = -math.pi / 2
    for Y in range(0, u_segs):
        V = math.pi
        for X in range(0, v_segs):

            (x1, y1, z1), (n1x, n1y, n1z) = vertex(a1, a2, a3,
                                                   U, V, M, r0)
            (x2, y2, z2), (n2x, n2y, n2z) = vertex(a1, a2, a3,
                                                   U + dU, V, M, r0)
            (x3, y3, z3), (n3x, n3y, n3z) = vertex(a1, a2, a3,
                                                   U + dU, V + dV,
                                                   M, r0)
            (x4, y4, z4), (n4x, n4y, n4z) = vertex(a1, a2, a3,
                                                   U, V + dV, M, r0)

            mesh.extend([NORMAL, n1x, n1y, n1z, VERTEX, x1, y1, z1])
            mesh.extend([NORMAL, n2x, n2y, n2z, VERTEX, x2, y2, z2])
            mesh.extend([NORMAL, n4x, n4y, n4z, VERTEX, x4, y4, z4])
            mesh.extend([NORMAL, n2x, n2y, n2z, VERTEX, x2, y2, z2])
            mesh.extend([NORMAL, n3x, n3y, n3z, VERTEX, x3, y3, z3])
            mesh.extend([NORMAL, n4x, n4y, n4z, VERTEX, x4, y4, z4])

            V += dV
        U += dU
    mesh.append(END)
    cmd.load_cgo(mesh, name)
def buried_unsats_from_logfile( fname ) :
    obj = []
    white =  [ COLOR, 1.0, 1.0, 1.0 ]
    #blue = [ COLOR, 0.0, 0.0, 1.0 ]
    #red  = [ COLOR, 1.0, 0.0, 0.0 ]

    #obj.extend( red )
    #obj.extend( blue )
    obj.extend( white )
    atoms = read_buried_unsats_from_logfile( fname )
    append_sphere_objs_from_atoms( atoms, obj )
    cmd.load_cgo(obj,'test',1)
Exemple #30
0
def orb_cyl(lab=""):
    cmd.delete(lab + "o1")
    cmd.delete(lab + "o2")
    p1 = com("pk1")
    p2 = com("pk2")
    p3 = com("pk3")
    dr = (p1 - p2).normalized()
    ax = (p3 - p2).cross(p1 - p2).normalized()
    o1 = rotation_matrix(ax, 60.0) * dr
    o2 = rotation_matrix(ax, -60.0) * dr
    cmd.load_cgo(o1.cgofrompoint(p1), lab + "o1")
    cmd.load_cgo(o2.cgofrompoint(p1), lab + "o2")
Exemple #31
0
    9.58,
    17.53,
    36.01,
    33.58,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    1.0,
    0.,
    CYLINDER,
    -21.37,
    28.14,
    49.26,
    1.30,
    46.86,
    -8.07,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    0.0,
    1.0,
]

# then we load it into PyMOL

cmd.load_cgo(obj, 'out_ani')
Exemple #32
0
    float(64.0), float(79.5),
    float(1.0)
]

cluster_dict["17.763999939"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(2.5),
    float(72.5), float(80.0),
    float(1.0)
]

cluster_dict["17.763999939_arrows"] += cgo_arrow([2.5, 72.5, 80.0],
                                                 [2.986, 72.519, 77.302],
                                                 color="red blue",
                                                 name="Arrows_17.763999939_8")

cmd.load_cgo(cluster_dict["17.763999939"], "Features_17.763999939", 1)
cmd.load_cgo(cluster_dict["17.763999939_arrows"], "Arrows_17.763999939")
cmd.set("transparency", 0.2, "Features_17.763999939")
cmd.group("Pharmacophore_17.763999939", members="Features_17.763999939")
cmd.group("Pharmacophore_17.763999939", members="Arrows_17.763999939")

if dirpath:
    f = join(dirpath, "label_threshold_17.763999939.mol2")
else:
    f = "label_threshold_17.763999939.mol2"

cmd.load(f, 'label_threshold_17.763999939')
cmd.hide('everything', 'label_threshold_17.763999939')
cmd.label("label_threshold_17.763999939", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #33
0
    [-11.0, 50.5, 47.5], [-12.461, 48.729, 47.247],
    color="red blue",
    name="Arrows_15.4800000191_8")

cluster_dict["15.4800000191"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(-9.0),
    float(55.5), float(48.0),
    float(1.0)
]

cluster_dict["15.4800000191_arrows"] += cgo_arrow(
    [-9.0, 55.5, 48.0], [-10.076, 57.643, 49.827],
    color="red blue",
    name="Arrows_15.4800000191_9")

cmd.load_cgo(cluster_dict["15.4800000191"], "Features_15.4800000191", 1)
cmd.load_cgo(cluster_dict["15.4800000191_arrows"], "Arrows_15.4800000191")
cmd.set("transparency", 0.2, "Features_15.4800000191")
cmd.group("Pharmacophore_15.4800000191", members="Features_15.4800000191")
cmd.group("Pharmacophore_15.4800000191", members="Arrows_15.4800000191")

if dirpath:
    f = join(dirpath, "label_threshold_15.4800000191.mol2")
else:
    f = "label_threshold_15.4800000191.mol2"

cmd.load(f, 'label_threshold_15.4800000191')
cmd.hide('everything', 'label_threshold_15.4800000191')
cmd.label("label_threshold_15.4800000191", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
    [30.5, -36.5, 38.0], [27.542, -36.538, 38.091],
    color="red blue",
    name="Arrows_17.7140007019_5")

cluster_dict["17.7140007019"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(34.0),
    float(-39.5), float(34.5),
    float(1.0)
]

cluster_dict["17.7140007019_arrows"] += cgo_arrow(
    [34.0, -39.5, 34.5], [33.968, -36.953, 33.337],
    color="red blue",
    name="Arrows_17.7140007019_6")

cmd.load_cgo(cluster_dict["17.7140007019"], "Features_17.7140007019", 1)
cmd.load_cgo(cluster_dict["17.7140007019_arrows"], "Arrows_17.7140007019")
cmd.set("transparency", 0.2, "Features_17.7140007019")
cmd.group("Pharmacophore_17.7140007019", members="Features_17.7140007019")
cmd.group("Pharmacophore_17.7140007019", members="Arrows_17.7140007019")

if dirpath:
    f = join(dirpath, "label_threshold_17.7140007019.mol2")
else:
    f = "label_threshold_17.7140007019.mol2"

cmd.load(f, 'label_threshold_17.7140007019')
cmd.hide('everything', 'label_threshold_17.7140007019')
cmd.label("label_threshold_17.7140007019", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
    [13.5, -29.5, 22.5], [13.553, -32.357, 23.289],
    color="red blue",
    name="Arrows_13.5200004578_3")

cluster_dict["13.5200004578"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(16.0),
    float(-23.5), float(20.0),
    float(1.0)
]

cluster_dict["13.5200004578_arrows"] += cgo_arrow(
    [16.0, -23.5, 20.0], [16.178, -24.525, 22.851],
    color="red blue",
    name="Arrows_13.5200004578_4")

cmd.load_cgo(cluster_dict["13.5200004578"], "Features_13.5200004578", 1)
cmd.load_cgo(cluster_dict["13.5200004578_arrows"], "Arrows_13.5200004578")
cmd.set("transparency", 0.2, "Features_13.5200004578")
cmd.group("Pharmacophore_13.5200004578", members="Features_13.5200004578")
cmd.group("Pharmacophore_13.5200004578", members="Arrows_13.5200004578")

if dirpath:
    f = join(dirpath, "label_threshold_13.5200004578.mol2")
else:
    f = "label_threshold_13.5200004578.mol2"

cmd.load(f, 'label_threshold_13.5200004578')
cmd.hide('everything', 'label_threshold_13.5200004578')
cmd.label("label_threshold_13.5200004578", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #36
0
    for g in grids:

        cmd.group('hotspot_%s' % (num), members='%s_%s' % (g, num))

cluster_dict = {"17.3369998932": [], "17.3369998932_arrows": []}

cluster_dict["17.3369998932"] += [COLOR, 1.00, 1.000, 0.000] + [ALPHA, 0.6] + [
    SPHERE,
    float(51.4998059097),
    float(14.0001940903),
    float(81.0001940903),
    float(1.0)
]

cmd.load_cgo(cluster_dict["17.3369998932"], "Features_17.3369998932", 1)
cmd.load_cgo(cluster_dict["17.3369998932_arrows"], "Arrows_17.3369998932")
cmd.set("transparency", 0.2, "Features_17.3369998932")
cmd.group("Pharmacophore_17.3369998932", members="Features_17.3369998932")
cmd.group("Pharmacophore_17.3369998932", members="Arrows_17.3369998932")

if dirpath:
    f = join(dirpath, "label_threshold_17.3369998932.mol2")
else:
    f = "label_threshold_17.3369998932.mol2"

cmd.load(f, 'label_threshold_17.3369998932')
cmd.hide('everything', 'label_threshold_17.3369998932')
cmd.label("label_threshold_17.3369998932", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
cluster_dict["16.4349994659"] += [COLOR, 1.00, 1.000, 0.000] + [ALPHA, 0.6] + [SPHERE, float(2.9371830582), float(-0.593975542519), float(20.9172922631), float(1.0)]


cluster_dict["16.4349994659"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(2.5), float(-3.0), float(16.5), float(1.0)]

cluster_dict["16.4349994659_arrows"] += cgo_arrow([2.5,-3.0,16.5], [3.933,-5.403,17.063], color="red blue", name="Arrows_16.4349994659_5")

cluster_dict["16.4349994659"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(2.5), float(-3.0), float(16.5), float(1.0)]

cluster_dict["16.4349994659_arrows"] += cgo_arrow([2.5,-3.0,16.5], [3.933,-5.403,17.063], color="red blue", name="Arrows_16.4349994659_6")

cluster_dict["16.4349994659"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(4.0), float(3.0), float(22.5), float(1.0)]

cluster_dict["16.4349994659_arrows"] += cgo_arrow([4.0,3.0,22.5], [2.892,6.029,22.446], color="red blue", name="Arrows_16.4349994659_7")

cmd.load_cgo(cluster_dict["16.4349994659"], "Features_16.4349994659", 1)
cmd.load_cgo(cluster_dict["16.4349994659_arrows"], "Arrows_16.4349994659")
cmd.set("transparency", 0.2,"Features_16.4349994659")
cmd.group("Pharmacophore_16.4349994659", members="Features_16.4349994659")
cmd.group("Pharmacophore_16.4349994659", members="Arrows_16.4349994659")

if dirpath:
    f = join(dirpath, "label_threshold_16.4349994659.mol2")
else:
    f = "label_threshold_16.4349994659.mol2"

cmd.load(f, 'label_threshold_16.4349994659')
cmd.hide('everything', 'label_threshold_16.4349994659')
cmd.label("label_threshold_16.4349994659", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #38
0
def drawBoundingBox(selection="(all)", padding=0.0, linewidth=2.0, r=1.0, g=1.0, b=1.0):     
        """                                                                  
        DESCRIPTION                                                          
                Given selection, draw the bounding box around it.          

        USAGE:
                drawBoundingBox [selection, [padding, [linewidth, [r, [g, b]]]]]

        PARAMETERS:
                selection,              the selection to enboxen.  :-)
                                        defaults to (all)
   
                padding,                defaults to 0

                linewidth,              width of box lines
                                        defaults to 2.0

                r,                      red color component, valid range is [0.0, 1.0]
                                        defaults to 1.0                               

                g,                      green color component, valid range is [0.0, 1.0]
                                        defaults to 1.0                                 

                b,                      blue color component, valid range is [0.0, 1.0]
                                        defaults to 1.0                                

        RETURNS
                string, the name of the CGO box

        NOTES
                * This function creates a randomly named CGO box that minimally spans the protein. The
                user can specify the width of the lines, the padding and also the color.                            
        """                                                                                                    

        ([minX, minY, minZ],[maxX, maxY, maxZ]) = cmd.get_extent(selection)

        print "Box dimensions (%.2f, %.2f, %.2f)" % (maxX-minX, maxY-minY, maxZ-minZ)

        minX = minX - float(padding)-float(2.0)
        minY = minY - float(padding)+float(1.5)
        minZ = minZ - 0 #- float(padding)
        maxX = maxX + float(padding)
        maxY = maxY + float(padding)
        maxZ = maxZ + 0 #float(padding)

        if padding != 0:
                 print "Box dimensions + padding (%.2f, %.2f, %.2f)" % (maxX-minX, maxY-minY, maxZ-minZ)

        boundingBox = [
                LINEWIDTH, float(linewidth),

                BEGIN, LINES,
                COLOR, float(r), float(g), float(b),

                VERTEX, minX, minY, minZ,       #1
                VERTEX, minX, minY, maxZ,       #2

                VERTEX, minX, maxY, minZ,       #3
                VERTEX, minX, maxY, maxZ,       #4

                VERTEX, maxX, minY, minZ,       #5
                VERTEX, maxX, minY, maxZ,       #6

                VERTEX, maxX, maxY, minZ,       #7
                VERTEX, maxX, maxY, maxZ,       #8


                VERTEX, minX, minY, minZ,       #1
                VERTEX, maxX, minY, minZ,       #5

                VERTEX, minX, maxY, minZ,       #3
                VERTEX, maxX, maxY, minZ,       #7

                VERTEX, minX, maxY, maxZ,       #4
                VERTEX, maxX, maxY, maxZ,       #8

                VERTEX, minX, minY, maxZ,       #2
                VERTEX, maxX, minY, maxZ,       #6


                VERTEX, minX, minY, minZ,       #1
                VERTEX, minX, maxY, minZ,       #3

                VERTEX, maxX, minY, minZ,       #5
                VERTEX, maxX, maxY, minZ,       #7

                VERTEX, minX, minY, maxZ,       #2
                VERTEX, minX, maxY, maxZ,       #4

                VERTEX, maxX, minY, maxZ,       #6
                VERTEX, maxX, maxY, maxZ,       #8

                END
        ]

        boxName = "box_" + str(randint(0,10000))
        while boxName in cmd.get_names():
                boxName = "box_" + str(randint(0,10000))

        cmd.load_cgo(boundingBox,boxName)
        return boxName
                                                 [7.987, 30.477, 1.443],
                                                 color="red blue",
                                                 name="Arrows_18.422000885_7")

cluster_dict["18.422000885"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(10.0),
    float(26.5), float(-5.0),
    float(1.0)
]

cluster_dict["18.422000885_arrows"] += cgo_arrow([10.0, 26.5, -5.0],
                                                 [10.481, 25.868, -7.946],
                                                 color="red blue",
                                                 name="Arrows_18.422000885_8")

cmd.load_cgo(cluster_dict["18.422000885"], "Features_18.422000885", 1)
cmd.load_cgo(cluster_dict["18.422000885_arrows"], "Arrows_18.422000885")
cmd.set("transparency", 0.2, "Features_18.422000885")
cmd.group("Pharmacophore_18.422000885", members="Features_18.422000885")
cmd.group("Pharmacophore_18.422000885", members="Arrows_18.422000885")

if dirpath:
    f = join(dirpath, "label_threshold_18.422000885.mol2")
else:
    f = "label_threshold_18.422000885.mol2"

cmd.load(f, 'label_threshold_18.422000885')
cmd.hide('everything', 'label_threshold_18.422000885')
cmd.label("label_threshold_18.422000885", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #40
0
def main():
    # create the axes object, draw axes with cylinders coloured red, green,
    #blue for X, Y and Z

    obj = [
        CYLINDER,
        0.,
        0.,
        0.,
        10.,
        0.,
        0.,
        0.2,
        1.0,
        1.0,
        1.0,
        1.0,
        0.0,
        0.,
        CYLINDER,
        0.,
        0.,
        0.,
        0.,
        10.,
        0.,
        0.2,
        1.0,
        1.0,
        1.0,
        0.,
        1.0,
        0.,
        CYLINDER,
        0.,
        0.,
        0.,
        0.,
        0.,
        10.,
        0.2,
        1.0,
        1.0,
        1.0,
        0.,
        0.0,
        1.0,
    ]

    # add labels to axes object

    cyl_text(obj,
             plain, [-5., -5., -1],
             'O',
             0.20,
             axes=[[3.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]])
    cyl_text(obj,
             plain, [10., 0., 0.],
             'X',
             0.20,
             axes=[[3.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]])
    cyl_text(obj,
             plain, [0., 10., 0.],
             'Y',
             0.20,
             axes=[[3.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]])
    cyl_text(obj,
             plain, [0., 0., 10.],
             'Z',
             0.20,
             axes=[[3.0, 0.0, 0.0], [0.0, 3.0, 0.0], [0.0, 0.0, 3.0]])

    # then we load it into PyMOL
    cmd.load_cgo(obj, 'axes')
Exemple #41
0
    [5.0, 3.0, -21.0], [6.712, 1.082, -23.059],
    color="red blue",
    name="Arrows_10.4160003662_4")

cluster_dict["10.4160003662"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(5.0),
    float(6.5), float(-22.5),
    float(1.0)
]

cluster_dict["10.4160003662_arrows"] += cgo_arrow(
    [5.0, 6.5, -22.5], [7.18, 6.139, -21.718],
    color="red blue",
    name="Arrows_10.4160003662_5")

cmd.load_cgo(cluster_dict["10.4160003662"], "Features_10.4160003662", 1)
cmd.load_cgo(cluster_dict["10.4160003662_arrows"], "Arrows_10.4160003662")
cmd.set("transparency", 0.2, "Features_10.4160003662")
cmd.group("Pharmacophore_10.4160003662", members="Features_10.4160003662")
cmd.group("Pharmacophore_10.4160003662", members="Arrows_10.4160003662")

if dirpath:
    f = join(dirpath, "label_threshold_10.4160003662.mol2")
else:
    f = "label_threshold_10.4160003662.mol2"

cmd.load(f, 'label_threshold_10.4160003662')
cmd.hide('everything', 'label_threshold_10.4160003662')
cmd.label("label_threshold_10.4160003662", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
cluster_dict["17.2399997711"] += [COLOR, 1.00, 1.000, 0.000] + [ALPHA, 0.6] + [SPHERE, float(51.8420978291), float(5.12592766064), float(-15.6567064325), float(1.0)]


cluster_dict["17.2399997711"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(44.0), float(0.0), float(-6.0), float(1.0)]

cluster_dict["17.2399997711_arrows"] += cgo_arrow([44.0,0.0,-6.0], [40.435,-0.517,-3.997], color="red blue", name="Arrows_17.2399997711_7")

cluster_dict["17.2399997711"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(49.5), float(4.0), float(-9.0), float(1.0)]

cluster_dict["17.2399997711_arrows"] += cgo_arrow([49.5,4.0,-9.0], [49.051,8.384,-6.905], color="red blue", name="Arrows_17.2399997711_8")

cluster_dict["17.2399997711"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(50.0), float(1.5), float(-15.0), float(1.0)]

cluster_dict["17.2399997711_arrows"] += cgo_arrow([50.0,1.5,-15.0], [52.853,-1.315,-14.363], color="red blue", name="Arrows_17.2399997711_9")

cmd.load_cgo(cluster_dict["17.2399997711"], "Features_17.2399997711", 1)
cmd.load_cgo(cluster_dict["17.2399997711_arrows"], "Arrows_17.2399997711")
cmd.set("transparency", 0.2,"Features_17.2399997711")
cmd.group("Pharmacophore_17.2399997711", members="Features_17.2399997711")
cmd.group("Pharmacophore_17.2399997711", members="Arrows_17.2399997711")

if dirpath:
    f = join(dirpath, "label_threshold_17.2399997711.mol2")
else:
    f = "label_threshold_17.2399997711.mol2"

cmd.load(f, 'label_threshold_17.2399997711')
cmd.hide('everything', 'label_threshold_17.2399997711')
cmd.label("label_threshold_17.2399997711", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #43
0
    [20.0, 25.5, -9.5], [19.938, 27.001, -4.768],
    color="red blue",
    name="Arrows_15.7650003433_6")

cluster_dict["15.7650003433"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(22.0),
    float(25.5), float(-7.0),
    float(1.0)
]

cluster_dict["15.7650003433_arrows"] += cgo_arrow(
    [22.0, 25.5, -7.0], [23.663, 26.711, -5.343],
    color="red blue",
    name="Arrows_15.7650003433_7")

cmd.load_cgo(cluster_dict["15.7650003433"], "Features_15.7650003433", 1)
cmd.load_cgo(cluster_dict["15.7650003433_arrows"], "Arrows_15.7650003433")
cmd.set("transparency", 0.2, "Features_15.7650003433")
cmd.group("Pharmacophore_15.7650003433", members="Features_15.7650003433")
cmd.group("Pharmacophore_15.7650003433", members="Arrows_15.7650003433")

if dirpath:
    f = join(dirpath, "label_threshold_15.7650003433.mol2")
else:
    f = "label_threshold_15.7650003433.mol2"

cmd.load(f, 'label_threshold_15.7650003433')
cmd.hide('everything', 'label_threshold_15.7650003433')
cmd.label("label_threshold_15.7650003433", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
    [17.0, 8.5, 23.0], [16.349, 5.538, 22.439],
    color="red blue",
    name="Arrows_12.0889997482_5")

cluster_dict["12.0889997482"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(24.5),
    float(6.5), float(25.5),
    float(1.0)
]

cluster_dict["12.0889997482_arrows"] += cgo_arrow(
    [24.5, 6.5, 25.5], [23.127, 3.857, 24.382],
    color="red blue",
    name="Arrows_12.0889997482_6")

cmd.load_cgo(cluster_dict["12.0889997482"], "Features_12.0889997482", 1)
cmd.load_cgo(cluster_dict["12.0889997482_arrows"], "Arrows_12.0889997482")
cmd.set("transparency", 0.2, "Features_12.0889997482")
cmd.group("Pharmacophore_12.0889997482", members="Features_12.0889997482")
cmd.group("Pharmacophore_12.0889997482", members="Arrows_12.0889997482")

if dirpath:
    f = join(dirpath, "label_threshold_12.0889997482.mol2")
else:
    f = "label_threshold_12.0889997482.mol2"

cmd.load(f, 'label_threshold_12.0889997482')
cmd.hide('everything', 'label_threshold_12.0889997482')
cmd.label("label_threshold_12.0889997482", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #45
0
    float(3.78619756877),
    float(1.0)
]

cluster_dict["7.11199998856"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(13.0),
    float(7.5), float(6.5),
    float(1.0)
]

cluster_dict["7.11199998856_arrows"] += cgo_arrow(
    [13.0, 7.5, 6.5], [13.45, 5.144, 8.134],
    color="red blue",
    name="Arrows_7.11199998856_1")

cmd.load_cgo(cluster_dict["7.11199998856"], "Features_7.11199998856", 1)
cmd.load_cgo(cluster_dict["7.11199998856_arrows"], "Arrows_7.11199998856")
cmd.set("transparency", 0.2, "Features_7.11199998856")
cmd.group("Pharmacophore_7.11199998856", members="Features_7.11199998856")
cmd.group("Pharmacophore_7.11199998856", members="Arrows_7.11199998856")

if dirpath:
    f = join(dirpath, "label_threshold_7.11199998856.mol2")
else:
    f = "label_threshold_7.11199998856.mol2"

cmd.load(f, 'label_threshold_7.11199998856')
cmd.hide('everything', 'label_threshold_7.11199998856')
cmd.label("label_threshold_7.11199998856", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #46
0
    [15.5, 0.0, 8.5], [16.741, 2.845, 7.975],
    color="red blue",
    name="Arrows_16.0149993896_8")

cluster_dict["16.0149993896"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(21.0),
    float(-2.0), float(6.0),
    float(1.0)
]

cluster_dict["16.0149993896_arrows"] += cgo_arrow(
    [21.0, -2.0, 6.0], [20.52, 0.236, 4.302],
    color="red blue",
    name="Arrows_16.0149993896_9")

cmd.load_cgo(cluster_dict["16.0149993896"], "Features_16.0149993896", 1)
cmd.load_cgo(cluster_dict["16.0149993896_arrows"], "Arrows_16.0149993896")
cmd.set("transparency", 0.2, "Features_16.0149993896")
cmd.group("Pharmacophore_16.0149993896", members="Features_16.0149993896")
cmd.group("Pharmacophore_16.0149993896", members="Arrows_16.0149993896")

if dirpath:
    f = join(dirpath, "label_threshold_16.0149993896.mol2")
else:
    f = "label_threshold_16.0149993896.mol2"

cmd.load(f, 'label_threshold_16.0149993896')
cmd.hide('everything', 'label_threshold_16.0149993896')
cmd.label("label_threshold_16.0149993896", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #47
0
cluster_dict["16.8199996948"] += [COLOR, 1.00, 1.000, 0.000] + [ALPHA, 0.6] + [SPHERE, float(15.8594807538), float(-3.42854177321), float(11.2465827684), float(1.0)]


cluster_dict["16.8199996948"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(11.5), float(-0.5), float(12.5), float(1.0)]

cluster_dict["16.8199996948_arrows"] += cgo_arrow([11.5,-0.5,12.5], [10.671,-0.831,16.543], color="red blue", name="Arrows_16.8199996948_4")

cluster_dict["16.8199996948"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(14.0), float(-3.0), float(14.5), float(1.0)]

cluster_dict["16.8199996948_arrows"] += cgo_arrow([14.0,-3.0,14.5], [14.05,-0.469,16.069], color="red blue", name="Arrows_16.8199996948_5")

cluster_dict["16.8199996948"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(15.5), float(0.0), float(8.5), float(1.0)]

cluster_dict["16.8199996948_arrows"] += cgo_arrow([15.5,0.0,8.5], [16.741,2.845,7.975], color="red blue", name="Arrows_16.8199996948_6")

cmd.load_cgo(cluster_dict["16.8199996948"], "Features_16.8199996948", 1)
cmd.load_cgo(cluster_dict["16.8199996948_arrows"], "Arrows_16.8199996948")
cmd.set("transparency", 0.2,"Features_16.8199996948")
cmd.group("Pharmacophore_16.8199996948", members="Features_16.8199996948")
cmd.group("Pharmacophore_16.8199996948", members="Arrows_16.8199996948")

if dirpath:
    f = join(dirpath, "label_threshold_16.8199996948.mol2")
else:
    f = "label_threshold_16.8199996948.mol2"

cmd.load(f, 'label_threshold_16.8199996948')
cmd.hide('everything', 'label_threshold_16.8199996948')
cmd.label("label_threshold_16.8199996948", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
    float(69.7399321544),
    float(1.0)
]

cluster_dict["17.9330005646"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(-23.5),
    float(-4.5), float(69.5),
    float(1.0)
]

cluster_dict["17.9330005646_arrows"] += cgo_arrow(
    [-23.5, -4.5, 69.5], [-25.168, -7.109, 69.248],
    color="red blue",
    name="Arrows_17.9330005646_1")

cmd.load_cgo(cluster_dict["17.9330005646"], "Features_17.9330005646", 1)
cmd.load_cgo(cluster_dict["17.9330005646_arrows"], "Arrows_17.9330005646")
cmd.set("transparency", 0.2, "Features_17.9330005646")
cmd.group("Pharmacophore_17.9330005646", members="Features_17.9330005646")
cmd.group("Pharmacophore_17.9330005646", members="Arrows_17.9330005646")

if dirpath:
    f = join(dirpath, "label_threshold_17.9330005646.mol2")
else:
    f = "label_threshold_17.9330005646.mol2"

cmd.load(f, 'label_threshold_17.9330005646')
cmd.hide('everything', 'label_threshold_17.9330005646')
cmd.label("label_threshold_17.9330005646", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #49
0
def draw(xparmfile, end, offset="0"):
    """
DESCRIPTION
    Visualize XPARM.XDS

USAGE
    load_xparm XPARM.XDS, framenumber [,frame offset]
    end is the end number of frames

AUTHORS
    Keitaro Yamashita, 2011
    """

    end = int(end)
    offset = int(offset)

    if not hasattr(stored, "__xparm_internal__"):
        stored.__xparm_internal__ = 1
    else:
        stored.__xparm_internal__ += 1

    suffix = str(stored.__xparm_internal__)

    param = XPARM(xparmfile)
    origin = numpy.zeros(3)

    gonio = obj_phigonio(origin, param.rotation_axis, scale=6)
    beam = obj_beam(origin, param.incident_beam, param.wavelength, scale=10)

    cmd.load_cgo(gonio, "gonio_" + suffix)
    cmd.load_cgo(beam, "beam_" + suffix)

    load_ewald(origin,
               param.incident_beam,
               param.wavelength,
               scale=10,
               name="Ewald_" + suffix)

    # Rotate space by phi axis
    for i, d in enumerate([
            param.starting_angle + (i + 0.5 + offset) * param.osc_range
            for i in xrange(end)
    ]):
        print i, d
        R = rot_matrix(param.rotation_axis, numpy.radians(d))

        A = numpy.array(numpy.dot(R, param.a_axis))[0]
        B = numpy.array(numpy.dot(R, param.b_axis))[0]
        C = numpy.array(numpy.dot(R, param.c_axis))[0]

        rA, rB, rC = reciprocal(A, B, C)

        #print "real vectors:", A, B, C
        #print "reciprocal vectors:", rA, rB, rC

        scale = .5 * .2 * min(
            [numpy.linalg.norm(A),
             numpy.linalg.norm(B),
             numpy.linalg.norm(C)]) / max([
                 numpy.linalg.norm(rA),
                 numpy.linalg.norm(rB),
                 numpy.linalg.norm(rC)
             ])

        # Unit vectors
        a_axis = obj_axis(origin, A * .2, "a")
        b_axis = obj_axis(origin, B * .2, "b")
        c_axis = obj_axis(origin, C * .2, "c")

        # Reciprocal unit vectors
        as_axis = obj_axis(origin, rA * scale, "a")
        bs_axis = obj_axis(origin, rB * scale, "b")
        cs_axis = obj_axis(origin, rC * scale, "c")

        cmd.load_cgo(a_axis + b_axis + c_axis, "axes_" + suffix, i + 1)
        cmd.load_cgo(as_axis + bs_axis + cs_axis, "reciprocal_axes_" + suffix,
                     i + 1)
Exemple #50
0
    3.23,
    -7.05,
    -19.82,
    18.34,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    1.0,
    0.,
    CYLINDER,
    13.79,
    -7.71,
    -1.24,
    -21.45,
    4.87,
    21.32,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    0.0,
    1.0,
]

# then we load it into PyMOL

cmd.load_cgo(obj, 'out_B_4')
Exemple #51
0
def supercell(a=1, b=1, c=1, object=None, color='blue', name='supercell', withmates=1):
    """
    DESCRIPTION

    Draw a supercell, as requested by Nicolas Bock on the pymol-users
    mailing list (Subject: [PyMOL] feature request: supercell construction
    Date: 04/12/2010 10:12:17 PM (Mon, 12 Apr 2010 14:12:17 -0600))

    USAGE

    supercell a, b, c [, object [, color [, name [, withmates]]]]

    ARGUMENTS

    a, b, c = integer: repeat cell in x,y,z direction a,b,c times
    {default: 1,1,1}

    object = string: name of object to take cell definition from

    color = string: color of cell {default: blue}

    name = string: name of the cgo object to create {default: supercell}

    withmates = bool: also create symmetry mates in displayed cells
    {default: 1}

    SEE ALSO

    show cell

    """
    if object is None:
        object = cmd.get_object_list()[0]
    withmates = int(withmates)

    sym = cmd.get_symmetry(object)
    cell_edges = sym[0:3]
    cell_angles = sym[3:6]

    basis = cellbasis(cell_angles, cell_edges)
    assert isinstance(basis, np.ndarray)

    ts = list()
    for i in range(int(a)):
        for j in range(int(b)):
            for k in range(int(c)):
                ts.append([i,j,k])

    obj = [
            cgo.BEGIN,
            cgo.LINES,
            cgo.COLOR,
    ]
    obj.extend(cmd.get_color_tuple(color))
        
    for t in ts:
        shift = basis[0:3,0:3] * t
        shift = shift[:,0] + shift[:,1] + shift[:,2]
        
        for i in range(3):
            vi = basis[0:3,i]
            vj = [
                    np.array([0.,0.,0.]),
                    basis[0:3,(i+1)%3],
                    basis[0:3,(i+2)%3],
                    basis[0:3,(i+1)%3] + basis[0:3,(i+2)%3]
            ]
            for j in range(4):
                obj.append(cgo.VERTEX)
                obj.extend((shift + vj[j]).tolist())
                obj.append(cgo.VERTEX)
                obj.extend((shift + vj[j] + vi).tolist())

            if withmates:
                symexpcell('m%d%d%d_' % tuple(t), object, *t)

    obj.append(cgo.END)

    cmd.delete(name)
    cmd.load_cgo(obj, name)
Exemple #52
0
cluster_dict["12.9040002823"] += [COLOR, 0.00, 0.00, 1.00] + [ALPHA, 0.6] + [SPHERE, float(68.0), float(53.0), float(65.0), float(1.0)]

cluster_dict["12.9040002823_arrows"] += cgo_arrow([68.0,53.0,65.0], [65.785,54.765,65.83], color="blue red", name="Arrows_12.9040002823_3")

cluster_dict["12.9040002823"] += [COLOR, 1.00, 1.000, 0.000] + [ALPHA, 0.6] + [SPHERE, float(68.0885970834), float(51.0922228063), float(60.2126804208), float(1.0)]


cluster_dict["12.9040002823"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(69.0), float(54.5), float(60.5), float(1.0)]

cluster_dict["12.9040002823_arrows"] += cgo_arrow([69.0,54.5,60.5], [68.789,56.273,57.186], color="red blue", name="Arrows_12.9040002823_4")

cluster_dict["12.9040002823"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(69.0), float(54.5), float(60.5), float(1.0)]

cluster_dict["12.9040002823_arrows"] += cgo_arrow([69.0,54.5,60.5], [68.789,56.273,57.186], color="red blue", name="Arrows_12.9040002823_5")

cmd.load_cgo(cluster_dict["12.9040002823"], "Features_12.9040002823", 1)
cmd.load_cgo(cluster_dict["12.9040002823_arrows"], "Arrows_12.9040002823")
cmd.set("transparency", 0.2,"Features_12.9040002823")
cmd.group("Pharmacophore_12.9040002823", members="Features_12.9040002823")
cmd.group("Pharmacophore_12.9040002823", members="Arrows_12.9040002823")

if dirpath:
    f = join(dirpath, "label_threshold_12.9040002823.mol2")
else:
    f = "label_threshold_12.9040002823.mol2"

cmd.load(f, 'label_threshold_12.9040002823')
cmd.hide('everything', 'label_threshold_12.9040002823')
cmd.label("label_threshold_12.9040002823", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #53
0
    CYLINDER,
    0,
    0,
    0,
    8.135000,
    1.827500,
    0.779500,
    0.25,
    1,
    1,
    1,
    1.000000,
    0.400000,
    0.400000,
]
cmd.load_cgo(obj, 'Ex2_929_1.67')
obj = [
    CYLINDER,
    0,
    0,
    0,
    4.734000,
    7.747500,
    -1.031500,
    0.25,
    1,
    1,
    1,
    1.000000,
    0.400000,
    0.400000,
Exemple #54
0
    [41.0, 11.0, 64.0], [37.79, 10.544, 67.284],
    color="red blue",
    name="Arrows_13.9219999313_8")

cluster_dict["13.9219999313"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(41.5),
    float(18.0), float(62.5),
    float(1.0)
]

cluster_dict["13.9219999313_arrows"] += cgo_arrow(
    [41.5, 18.0, 62.5], [45.018, 17.321, 62.219],
    color="red blue",
    name="Arrows_13.9219999313_9")

cmd.load_cgo(cluster_dict["13.9219999313"], "Features_13.9219999313", 1)
cmd.load_cgo(cluster_dict["13.9219999313_arrows"], "Arrows_13.9219999313")
cmd.set("transparency", 0.2, "Features_13.9219999313")
cmd.group("Pharmacophore_13.9219999313", members="Features_13.9219999313")
cmd.group("Pharmacophore_13.9219999313", members="Arrows_13.9219999313")

if dirpath:
    f = join(dirpath, "label_threshold_13.9219999313.mol2")
else:
    f = "label_threshold_13.9219999313.mol2"

cmd.load(f, 'label_threshold_13.9219999313')
cmd.hide('everything', 'label_threshold_13.9219999313')
cmd.label("label_threshold_13.9219999313", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
    [-21.0, 10.5, -40.0], [-22.802, 10.056, -41.995],
    color="red blue",
    name="Arrows_9.60299968719_1")

cluster_dict["9.60299968719"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(-13.0),
    float(10.5), float(-43.0),
    float(1.0)
]

cluster_dict["9.60299968719_arrows"] += cgo_arrow(
    [-13.0, 10.5, -43.0], [-12.975, 10.853, -46.004],
    color="red blue",
    name="Arrows_9.60299968719_2")

cmd.load_cgo(cluster_dict["9.60299968719"], "Features_9.60299968719", 1)
cmd.load_cgo(cluster_dict["9.60299968719_arrows"], "Arrows_9.60299968719")
cmd.set("transparency", 0.2, "Features_9.60299968719")
cmd.group("Pharmacophore_9.60299968719", members="Features_9.60299968719")
cmd.group("Pharmacophore_9.60299968719", members="Arrows_9.60299968719")

if dirpath:
    f = join(dirpath, "label_threshold_9.60299968719.mol2")
else:
    f = "label_threshold_9.60299968719.mol2"

cmd.load(f, 'label_threshold_9.60299968719')
cmd.hide('everything', 'label_threshold_9.60299968719')
cmd.label("label_threshold_9.60299968719", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #56
0
    float(74.0), float(16.5),
    float(1.0)
]

cluster_dict["32.7789993286_arrows"] += cgo_arrow(
    [19.0, 74.0, 16.5], [20.035, 77.898, 13.86],
    color="red blue",
    name="Arrows_32.7789993286_8")

cluster_dict["32.7789993286"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(19.5),
    float(72.5), float(17.0),
    float(1.0)
]

cmd.load_cgo(cluster_dict["32.7789993286"], "Features_32.7789993286", 1)
cmd.load_cgo(cluster_dict["32.7789993286_arrows"], "Arrows_32.7789993286")
cmd.set("transparency", 0.2, "Features_32.7789993286")
cmd.group("Pharmacophore_32.7789993286", members="Features_32.7789993286")
cmd.group("Pharmacophore_32.7789993286", members="Arrows_32.7789993286")

if dirpath:
    f = join(dirpath, "label_threshold_32.7789993286.mol2")
else:
    f = "label_threshold_32.7789993286.mol2"

cmd.load(f, 'label_threshold_32.7789993286')
cmd.hide('everything', 'label_threshold_32.7789993286')
cmd.label("label_threshold_32.7789993286", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #57
0
cluster_dict["12.625_arrows"] += cgo_arrow([14.0,55.0,22.5], [14.391,54.985,20.064], color="red blue", name="Arrows_12.625_5")

cluster_dict["12.625"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(14.5), float(52.0), float(19.0), float(1.0)]

cluster_dict["12.625_arrows"] += cgo_arrow([14.5,52.0,19.0], [12.54,51.945,16.891], color="red blue", name="Arrows_12.625_6")

cluster_dict["12.625"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(15.5), float(53.5), float(21.5), float(1.0)]

cluster_dict["12.625_arrows"] += cgo_arrow([15.5,53.5,21.5], [14.391,54.985,20.064], color="red blue", name="Arrows_12.625_7")

cluster_dict["12.625"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [SPHERE, float(17.0), float(45.5), float(27.5), float(1.0)]

cluster_dict["12.625_arrows"] += cgo_arrow([17.0,45.5,27.5], [19.435,44.038,28.278], color="red blue", name="Arrows_12.625_8")

cmd.load_cgo(cluster_dict["12.625"], "Features_12.625", 1)
cmd.load_cgo(cluster_dict["12.625_arrows"], "Arrows_12.625")
cmd.set("transparency", 0.2,"Features_12.625")
cmd.group("Pharmacophore_12.625", members="Features_12.625")
cmd.group("Pharmacophore_12.625", members="Arrows_12.625")

if dirpath:
    f = join(dirpath, "label_threshold_12.625.mol2")
else:
    f = "label_threshold_12.625.mol2"

cmd.load(f, 'label_threshold_12.625')
cmd.hide('everything', 'label_threshold_12.625')
cmd.label("label_threshold_12.625", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #58
0
    -0.76,
    3.11,
    20.55,
    1.09,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    1.0,
    0.,
    CYLINDER,
    -33.26,
    -2.11,
    -0.35,
    32.08,
    1.02,
    0.73,
    0.2,
    1.0,
    1.0,
    1.0,
    0.,
    0.0,
    1.0,
]

# then we load it into PyMOL

cmd.load_cgo(obj, 'out_predicted')
Exemple #59
0
    [-21.5, 9.5, -12.0], [-20.258, 10.438, -14.847],
    color="red blue",
    name="Arrows_16.5540008545_8")

cluster_dict["16.5540008545"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(-22.0),
    float(2.5), float(-11.5),
    float(1.0)
]

cluster_dict["16.5540008545_arrows"] += cgo_arrow(
    [-22.0, 2.5, -11.5], [-25.126, 3.115, -12.834],
    color="red blue",
    name="Arrows_16.5540008545_9")

cmd.load_cgo(cluster_dict["16.5540008545"], "Features_16.5540008545", 1)
cmd.load_cgo(cluster_dict["16.5540008545_arrows"], "Arrows_16.5540008545")
cmd.set("transparency", 0.2, "Features_16.5540008545")
cmd.group("Pharmacophore_16.5540008545", members="Features_16.5540008545")
cmd.group("Pharmacophore_16.5540008545", members="Arrows_16.5540008545")

if dirpath:
    f = join(dirpath, "label_threshold_16.5540008545.mol2")
else:
    f = "label_threshold_16.5540008545.mol2"

cmd.load(f, 'label_threshold_16.5540008545')
cmd.hide('everything', 'label_threshold_16.5540008545')
cmd.label("label_threshold_16.5540008545", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)
Exemple #60
0
    float(0.5), float(-22.0),
    float(1.0)
]

cluster_dict["16.767999649"] += [COLOR, 1.00, 0.00, 0.00] + [ALPHA, 0.6] + [
    SPHERE, float(46.5),
    float(6.5), float(-26.0),
    float(1.0)
]

cluster_dict["16.767999649_arrows"] += cgo_arrow([46.5, 6.5, -26.0],
                                                 [47.586, 4.444, -27.546],
                                                 color="red blue",
                                                 name="Arrows_16.767999649_8")

cmd.load_cgo(cluster_dict["16.767999649"], "Features_16.767999649", 1)
cmd.load_cgo(cluster_dict["16.767999649_arrows"], "Arrows_16.767999649")
cmd.set("transparency", 0.2, "Features_16.767999649")
cmd.group("Pharmacophore_16.767999649", members="Features_16.767999649")
cmd.group("Pharmacophore_16.767999649", members="Arrows_16.767999649")

if dirpath:
    f = join(dirpath, "label_threshold_16.767999649.mol2")
else:
    f = "label_threshold_16.767999649.mol2"

cmd.load(f, 'label_threshold_16.767999649')
cmd.hide('everything', 'label_threshold_16.767999649')
cmd.label("label_threshold_16.767999649", "name")
cmd.set("label_font_id", 7)
cmd.set("label_size", -0.4)