[chimerax-users] Using ChimeraX as a Python Library

James Loy jamesmadiganloy at gmail.com
Tue Jul 6 11:29:34 PDT 2021


Tom, Eric--

Thanks for the responses!

We'd certainly like to read the cif files, but in addition, we'd like to
add hydrogens to the protein as well. For an MVP, I was just going to have
some script that calls the chimerax CLI.  Something like this (in python):

for code in pdb_codes:
    subprocess.run(f"chimerax --nogui --cmd 'load {code}.cif; addh; save
{code}.addh.cif; exit'"

This will likely be okay. But, if I am able to call a python script using
chimera basically as the interpreter then that might work better. My only
question would be how could I utilize other third party libraries? Say, if
I were to use chimerax as the interpreter for the entire cif processing
pipeline, then I would need to utilize a few outside modules.

Thanks again for your help-- I really appreciate it!
-James

On Tue, Jul 6, 2021 at 1:07 PM Eric Pettersen <pett at cgl.ucsf.edu> wrote:

> If the *only* thing you need ChimeraX for is to read/parse mmCIF files,
> we do package that part as a separate library: GitHub - RBVI/readcif: A
> fast C++ CIF and mmCIF parser <https://github.com/RBVI/readcif>
>
> --Eric
>
> Eric Pettersen
> UCSF Computer Graphics Lab
>
>
> On Jul 6, 2021, at 11:01 AM, Tom Goddard via ChimeraX-users <
> chimerax-users at cgl.ucsf.edu> wrote:
>
> Hi James,
>
>   The ChimeraX Python modules have not been packaged to be used outside
> the ChimeraX application.  I have tried making a chimerax module that can
> be installed in any Python (with the right version for binary
> compatibility) where all its Python capabilities can be used without
> needing the application user interface.  But we have not distributed that,
> it has lots of problems.  We have put it into two grant proposals to get
> funding for it but one proposal was not funded and the other we are still
> waiting to hear about.
>
>   In theory it shouldn't be hard to reuse specific parts of ChimeraX, for
> instance reading mmCIF files.  That is in the mmcif ChimeraX Python module.
>
> https://github.com/RBVI/ChimeraX/tree/develop/src/bundles/mmcif
>
> But that needs various other ChimeraX modules (atomstruct, element,
> pyinstance, pdbconnect, readcif, logger, arrays) listed in the mmcif
> bundle_info.xml file
>
>
> https://github.com/RBVI/ChimeraX/blob/develop/src/bundles/mmcif/bundle_info.xml
>
> and those in turn require some other ChimeraX Python modules.  ChimeraX
> contains hundreds of Python modules, so how will you figure out which ones
> you need?  The easy solution is to take them all.  But there are more
> problems, because the ChimeraX application initializes many of the modules,
> for instance, letting the atomic data structures module know where the
> residue template files are located.  So you also need to figure that out.
> These many obstacles are why we proposed funding to make the code more
> usable without running the ChimeraX application -- it will be a good bit of
> work.
>
>   So the standard solution is instead to just run your processing scripts
> with the ChimeraX application from the command-line
>
> chimerax --nogui myscript.py
>
>   For compiling ChimeraX you must be using old ChimeraX source code (your
> example is fetching Python 3.7 but ChimeraX has used Python 3.8 for the
> last 9 months).  The current ChimeraX build does not fetch third party
> libraries with rsync, it uses https and curl and does not need a password.
> So use the current ChimeraX source from github and  you should not have
> that problem.
>
> https://github.com/RBVI/ChimeraX
>
>   Tom
>
>
>
> On Jul 3, 2021, at 5:51 AM, James Loy via ChimeraX-users <
> chimerax-users at cgl.ucsf.edu> wrote:
>
> Hello!
>
> Thank you for creating such an amazing piece of software!
>
> I'm trying to use portions of ChimeraX for part of a CIF file processing
> pipeline. In order to automate the process, I'm building a docker image
> that has ChimeraX installed. Ideally, we would like to use the pieces of
> ChimeraX we need by importing the relevant python modules. Is this
> possible? If so, must I build ChimeraX from source?
>
> Additionally, I have tried several times to build v1.1.1 from source and I
> have not been able to. I am always prompted for a password when trying to
> rsync the dependencies:
> /bin/sh -c 'rsync -a $1 .' -- plato.cgl.ucsf.edu
> :/usr/local/projects/chimerax/www/data/prereqs/python/Python-3.7.8.tar.xz
> user at plato.cgl.ucsf.edu's password:
> In order to build from source, do I need to register somewhere to get
> credentials?
>
> Just to be clear, this CIF file processing pipeline is for academic (UT
> Austin) use, not commercial.
>
> Thanks in advance!
> James
> --
> James Loy, Ph. D.
> 614.915.9792
> LinkedIn <https://www.linkedin.com/in/james-m-loy-ph-d-ba2256a/>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
>
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
>
>
>

-- 
James Loy, Ph. D.
614.915.9792
LinkedIn <https://www.linkedin.com/in/james-m-loy-ph-d-ba2256a/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimerax-users/attachments/20210706/a840b306/attachment.html>


More information about the ChimeraX-users mailing list