saving a multi-model pdb with the subset of frames
Dear Chimera-X users! I am dealing with the visualization of a trajectory provided as the multi-model pdb contanained 3000 frames in multi-model format. How can I extract every 5th frame from a multi-model PDB file and save the reduced set of frames into a new PDB file, such that the new file contains five times fewer frames ? I've tried to do it like I did with the netcdf files but it does not work open ./my.pdb structureModel #1 step 5 Many thanks in advance Enriico
Hi Enrico, ChimeraX's PDB reader has no ability to skip MODELs in a multi-MODEL file. So you would have to read the entire file into ChimeraX, but then with the help of a small bit of Python code you could write out your reduced PDB file. The procedure would be: 1) Open the 3000-MODEL PDB file. 2) Run the following Python code: s = session.models[0] import numpy s.add_coordsets(numpy.array([s.coordset(i).xyzs for i in s.coordset_ids[::5]])) You would put the above code (but not indented) into a file with a ".py" suffix and open it in ChimeraX to run it. 3) Use the "save" command (with "allCoordsets true") to save the resulting 600-MODEL PDB file. For convenience, I've attached a file with the Python code in it. --Eric Eric Pettersen UCSF Computer Graphics Lab 
On Oct 5, 2024, at 6:02 AM, Enrico Martinez via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Dear Chimera-X users!
I am dealing with the visualization of a trajectory provided as the multi-model pdb contanained 3000 frames in multi-model format.
How can I extract every 5th frame from a multi-model PDB file and save the reduced set of frames into a new PDB file, such that the new file contains five times fewer frames ?
I've tried to do it like I did with the netcdf files but it does not work open ./my.pdb structureModel #1 step 5
Many thanks in advance
Enriico _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
Thank you very much Eric ! I've just sent you another question about a smooth script :-) Yours sincerely Enrico Il giorno mer 9 ott 2024 alle ore 02:47 Eric Pettersen <pett@cgl.ucsf.edu> ha scritto:
Hi Enrico, ChimeraX's PDB reader has no ability to skip MODELs in a multi-MODEL file. So you would have to read the entire file into ChimeraX, but then with the help of a small bit of Python code you could write out your reduced PDB file. The procedure would be:
1) Open the 3000-MODEL PDB file.
2) Run the following Python code:
s = session.models[0] import numpy s.add_coordsets(numpy.array([s.coordset(i).xyzs for i in s.coordset_ids[::5]]))
You would put the above code (but *not* indented) into a file with a ".py" suffix and open it in ChimeraX to run it.
3) Use the "save" command (with "allCoordsets true") to save the resulting 600-MODEL PDB file.
For convenience, I've attached a file with the Python code in it.
--Eric
Eric Pettersen UCSF Computer Graphics Lab
On Oct 5, 2024, at 6:02 AM, Enrico Martinez via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Dear Chimera-X users!
I am dealing with the visualization of a trajectory provided as the multi-model pdb contanained 3000 frames in multi-model format.
How can I extract every 5th frame from a multi-model PDB file and save the reduced set of frames into a new PDB file, such that the new file contains five times fewer frames ?
I've tried to do it like I did with the netcdf files but it does not work open ./my.pdb structureModel #1 step 5
Many thanks in advance
Enriico _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/
participants (2)
-
Enrico Martinez
-
Eric Pettersen