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
- Setup: make a model folder with your
.cifs
; make a view camera.
- Choose one as your reference structure (e.g. from
seed-1
)
- Align all other AlphaFold
.cif
models to this reference
- 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 |
Labels the model reference for clarity |
open seed-2_sample-1.cif |
Loads another AlphaFold model |
match |
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
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?
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:
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.
would you mind posting this as a separate question, then linking to this question and @ me?