From: Ryan Woltz (rlwoltz_at_ucdavis.edu)
Date: Thu May 02 2024 - 21:30:39 CDT

Dear all,

    I hope I can explain this problem correctly but the solution is to save
the atoms of a PDB in a new order. For example my protein is loaded chain A
then chain C then chain B and I would like to save chain A then chain B
then chain C. I'm sure I could do this with python or bash but I'm doing a
lot of changes to the protein while it is loaded and would like to not do
another script in case it breaks everything.

         Here is my problem overall. I have a series of models from
alphafold with multiple chains (A B C D). This is in the C4 symmetry
(cyclic). I'm trying to analyze the structures and compare them all but
because AF has random chain assignments or is inconsistent the order going
clockwise might be A -> D -> C -> B. in this scenario I need to switch
chains B and D. I have built a script to do distance measurement to figure
out the relative order (ADCB) and which the chain names of D and B. The
problem is when I save the pdb the atom numbers for the pdb is still out of
order and when I'm trying to load the models as a trajectory it loads the
first structure then every model after line by line. This means in the
trajectory chain B is still labeled as chain D because it starts at line
3000 of the pdb. This is assuming that chains A gor from 1-1000 chain B
should go from lines 1000-2000 so on and so forth. When I pull up each pdb
individually the naming is correct so this ordering problem is just for
loading the pdbs as a trajectory.

in short how can I make sure chain B is always saved after chain A, chain C
is after chain D and chain D is last in the pdb if they were not loaded in
this order? I tried selections in various order to save for example:

animate write pdb test.pdb sel [atomselect 0 "chain A B C D"]

vs

animate write pdb test.pdb sel [atomselect 0 "chain D B C A"]

but it always saves the chains in the order it was loaded.

should I just reorder the pdb with a python script or something outside vmd?

Thank you and sorry for a confusing explanation of the problem.

Ryan