[chimera-dev] visualizing lines between atoms
Eric Pettersen
pett at cgl.ucsf.edu
Fri Apr 24 14:04:31 PDT 2015
On Apr 24, 2015, at 5:37 AM, Mathilde LE BOUDIC-JAMIN <m.leboudic at gmail.com> wrote:
> Dear all,
>
> We're creating a chimera entension and we want (among other things) to ask Chimera to draw a line between pairs of selected atoms.
> Would you by chance have an idea about how to program it?
> I'm sorry but I'm not comfortable with the chimera modules yet.
Hi Mathilde,
One would draw lines between atoms (where the lines aren't actual covalent bonds) using pseudobonds. First, you have to get a pseudobond "group" to hold your pseudobonds. The group also has to given a category/name that describes what the pseudobonds represent (the name will be displayed in the PseudoBond Panel (Tools->General Controls->PseudoBond Panel)). Say your pseudobonds represented NMR constraints, then the call to get/make the group would be:
from chimera.misc import getPseudoBondGroup
pbg = getPseudoBondGroup("NMR constraints")
Then you need to actually add the pseudobonds to the group. Assuming the atoms were in variables 'a1' and 'a2', the call would be:
pbg.newPseudoBond(a1, a2)
If you literally mean that the atoms are selected in the graphics window (and exactly two are selected), then you can assign them to 'a1' and 'a2' with:
from chimera.selection import currentAtoms
a1, a2 = currentAtoms()
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20150424/342597cb/attachment.html>
More information about the Chimera-dev
mailing list