Hi Daniel, I'm going to assume that in any particular chain there is only one domain you need to maintain the positioning of, because if there are more than one then straightening the loop between them is going to move them apart and there is no way to keep both domains in the correct relative positioning to the rest of the structure. You could do it the way you propose, by doing a transformation afterward to reposition the important domain, but I would suggest instead straightening the loop so that the part away from the important domain moves, and the important domain stays put. So instead of having a "move_smaller" argument to your command, I would have an argument that says to move the N-terminal or C-terminal side. If you were feeling fancy, the argument could be the domain that should stay put and the command would figure if that was the N- or C-terminal side of the loop. Now, the set_phi/psi/omega calls only have a "move_smaller" argument, so your command would need to figure out if the N- or C- side was smaller and provide the corresponding move_smaller argument. To do that you need find the residue's phi/psi/omega bond by looking through residue.atoms for one of the appropriate atoms and looking through that atom's bonds for the correct other atom (N-CA / CA-C / C-N). That bond's smaller_side property will tell you which endpoint atom is on the smaller side. A couple of tips. 1) Instead of looping through residue.atoms to find an atom with a particular name, you can use residue.find_atom(name) to get the atom. 2) atom.bonds and atom.neighbors are laid out in the same order, so if you use "for i, nb in enumerate(atom.neighbors):" to loop through the neighbor atoms, when you find the right one then atom.bonds[I] will give the corresponding bond. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Dec 18, 2024, at 11:31 AM, Daniel Elnatan via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi folks,
I’ve been playing around with AlphaFold to get protein structures and visualizing them in ChimeraX. For some proteins with a lots of disordered regions (e.g. between non-interacting, well-folded domains), the ‘noodles’ end up being a visual clutter. So I wrote a custom python function to be used in ChimeraX that would ‘straighten’ or stretch selected residues (typically the disordered or low pLDDT regions) by simply assigning torsion angles for a more ‘straight’ structure. I do this via the `Residue.set_phi()` and `Residue.set_psi()` methods. Here’s a link to my Python script: https://github.com/delnatan/colabfold_chunker_utils/blob/65f2419425de300df56...
The command is run simply with `straighten #1:13-20`.
Now when there are multiple chains within the same model, altering the torsion angles may actually move the relative positioning between the chains. Is there an easy way to avoid this? perhaps by passing an extra argument as ‘reference’ so one can place the structure back to its original coordinate for the reference residues. I’m not too familiar with the programming API just yet, but what is the correct way to do this? Maybe that the reference coordinates can be saved before assigning the torsion angles, and a transformation matrix can be computed only for the reference region between the original and moved structure. The altered chain can then be moved back by applying this transformation matrix?
Thanks! -Daniel _______________________________________________ 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/