[chimerax-users] 2D plots and graphs for protein-ligand interactions

Tom Goddard goddard at sonic.net
Thu Sep 8 15:07:28 PDT 2022


Hi Enrico,

  As Elaine says, ChimeraX isn't a plotting package, so it doesn't let you set colors, sizes, scales, ..., of plots.  You could save the plot ChimeraX makes with Python, but I don't think it is very useful to do in an automated way because the aspect ratio of the plot will probably be poor and you cannot control it in a script.  At any rate, for reference here is Python that would save the image

from chimerax.core.commands import run
plot = run(session, 'crosslinks histo #1.1')
plot.save_plot('histogram.png')

This will need a September 9, 2022 or newer daily build because I just made the "crosslinks histogram" command return the plot, before it did not return it.

  The figures in the paper were made interactively in ChimeraX on a high resolution display and just a screen capture was used to save an image.  Although as Elaine notes the right-click context menu on those plot windows has a "Save Plot As..." menu entry that will save at 300 dots per inch resolution.

	Tom

Example histogram of hydrogen bond lengths for pdb 7qfc saved with the context menu entry "Save Plot As..."



> On Sep 8, 2022, at 9:10 AM, Elaine Meng via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> Hello,
> The main advantage of these plots inside ChimeraX is that they are interactive with the 3D structure (e.g. you click something on the plot, it does something in the 3D window).  They weren't meant for making figures for hundreds of molecules in scripts.   
> 
> So, there are no options to customize plot appearance, and the only way to save the histogram currently is by interactively using the context menu on that window, as mentioned in the help:
> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/crosslinks.html#histogram>
> 
> If you wanted to make your own plots with everything about the appearance customized, currently you would have to write python scripts to dump the data and then use your own favorite plotting program to generate images.
> Best,
> Elaine
> -----
> Elaine C. Meng, Ph.D.                       
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
> 
> 
>> On Sep 8, 2022, at 1:40 AM, Enrico Martinez via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>> 
>> Thanks a lot, Elaine!
>> Actually crosslink hist #1 works very well!
>> Could you please specify would it be possible to plot the histogram
>> (using batch chimera-x execution) or alternatively add it directly to
>> the produced png image?
>> I did not find any possibility to save the plot or to customize its
>> appearance (color of the bars etc).
>> Cheers
>> Enrico
>> 
>> Il giorno mer 7 set 2022 alle ore 17:52 Elaine Meng
>> <meng at cgl.ucsf.edu> ha scritto:
>>> 
>>> Hello!
>>> The chain contacts diagram shown in Fig 4b is made with the "interfaces" command.  Then you can use context menu on that contacts diagram to make the interface-residue plot in Fig 4d.  Please see the "interfaces" help for details on both of those.
>>> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/interfaces.html>
>>> 
>>> The histogram plot in Fig 5b  is made with the command "crosslinks histogram" but first you have to have some crosslinks, or other pseudobonds such as from finding H-bonds or contacts.  Then in the "crosslinks histogram" command you specify the pseudobond model to plot their distances.  See "crosslinks histogram" help:
>>> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/crosslinks.html#histogram>
>>> 
>>> Also for a more detailed example see the "Interactive H-bond Histogram" feature highlight, which includes a script (.cxc file):
>>> <https://www.rbvi.ucsf.edu/chimerax/features.html#hbond-histogram>
>>> 
>>> I hope this helps,
>>> Elaine
>>> -----
>>> Elaine C. Meng, Ph.D.
>>> UCSF Chimera(X) team
>>> Department of Pharmaceutical Chemistry
>>> University of California, San Francisco
>>> 
>>> 
>>>> On Sep 7, 2022, at 2:18 AM, Enrico Martinez via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>>>> 
>>>> Dear ChimeraX users!
>>>> I am dealing with the analysis of protein-ligand interactions in a
>>>> single PDB structure. I am looking for any tools implemented in
>>>> Chimera-X, which could be used to analyse the interactions (besides
>>>> the hbond and contact tools giving info in the log files).
>>>> I wonder to know which commands and corresponded ChimeraX tools could
>>>> be used to produce the 2D contact diagrams shown on the Fig.4 as well
>>>> as python graphs demonstrated on the Fig.5 in the Chimera-X article:
>>>> https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5734306/
>>>> 
>>>> Many thanks in advance!
>>>> Cheers
>>>> Enrico
> 
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220908/ebba4507/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: histogram.png
Type: image/png
Size: 59709 bytes
Desc: not available
URL: <http://www.rbvi.ucsf.edu/pipermail/chimerax-users/attachments/20220908/ebba4507/attachment-0001.png>


More information about the ChimeraX-users mailing list