How to keep the same view for different AlphaFold 3 simulations in ChimeraX?
2
1
Entering edit mode
15 days ago
Picasa ▴ 680

Hi,

I have several structures from AlphaFold 3 simulations (different seeds), and I usually open the .cif files in ChimeraX to visualize them.

The files are named like: seed-x_sample-y.cif

For one of my simulations, I found a very interesting view. I saved the camera parameters:

view matrix camera 0.81382,-0.55852,0.16049,67.92,-0.41688,-0.3687,0.83082,405.71,-0.40486,-0.74304,-0.53289,-275.37

However, when I open another .cif (from a different seed), the structure is oriented completely differently — so applying this view matrix gives me a totally different result.

What is the best way to open all my .cif files with the same point of view?

Thanks for your help!

chimerax alphafold 3 • 469 views
ADD COMMENT
3
Entering edit mode
15 days ago
LauferVA 4.7k

Picasa - first, strictly speaking, Mensur Dlakic is correct - there is no built-in, universal coordinate system shared by all structure files. So if you open each .cif file individually and just apply your camera matrix, you’ll get different orientations, as you as you have already observed.

However, there are practical solutions, as he alludes to - open a reference structure first, then align every other structure to that reference before applying your saved camera viewpoint. That step ensures you can view them all from the same perspective.

How to Align Multiple AlphaFold Structures in ChimeraX and Apply a Consistent View

As you've observed, AlphaFold(3)-generated structures often differ in orientation due to random initialization, which makes visual comparison difficult without a method for alignment of them.

Many high-dimensional data spaces that have a now decades-long history with bioinformatics (think: PCA) exhibit a similar issue. While the goals and output of those differ, like with AF3, steps can be taken to rotate/align them to facilitate consistentent viewing.

AlphaFold3 is a protein quaternary structure prediction algorithm that predicts protein structures and can output atomic coordinate. Like with PCA results from old GWAS studies, these structure outputs may be very similar yet difficulty to compare due to being rotated (i.e. the whole structure might be rotated) differently from sim to sim. Below, we explain how to orient many such simulations of structures in relative if not in absolute terms, of course.

Step-by-Step Guide

  1. Setup: make a model folder with your .cifs; make a view camera.
  2. Choose one as your reference structure (e.g. from seed-1)
  3. Align all other AlphaFold .cif models to this reference
  4. Apply a *saved camera view, such that thereafter every structure may be seen from the same perspective

  • Start by heading over to UCSF ChimeraX
  • Organize your .cif files into a folder, say, AlphaFoldCifs, e.g.:
    seed-1_sample-1.cif
    seed-2_sample-1.cif
    seed-3_sample-1.cif
    ...
    
  • Now, make a ChimeraX view camera like this:
    view matrix camera 0.81382,-0.55852,0.16049,67.92,-0.41688,-0.3687,0.83082,405.71,-0.40486,-0.74304,-0.53289,-275.37
    

Step 2: Choose one of your sims and make it a 'Reference Model'

Pick one of your .cif files — I recommend picking the one with the camera view you like best.

Save it as your reference file, e.g.:

cp seed-1_sample-1.cif reference.cif

Step 3: Write a ChimeraX command script

  • Make a file called align_all.cxc this script will:
    • Open the reference structure
    • Open all other structures
    • Align each to the reference
    • Apply your saved view
    • (Optionally) save images or aligned models

Here’s an example align_all.cxc script:

# Load the reference AlphaFold model

open reference.cif
# ChimeraX assigns this model ID #1
rename #1 reference

# Load and align other models
open seed-2_sample-1.cif

rename #2 target_2
match #2 to #1

open seed-3_sample-1.cif
rename #3 target_3
match #3 to #1

# Add as many as you want...

# Apply your saved camera view
view matrix camera 0.81382,-0.55852,0.16049,67.92,-0.41688,-0.3687,0.83082,405.71,-0.40486,-0.74304,-0.53289,-275.37

# Save session or images for later
save session aligned_structures.cxs
save image aligned_view.png width 1920 height 1080 supersample 3

Of course, if you have dozens to hundreds of files, will be easier to do this using a script - let me know if you need pointers there.


Step 4: Run the Script in ChimeraX

Finally, launch ChimeraX and run this script via:

chimerax --nogui align_all.cxc

Or if you want the GUI to open for manual inspection:

chimerax align_all.cxc
Command What It Does
open reference.cif Opens the structure used as alignment and view reference
rename #1 reference Labels the model reference for clarity
open seed-2_sample-1.cif Loads another AlphaFold model
match #2 to #1 Aligns model #2 (target) to the reference structure
view matrix camera ... Sets the camera to a previously saved orientation
save image, save session Optional output commands

Other Tips

Export Aligned Structures or Views - It may also be useful to export aligned structures in .pdb format?

save #2 aligned_seed-2_sample-1.pdb
save #3 aligned_seed-3_sample-1.pdb

Remember - Make sure your view matrix is saved from the reference structure and applied after alignment. You can visualize RMSD using the rmsd #2 to #1 command if interested.


In summary, setting a reference against which to align other simulations is a fairly simple way to allow for visual consistency across different AlphaFold predictions.

Bonus Question: Based on the above, can you write an automatic script generator for a folder full of structures?

ADD COMMENT
0
Entering edit mode

Thanks a lot for your answer !

Not so related but do you know how to export the PAE plot by command line ?

I usually open like this:

alphafold pae #1 file {json_file}

but I have 50 simulations so I am trying to find a way to export the plot in png for all simulations without doing it manually.

ADD REPLY
0
Entering edit mode

would you mind posting this as a separate question, then linking to this question and @ me?

ADD REPLY
1
Entering edit mode
15 days ago
Mensur Dlakic ★ 29k

What is the best way to open all my .cif files with the same point of view?

There is no way to do that, because there is no absolute coordinate system. Each structure will have different relative coordinates, even if all structures are similar to each other.

You can try to open the structure with your preferred camera view, then open the second structure and align them.

ADD COMMENT

Login before adding your answer.

Traffic: 2738 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