[chimera-dev] Running Chimera through Python script
Eric Pettersen
pett at cgl.ucsf.edu
Mon Jan 29 11:27:50 PST 2018
Hi Evan,
There are multiple possible approaches here. You can tightly couple your GUI to Chimera, which is what you are describing, you can more loosely couple your GUI to Chimera, or you could not use Chimera at all. Briefly:
Tight Coupling
You write your GUI as a Chimera tool/extension, and starting your tool actually starts Chimera and your tool (possibly as “chimera —start “your tool” in a script).
Loose Coupling
Your GUI starts Chimera as a subprocess when needed (“chimera —start RESTServer <https://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/restserver/restserver.html>”) and sends commands to it via HTTP in order to open and change the display of structures.
Non-Chimera
One possibility is to use NGL Viewer <http://nglviewer.org/ngl/> to show the structure in a web browser (that supports WebGL). The structure will be interactively manipulable.
Chimera citation info can be found via the Help->Citation Info menu item.
You other questions are only applicable if you go the “tight coupling” route. If you choose to go that route, then yes, all modules (including your own) would have to be installed using the Chimera interpreter. I am unaware of any module conflicts when this is done.
—Eric
> On Jan 28, 2018, at 9:45 AM, Evan Seitz <evan.e.seitz at gmail.com> wrote:
>
> Hi Eric, thank you for your detailed reply. I’m working on a project that analyzes user input data through a GUI, and at one point needs to open a 3d render of a specific protein mapping that can rotate, etc.
>
> If we went with this option, our team would eventually have to compile our entire code using the Chimera Python interpreter, correct? Do you happen to know if this kind of thing is allowed, and if it is, what citations should be used? Also, are there any case you’ve heard of of the Chimera interpreter causing internal conflicts with other native Python modules and code?
>
> Thank you so much for your time.
>
> Best,
> Evan
>
>> On Jan 23, 2018, at 6:03 PM, Eric Pettersen <pett at cgl.ucsf.edu <mailto:pett at cgl.ucsf.edu>> wrote:
>>
>> Hi Evan,
>> That code only works in the context of Chimera’s Python interpreter, not a generic Python interpreter. So like it says in the example, “to execute the script, either open the script file with the File→Open menu item or with the open command”.
>> Third parties have developed modules to allow Chimera modules to be used in standard Python interpreters. One such package is pychimera, <https://pypi.python.org/pypi/pychimera/0.2.0> which can be installed via pypi.
>> Chimera only supports Python2. ChimeraX uses Python3.
>>
>> —Eric
>>
>> Eric Pettersen
>> UCSF Computer Graphics Lab
>>
>>> On Jan 23, 2018, at 11:03 AM, Evan Seitz <evan.e.seitz at gmail.com <mailto:evan.e.seitz at gmail.com>> wrote:
>>>
>>> Hi - I’m trying to follow Example 1 on http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html <http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/Examples/index.html>, but after entering the code precisely as it is written, am getting back the ModuleNotFoundError: No module named ‘chimera’.
>>>
>>> I’ve tried running the script using both Python2.7 and Python3, and both have resulted in the same error. As a sub-question, is Chimera supported in Python3, or is it best practice to still use Python2?
>>>
>>> Thank you,
>>> Evan Seitz
>>>
>>> Chimera version: 1.12.0
>>> OS: macOS High Sierra 10.13.2
>>> _______________________________________________
>>> Chimera-dev mailing list
>>> Chimera-dev at cgl.ucsf.edu <mailto:Chimera-dev at cgl.ucsf.edu>
>>> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev <http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev>
>>
>
> _______________________________________________
> Chimera-dev mailing list
> Chimera-dev at cgl.ucsf.edu
> http://www.rbvi.ucsf.edu/mailman/listinfo/chimera-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20180129/08a2b9a9/attachment.html>
More information about the Chimera-dev
mailing list