Thanks Eric,

I wrote a script to do an absurd Nth criteria (10,000) and grepped the error output which notes how many rotamers each residue has.

# cxc purposefully generate errors
open $1
swapaa #!1$i same criteria 10000 rotLib Dunbrack retain true
exit" > GenerateRotamers1.cxc


# Route the errors to a text file
chimerax --nogui GenerateRotamers1.cxc >> GenerateRotamers1.log 2>>GenerateRotamers1.err

# Grep the errors
grep "chimerax.core.errors.UserError:" GenerateRotamers1.err | awk '{print $8,$3}' > Rotamer#s.txt

# Go through the rotamer#s.txt and create all the rotamers.
while read -r resid rotamers; do
        # Generate a comma-separated list of numbers from 1 to $rotamers
    criteria=$(seq -s, 1 $rotamers)
    echo "
open $1
swapaa #!1:$resid same criteria $criteria rotLib Dunbrack retain true
sel #1:$resid
sel ~sel
del sel
save resid_$resid.pdb
exit
    " > GenerateRotamers2.cxc




From: Eric Pettersen <pett@cgl.ucsf.edu>
Sent: Thursday, September 5, 2024 6:38 PM
To: Alexander Lee <Alex.H.Lee@outlook.com>
Cc: chimerax-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu>
Subject: Re: [chimerax-users] Select multiple rotamer conformations for a single amino acid
 
Hi Alex,
The Rotamers tool logged a swapaa command when you did that, and that command does indeed do the same thing as the tool.  The critical command argument in this case is “criteria” followed by a comma-separated list of integers.  Criteria is documented to either be a string indicating how to “tie break” rotamers (density fit, clash score, # H-bonds, or highest prevalence) or an integer indicating that the Nth highest-prevalence rotamer should be used.  What isn’t documented is that it can also be a comma-separated list of integers, in which case the corresponding rotamers will be added as alt locs.  It probably didn’t get documented because it seemed to only be useful in the context of the tool, because there is no easy way of knowing how many rotamers there are for a particular residue-type / backbone-configuration combo.  Nonetheless, I guess it would be safe to just use the top two (or possibly three) rotamers outside the context of the tool.
We will be documenting this additional criteria mode.

--Eric

Eric Pettersen
UCSF Computer Graphics Lab


On Sep 5, 2024, at 1:35 PM, Alexander Lee via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Hi! I was able to select and use multiple rotamer conformations simultaneously for a single amino acid using the Rotamers tool, saved as alternate locations within a pdb file. Is there a way to do that using swapaa or from the command line?
_______________________________________________
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/