Selecting the N or C-terminus of every chain in a PDB file

Hi everyone! I could not figure this one out just yet, but it might be easy (?): I am interested to make a quick selection that targets the first or last atom of all the chains present in a given PDB file. /André Graça

Hi André, As far as I know there is no way to do this with ChimeraX's command-line syntax, so I am going to assume you are asking how to do this in Python. The following Python code will put the starting and ending backbone atom of each chain into a list named 'terminal_atoms': from chimerax.atomic import all_atomic_structures, Residue terminal_atoms = [] for s in all_atomic_structures(session): for chain in s.chains: ordered_bb_names = Residue.aa_min_ordered_backbone_names if chain.polymer_type == Residue.PT_AMINO \ else Residue.na_min_ordered_backbone_names existing_residues = chain.existing_residues terminals = [] for terminal_residue, bb_names in [(existing_residues[0], ordered_bb_names), (existing_residues[-1], reversed(ordered_bb_names))]: for bb_name in bb_names: a = terminal_residue.find_atom(bb_name) if a: terminals.append(a) break else: print("No backbone atoms found in %s; skipping chain" % terminal_residue) break else: terminal_atoms.extend(terminals) For your convenience, I've attached a file containing the above code. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Jun 4, 2024, at 12:02 PM, André Graça via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi everyone!
I could not figure this one out just yet, but it might be easy (?): I am interested to make a quick selection that targets the first or last atom of all the chains present in a given PDB file.
/André Graça _______________________________________________ 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/ <https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/>
participants (2)
-
André Graça
-
Eric Pettersen