How to save the AlphaFold PAE plot as an image in ChimeraX using command line ?
1
0
Entering edit mode
12 days ago
Picasa ▴ 680

Hi,

I am using ChimeraX to visualize AlphaFold models and display the PAE plot with:

alphafold pae #1 /path/to/confidences.json

I would like to save only the PAE plot (not the 3D structure view) as a .png or .pdf file. I have 50 simulations so I am looking an efficient way (by command line) to do this.

What is the correct command to save the PAE plot image in ChimeraX ?

Thanks a lot!

PAE ChimeraX AlphaFold • 409 views
ADD COMMENT
1
Entering edit mode
10 days ago
LauferVA 4.7k

First, to all, see also the main thread & comments section of this related post: How to keep the same view for different AlphaFold 3 simulations in ChimeraX?.

Hi Picasa

Try this:

import os
import sys

def run(session, pdb_path, pae_path, output_path):
    from chimerax.core.commands import run as cxrun
    from chimerax.alphafold import show_pae_plot

    cxrun(session, f'open {pdb_path}')
    cxrun(session, f'alphafold pae #1 {pae_path}')

    pae_tool = show_pae_plot(session)
    pae_tool.save_image(output_path)

def run_script(session):
    # Entry point for ChimeraX
    # This function is called when using `chimerax --script save_pae_only.py ...`
    import sys
    args = sys.argv[-3:]  # expects last 3 args to be: pdb, pae, output
    run(session, *args)


if __name__ == "__main__":
    # Entry point for regular Python execution (optional but for completeness)
    pdb_path = sys.argv[1]
    pae_path = sys.argv[2]
    output_path = sys.argv[3]

    os.system(f'chimerax --nogui --script "save_pae_only.py {pdb_path} {pae_path} {output_path}"')

This implementation enables you to call it directly with python via:

python save_pae_only.py model1.pdb pae1.json output1.png

or you could also use chimerax like so:

chimerax --nogui save_pae_only.py model1.pdb pae1.json output1.png

If it doesnt work please let me know

ADD COMMENT

Login before adding your answer.

Traffic: 3182 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6