Thank you very much, Elaine. I'll take a look at the "contacts" info.

Regarding the first and last residue, I can see how that works for a residue range, e.g. from residue 45 to the end, but in my particular case, I wish to only show the singular first and last residues in a chain (e.g. I show a chain as Calphas in stick, and the first and last residues at spheres), without any specification or a range, and it doesn't work for that (or I cannot figure out the code from the weblink you sent). Just for feedback. No worries that it cannot do it.

Cheers, Paul

Paul Miller (he/him), PhD
Associate Professor 
Department of Pharmacology
University of Cambridge
Tennis Court Road
Cambridge
CB2 1PD
https://www.phar.cam.ac.uk/research/miller

From: Elaine Meng <meng@cgl.ucsf.edu>
Sent: 25 November 2024 17:03
To: Paul Miller <pm676@cam.ac.uk>
Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] Closest distance list between residues/atoms; And selecting first/last residue in a chain
 
Hi Paul,
The "Clashes" or "Contacts" tool (or "clashes" or "contacts" commands) all have an option to write output to a file or to the Log.  I believe it is in order of greatest to least VDW overlap, but there is a center-to-center distance column as well that you could then sort by (e.g. if you wrote an output file).  These also have an option to use center-to-center distance as the main criterion and ignore VDW overlap, and that would give results  in order of distance.
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Ftools%2Fclashes.html&data=05%7C02%7Cpm676%40universityofcambridgecloud.onmicrosoft.com%7C09029466a27a45e2d9ed08dd0d73399e%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638681510790334462%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eHTISaGrW7jjF3WYLxC7pE1HbUmUA0j%2BNdGEZXH6IR8%3D&reserved=0>
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Fcommands%2Fclashes.html&data=05%7C02%7Cpm676%40universityofcambridgecloud.onmicrosoft.com%7C09029466a27a45e2d9ed08dd0d73399e%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638681510790351462%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=cTsHTJpUi6eoGxvv90UuEJITBJXrXmd4pSy0n%2BIRdgk%3D&reserved=0>

No, the above do not say what kind of interaction is involved.  You would have to use your own chemical knowledge of atom types to tell (and also distinguish them from overly close, unfavorable "clashes" ... although that is what the VDW overlap value is meant to tell you in the first place).

If you use "H-Bonds" tool (command "hbonds") there are similar output options, except all of the lines are H-bonds.  They also have an option to find only salt bridges (H-bonds that are also salt bridges).
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Ftools%2Fhbonds.html&data=05%7C02%7Cpm676%40universityofcambridgecloud.onmicrosoft.com%7C09029466a27a45e2d9ed08dd0d73399e%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638681510790363148%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=qMECjtFOUIxObclOCgrydbgSlBTH0xgdqebVnsvEFVw%3D&reserved=0>
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Fcommands%2Fhbonds.html&data=05%7C02%7Cpm676%40universityofcambridgecloud.onmicrosoft.com%7C09029466a27a45e2d9ed08dd0d73399e%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638681510790374102%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=gqyHeT1mdphetjemjksnbdr4CfXQzNeKw8IiOzf71W4%3D&reserved=0>

For start/end, you can use the words "start" and "end" as explained in the atomspec documentation:
<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Frbvi.ucsf.edu%2Fchimerax%2Fdocs%2Fuser%2Fcommands%2Fatomspec.html%23lists&data=05%7C02%7Cpm676%40universityofcambridgecloud.onmicrosoft.com%7C09029466a27a45e2d9ed08dd0d73399e%7C49a50445bdfa4b79ade3547b4f3986e9%7C1%7C0%7C638681510790384815%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ZOSwa8YqRMqlZwu00FDQbQtRpBO0tjBjP95zVa5WyJM%3D&reserved=0>

I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.                      
UCSF Chimera(X) team
Resource for Biocomputing, Visualization, and Informatics
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Nov 25, 2024, at 1:19 AM, Paul Miller via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
>
> Hi
>
> Is there a way by command line to generate a list of residue to residue (or atom to atom) distances ranked by closest to furthest, for say, all residues within 4A of each other at an interface between two protein chains? Can it also state the type of interaction, e.g. salt bridge, H-bond, vdW?
>
> Also, completely separately, is there a way by command line to select the first and last residue in a chain (without having to find their number)?
>
> No worries if not. Thanks so much!
>
> Cheers, Paul