Suppress errors when using runscript?

Hi, I wondered if it is possible to suppress/ignore an error message when executing scripts with runscript. Specifically, I have a script to analyze alphafold (3) predictions and select residue interfaces residues using the interface select command. The selection for each of the five model is then saved in a named selection: # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection for the interface residues. name frozen interface_residues$2_model_4 sel This works fine when all models show contacts , however, if one of the models/predictions does not have any residues involved in an interface, the script stops with the error “Nothing is selected by the specifier”. It would be great if the script does not pause at this message. Below the full .cxc script I am using: Best, Matthias # Generate AF contacts for all predictions of an AF3 run # # Usage: # runscript analyse_af3_prediction.cxc <AF_screen_directory> <custom_prediction_name> # The script assumes that five models were generated by AF. It expects the CIF files to be in a sub‐directory # matching the pattern "*model_X*.cif" and the corresponding JSON files in a sub‐directory matching "*data_X*.json" # for each model number X (4, 3, 2, 1, 0). # For the alignment and mseries slider command to work properly, the script assumes no other models are open. echo "Usage: runscript analyse_af3_prediction.cxc <AF_screen_directory> <custom_prediction_name>" ##### Model 4 ##### # Open the structure and its JSON scores for model 4. open $1/*model_4*.cif open $1/*data_4*.json structure last-opened hide show c # Generate AF contacts (using JSON scores) for chain A (or the first chain) alphafold contacts last-opened &/A name model_4_af_contacts_$2 # Create pseudobonds for the contacts and label them with residue names and numbers. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}" # Save the pseudobond representation to a file. save $1/af_contacts_model_4_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_4_$2.txt" # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection for the interface residues. name frozen interface_residues$2_model_4 sel show interface_residues$2_model_4 style interface_residues$2_model_4 ball # Save interface residue info to a file in the input directory. info residues interface_residues$2_model_4 saveFile $1/interface_residues$2_model_4_buriedArea_300.txt # Color the model for clarity. rainbow last-opened chains palette bupu color byhetero echo "Interface residues saved in named selection interface_residues$2_model_4 and info saved to $1/interface_residues$2_model_4_buriedArea_300.txt" ##### Model 3 ##### # Open the structure and its JSON scores for model 3. open $1/*model_3*.cif open $1/*data_3*.json structure last-opened hide show c # Generate AF contacts. alphafold contacts last-opened &/A # Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}" # Save the pseudobond representation. save $1/af_contacts_model_3_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_3_$2.txt" # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection. name frozen interface_residues$2_model_3 sel show interface_residues$2_model_3 style interface_residues$2_model_3 ball # Save interface residue info to a file in the input directory. info residues interface_residues$2_model_3 saveFile $1/interface_residues$2_model_3_buriedArea_300.txt # Color the model. rainbow last-opened chains palette bupu color byhetero echo "Interface residues saved in named selection interface_residues$2_model_3 and info saved to $1/interface_residues$2_model_3_buriedArea_300.txt" ##### Model 2 ##### # Open the structure and its JSON scores for model 2. open $1/*model_2*.cif open $1/*data_2*.json structure last-opened hide show c # Generate AF contacts. alphafold contacts last-opened &/A # Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}" # Save the pseudobond representation. save $1/af_contacts_model_2_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_2_$2.txt" # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection. name frozen interface_residues$2_model_2 sel show interface_residues$2_model_2 style interface_residues$2_model_2 ball # Save interface residue info to a file in the input directory. info residues interface_residues$2_model_2 saveFile $1/interface_residues$2_model_2_buriedArea_300.txt # Color the model. rainbow last-opened chains palette bupu color byhetero echo "Interface residues saved in named selection interface_residues$2_model_2 and info saved to $1/interface_residues$2_model_2_buriedArea_300.txt" ##### Model 1 ##### # Open the structure and its JSON scores for model 1. open $1/*model_1*.cif open $1/*data_1*.json structure last-opened hide show c # Generate AF contacts. alphafold contacts last-opened &/A # Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}" # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection. name frozen interface_residues$2_model_1 sel show interface_residues$2_model_1 style interface_residues$2_model_1 ball # Save interface residue info to a file in the input directory. info residues interface_residues$2_model_1 saveFile $1/interface_residues$2_model_1_buriedArea_300.txt # Color the model. rainbow last-opened chains palette bupu color byhetero echo "Interface residues saved in named selection interface_residues$2_model_1 and info saved to $1/interface_residues$2_model_1_buriedArea_300.txt" ##### Model 0 ##### # Open the structure and its JSON scores for model 0. open $1/*model_0*.cif open $1/*data_0*.json structure last-opened hide show c # Generate AF contacts. alphafold contacts last-opened &/A # Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}" # Save the pseudobond representation. save $1/af_contacts_model_0_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_0_$2.txt" # Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection. name frozen interface_residues$2_model_0 sel show interface_residues$2_model_0 style interface_residues$2_model_0 ball # Save interface residue info to a file in the input directory. info residues interface_residues$2_model_0 saveFile $1/interface_residues$2_model_0_buriedArea_300.txt # Color the model. rainbow last-opened chains palette bupu color byhetero echo "Interface residues saved in named selection interface_residues$2_model_0 and info saved to $1/interface_residues$2_model_0_buriedArea_300.txt" ##### Final Steps ##### # Move all models (except the last-opened) to a common group (optional) mm #*&~last-opened&/A to last-opened&/A # Create an mseries slider for the five models. mseries slider #1-5 title $2 name $2_slider mseries #1-5 echo "Use the slider to go through the models!" echo "Pairwise contacts (based on the JSON fle) and all residues involved in an interface (based on a buried surface are of 300 Angstrom or more) have been saved in the input folder for each prediction" echo "You might want to increase stringency by calcualting the overlap between all predictions"

Hi Matthias, I have changed the behavior of “name frozen” so that if it is running in a script, it only issues a warning instead of an error. That will be in tomorrow’s daily build. --Eric Eric Pettersen UCSF Computer Graphics Lab
On Feb 3, 2025, at 7:15 AM, Vorländer,Matthias Kopano via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi,
I wondered if it is possible to suppress/ignore an error message when executing scripts with runscript. Specifically, I have a script to analyze alphafold (3) predictions and select residue interfaces residues using the interface select command. The selection for each of the five model is then saved in a named selection:
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true # Create a named selection for the interface residues. name frozen interface_residues$2_model_4 sel
This works fine when all models show contacts , however, if one of the models/predictions does not have any residues involved in an interface, the script stops with the error “Nothing is selected by the specifier”. It would be great if the script does not pause at this message.
Below the full .cxc script I am using:
Best, Matthias
# Generate AF contacts for all predictions of an AF3 run # # Usage: # runscript analyse_af3_prediction.cxc <AF_screen_directory> <custom_prediction_name>
# The script assumes that five models were generated by AF. It expects the CIF files to be in a sub‐directory # matching the pattern "*model_X*.cif" and the corresponding JSON files in a sub‐directory matching "*data_X*.json" # for each model number X (4, 3, 2, 1, 0). # For the alignment and mseries slider command to work properly, the script assumes no other models are open.
echo "Usage: runscript analyse_af3_prediction.cxc <AF_screen_directory> <custom_prediction_name>"
##### Model 4 #####
# Open the structure and its JSON scores for model 4. open $1/*model_4*.cif open $1/*data_4*.json structure last-opened hide show c # Generate AF contacts (using JSON scores) for chain A (or the first chain) alphafold contacts last-opened &/A name model_4_af_contacts_$2
# Create pseudobonds for the contacts and label them with residue names and numbers. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}"
# Save the pseudobond representation to a file. save $1/af_contacts_model_4_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_4_$2.txt"
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true
# Create a named selection for the interface residues. name frozen interface_residues$2_model_4 sel show interface_residues$2_model_4 style interface_residues$2_model_4 ball
# Save interface residue info to a file in the input directory. info residues interface_residues$2_model_4 saveFile $1/interface_residues$2_model_4_buriedArea_300.txt
# Color the model for clarity. rainbow last-opened chains palette bupu color byhetero
echo "Interface residues saved in named selection interface_residues$2_model_4 and info saved to $1/interface_residues$2_model_4_buriedArea_300.txt"
##### Model 3 ##### # Open the structure and its JSON scores for model 3. open $1/*model_3*.cif open $1/*data_3*.json structure last-opened
hide show c # Generate AF contacts. alphafold contacts last-opened &/A
# Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}"
# Save the pseudobond representation. save $1/af_contacts_model_3_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_3_$2.txt"
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true
# Create a named selection. name frozen interface_residues$2_model_3 sel show interface_residues$2_model_3 style interface_residues$2_model_3 ball
# Save interface residue info to a file in the input directory. info residues interface_residues$2_model_3 saveFile $1/interface_residues$2_model_3_buriedArea_300.txt
# Color the model. rainbow last-opened chains palette bupu color byhetero
echo "Interface residues saved in named selection interface_residues$2_model_3 and info saved to $1/interface_residues$2_model_3_buriedArea_300.txt"
##### Model 2 ##### # Open the structure and its JSON scores for model 2. open $1/*model_2*.cif open $1/*data_2*.json structure last-opened hide show c
# Generate AF contacts. alphafold contacts last-opened &/A
# Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}"
# Save the pseudobond representation. save $1/af_contacts_model_2_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_2_$2.txt"
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true
# Create a named selection. name frozen interface_residues$2_model_2 sel show interface_residues$2_model_2 style interface_residues$2_model_2 ball
# Save interface residue info to a file in the input directory. info residues interface_residues$2_model_2 saveFile $1/interface_residues$2_model_2_buriedArea_300.txt
# Color the model. rainbow last-opened chains palette bupu color byhetero
echo "Interface residues saved in named selection interface_residues$2_model_2 and info saved to $1/interface_residues$2_model_2_buriedArea_300.txt"
##### Model 1 ##### # Open the structure and its JSON scores for model 1. open $1/*model_1*.cif open $1/*data_1*.json structure last-opened hide show c
# Generate AF contacts. alphafold contacts last-opened &/A
# Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}"
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true
# Create a named selection. name frozen interface_residues$2_model_1 sel show interface_residues$2_model_1 style interface_residues$2_model_1 ball
# Save interface residue info to a file in the input directory. info residues interface_residues$2_model_1 saveFile $1/interface_residues$2_model_1_buriedArea_300.txt
# Color the model. rainbow last-opened chains palette bupu color byhetero
echo "Interface residues saved in named selection interface_residues$2_model_1 and info saved to $1/interface_residues$2_model_1_buriedArea_300.txt"
##### Model 0 ##### # Open the structure and its JSON scores for model 0. open $1/*model_0*.cif open $1/*data_0*.json structure last-opened hide show c
# Generate AF contacts. alphafold contacts last-opened &/A
# Create pseudobonds and label them. sel last-opened&pbonds label sel pseudobonds text "{0.atoms[0].residue.name} {0.atoms[0].residue.number} to {0.atoms[1].residue.name} {0.atoms[1].residue.number}"
# Save the pseudobond representation. save $1/af_contacts_model_0_$2.txt format pseudobonds sel true echo "AlphaFold contacts (derived from JSON file) saved to $1/af_contacts_model_0_$2.txt"
# Select interface residues using the interfaces command. interfaces select last-opened&/A contacting last-opened&~/A bothSides true
# Create a named selection. name frozen interface_residues$2_model_0 sel show interface_residues$2_model_0 style interface_residues$2_model_0 ball
# Save interface residue info to a file in the input directory. info residues interface_residues$2_model_0 saveFile $1/interface_residues$2_model_0_buriedArea_300.txt
# Color the model. rainbow last-opened chains palette bupu color byhetero
echo "Interface residues saved in named selection interface_residues$2_model_0 and info saved to $1/interface_residues$2_model_0_buriedArea_300.txt"
##### Final Steps ##### # Move all models (except the last-opened) to a common group (optional) mm #*&~last-opened&/A to last-opened&/A
# Create an mseries slider for the five models. mseries slider #1-5 title $2 name $2_slider mseries #1-5
echo "Use the slider to go through the models!" echo "Pairwise contacts (based on the JSON fle) and all residues involved in an interface (based on a buried surface are of 300 Angstrom or more) have been saved in the input folder for each prediction" echo "You might want to increase stringency by calcualting the overlap between all predictions" _______________________________________________ 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/
participants (2)
-
Eric Pettersen
-
Vorländer,Matthias Kopano