
In my opinion, it would be very difficult to fully automate morphing many sets of structures when you don't know what or how many chains they contain. Typically you have to just look at them yourself interactively to see which chains they have, and which chains should be paired with which. Theoretically a script could do all the things your own brain would do to evaluate that, but I couldn't write it. Also then you would have an AI (ha ha). Elaine
On Apr 30, 2025, at 2:47 AM, Enrico Martinez via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Thank you very much Eric !
I fixed the first script - it produces the equal number of chains in both models but of course if the actual chains are different the morphing is not correct..maybe there is a more trivial way to prepare the both structures for morphing unlike what I am doing ?
Yours with thanks
Enrico
Il giorno mar 29 apr 2025 alle ore 19:31 Eric Pettersen <pett@cgl.ucsf.edu> ha scritto: Hi Enrico, The problem with your first script is that you are using the wrong set operator. You want to delete chains that are in one structure but not both (the '^' operator), but you are subtracting the chains in one structure from the other ('-') which is only half of the chains you need to delete. So, "unmatched = chains1 - chains2" would instead need to be "unmatched = chains1 ^ chains2". As for your second approach, you are checking the RMSD of the first N carbon alphas (N = shorter chain length), which aren't necessarily the atoms matchmaker used. The matchmaker command returns information about which chains it matched and how, as per: https://github.com/RBVI/ChimeraX/blob/a16ed098a17ab4d20c674cd15867fd3e908205....
--Eric
On Apr 29, 2025, at 1:00 AM, Enrico Martinez <jmsstarlight@gmail.com> wrote:
Hi Eric ! Sorry I forgot to copy the executing line. Basically, this script just compare chain IDs and remove unmatched cases which is abit trivial
chains1 = {chain.chain_id for chain in m1.chains} chains2 = {chain.chain_id for chain in m2.chains}
unmatched = chains1 - chains2
In my next version I tried to use matchmaker to compare the structures and remove unmatched chains using the rmsd threshold > 5 A (I calculate rmsd using return np.sqrt(np.mean(np.sum(diff * diff, axis=1)))
I tested it using several pdb pairs but it always entirely removes the second model ..
Many thanks in advance !
Enrico
Il giorno lun 28 apr 2025 alle ore 21:17 Eric Pettersen <pett@cgl.ucsf.edu> ha scritto: Hi Enrico, Your script seems to define a function without actually calling it. You would need a “delete_unmatched_chains(session)” at the end of the script for it to actually do anything.
--Eric
Eric Pettersen UCSF Computer Graphics Lab
On Apr 26, 2025, at 1:57 AM, Enrico Martinez via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Dear ChimeraX Users, I am trying to perform a morphing between two cryo-EM structures of the same complex, where one structure has twice the number of chains as the other (PDBs 3J9K and 8Y6Q). However, the larger structure causes an error during morphing. I have attempted to write a script that aligns the two structures and deletes the unmatched chains from the larger structure. Unfortunately, the script is not working as expected.
from chimerax.core.commands import run
def delete_unmatched_chains(session): # Get models #1 and #2 m1 = next((m for m in session.models if m.id == (1,)), None) m2 = next((m for m in session.models if m.id == (2,)), None)
if m1 is None or m2 is None: session.logger.info("Model #1 or #2 not found.") return
chains1 = {chain.chain_id for chain in m1.chains} chains2 = {chain.chain_id for chain in m2.chains}
unmatched = chains1 - chains2
if unmatched: chain_ids = ",".join(unmatched) # Deleting unmatched chains run(session, f"delete /{chain_ids}") session.logger.info(f"Deleted chains: {', '.join(unmatched)}") else: session.logger.info("No unmatched chains found.")
Could you please help me or alternatively propose another solution? Any suggestions would be greatly appreciated. Thank you in advance !
Enrico _______________________________________________ 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/
<match_delete.py>
_______________________________________________ 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/