3
$\begingroup$

I would like to add some 3D elements (balls and lines) to the PyMOL visualization to highlight some "holes" in the structure. Say I fetch 1tqn and I want to add a yellow ball somewhere (to specific coordinates, say [-19, -23, -14]) in the view. Or a bar from - to coordinates.

enter image description here

I was going through wiki, did a online search but have not found a way how to add these simple 3D entities into the scene. I guess it should be trivial and I'm just using wrong queries. Because I need to add lots of these, I need to be able to do that via scripting interface.

Thank you in advance for any help!

$\endgroup$
1

1 Answer 1

2
$\begingroup$

my attempt :

import pymol

from pymol.cgo import *

from pymol import (
                    
                    cmd ,
                    )


print('########## PYMOL VERSION ##########################################')
print('         ',  cmd.get_version() )
print('###################################################################')


pymol.finish_launching()

cmd.fetch('1tqn')

cmd.remove('solvent')

pos = cmd.get_position()

r = 3

print('###############################################################################\n')

print('### POSITION : ' , pos,'  ###\n')

print('###############################################################################\n')



spherelist = [
    [COLOR,    1.000,    1.000,    0.000,
    SPHERE,   pos[0] , pos[1] , pos[2]  , r ],

    ]

for i in spherelist:
    
    a = str(spherelist.index(i))

    cmd.load_cgo(i, 'sphere_'+a )


cmd.zoom()

cmd.set('cartoon_transparency' , '0.5')

result:

enter image description here

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.