RMSD for all frames in a trajectory

Dear All, I am working with a trajectory of a tetramer. I would like to align the A chains in all frame of the trajectory and then calculate the rmsd of all chains in all frames relative to the respective chain of the first frame (i.e., align only chains A but calculate for all chains), and write the results to a text file. Is that possible? I can do a similar calculation with a script in old Chimera but don’t know how to do it in ChimeraX. I attach the zipped script for old Chimera. Best regards Sasha

Hi Sasha, I think this will be slightly easier in ChimeraX. My approach would be to open a structure of just the first frame (for use in aligning) as model 1, and open the trajectory as model 2. There are commands for aligning the structures ("align"), changing to a specific frame ("coordset"), and finding the RMSD values ("rmsd"). The code/pseudocode for the script would be: from chimerax.atomic import all_atomic_structures for s in all_atomic_structures(session): if s.num_coordsets == 1: ref = s else: traj = s from chimerax.core.commands import run for cs_id in traj.coordset_ids: run(session, f"coordset {traj.atomspec} {cs_id}") run(session, f"align {traj.atomspec}/A to {ref.atomspec}/A") # maybe further limited to backbone or CA atoms for chain in ref.chains: rmsd = run(session, f"rmsd {traj.atomspec}/{chain.chain_id} to {ref.atomspec}/{chain.chain_id}") # again, perhaps limited further # code to either output the RMSD to a file now, or save it and output them collectively later If you don't want all the commands the script is running to show up in the Log, you can add "log=False" to the run() calls. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Apr 29, 2025, at 11:21 AM, Alexandra Zahradnikova via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Dear All, I am working with a trajectory of a tetramer. I would like to align the A chains in all frame of the trajectory and then calculate the rmsd of all chains in all frames relative to the respective chain of the first frame (i.e., align only chains A but calculate for all chains), and write the results to a text file. Is that possible? I can do a similar calculation with a script in old Chimera but don’t know how to do it in ChimeraX. I attach the zipped script for old Chimera. Best regards Sasha
<rmsd_trajectory_Calpha_chains.zip>_______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu> To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu <mailto:chimerax-users-leave@cgl.ucsf.edu> Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/

Hi Eric Thanks for help, the script works for me nicely. Would it be possible to make a similar script to calculate RMSF along the chain for a trajectory? Currently I do it by saving the trajectory as a pdb with all submodes, reopening the pdb, and applying the commands Sequence associate /L, where L is the name of the analyzed chain; Headers→Cα RMSD; Headers→Save. It would be more practical without the necessity to save this large file. Best Sasha From: Eric Pettersen [mailto:pett@cgl.ucsf.edu] Sent: Tuesday, April 29, 2025 10:42 PM To: Alexandra Zahradnikova Cc: chimerax-users@cgl.ucsf.edu Subject: Re: [chimerax-users] RMSD for all frames in a trajectory Hi Sasha, I think this will be slightly easier in ChimeraX. My approach would be to open a structure of just the first frame (for use in aligning) as model 1, and open the trajectory as model 2. There are commands for aligning the structures ("align"), changing to a specific frame ("coordset"), and finding the RMSD values ("rmsd"). The code/pseudocode for the script would be: from chimerax.atomic import all_atomic_structures for s in all_atomic_structures(session): if s.num_coordsets == 1: ref = s else: traj = s from chimerax.core.commands import run for cs_id in traj.coordset_ids: run(session, f"coordset {traj.atomspec} {cs_id}") run(session, f"align {traj.atomspec}/A to {ref.atomspec}/A") # maybe further limited to backbone or CA atoms for chain in ref.chains: rmsd = run(session, f"rmsd {traj.atomspec}/{chain.chain_id} to {ref.atomspec}/{chain.chain_id}") # again, perhaps limited further # code to either output the RMSD to a file now, or save it and output them collectively later If you don't want all the commands the script is running to show up in the Log, you can add "log=False" to the run() calls. --Eric Eric Pettersen UCSF Computer Graphics Lab On Apr 29, 2025, at 11:21 AM, Alexandra Zahradnikova via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote: Dear All, I am working with a trajectory of a tetramer. I would like to align the A chains in all frame of the trajectory and then calculate the rmsd of all chains in all frames relative to the respective chain of the first frame (i.e., align only chains A but calculate for all chains), and write the results to a text file. Is that possible? I can do a similar calculation with a script in old Chimera but don’t know how to do it in ChimeraX. I attach the zipped script for old Chimera. Best regards Sasha <rmsd_trajectory_Calpha_chains.zip>_______________________________________________ ChimeraX-users mailing list -- <mailto:chimerax-users@cgl.ucsf.edu> chimerax-users@cgl.ucsf.edu To unsubscribe send an email to <mailto:chimerax-users-leave@cgl.ucsf.edu> chimerax-users-leave@cgl.ucsf.edu Archives: <https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/> https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
Alexandra Zahradnikova
-
Eric Pettersen