Think this might have been a dropbox related issue - here is the script itself (renamed as txt to hopefully avoid being scrubbed - rename to .py before using).
Cheers,
Oli.
On Mon, 16 May 2016 18:56:20 +0000, Kenneth Satyshur <[log in to unmask]> wrote:
>Yes:::
>
>Running python script /home/xray/ccp4/ccp4-7.0/ccp4-7.0/lib/python2.7/site-packages/coot/coot_load_modules.py
>Good Afternoon Satyshur, Welcome to Coot. 0.8.3
>(set-display-intro-string "Good Afternoon Satyshur, Welcome to Coot. 0.8.3")
>Coot Python Scripting GUI code found and loaded.
>Coot Python Scripting GUI code found and loaded.
>(use-graphics-interface-state)
>Running python script /home/satyshur/.coot-preferences/coot_oli_custom.py
>Traceback (most recent call last):
> File "<string>", line 1, in <module>
> File "/home/satyshur/.coot-preferences/coot_oli_custom.py", line 1
> <!DOCTYPE html><html lang="en" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="en" class="media-desktop" xmlns="http://www.w3.org/1999/xhtml"><head><script nonce="MWjlz4nEV4uVkzny8+un">
> ^
>SyntaxError: invalid syntax
>
>I am running this version of python:
>
>Python 2.6.6 (r266:84292, May 22 2015, 08:34:51)
>[GCC 4.4.7 20120313 (Red Hat 4.4.7-15)] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>>
>As per usual, different versions of python don't run other versions. In particular, old versions have different syntax than newer versions.
>kas
>
>
>Kenneth A. Satyshur, M.S., Ph.D.
>Senior Scientist
>University of Wisconsin-Madison
>Madison, Wisconsin, 53706
>608-215-5207
>
>________________________________________
>From: Mailing list for users of COOT Crystallographic Software <[log in to unmask]> on behalf of Oliver Clarke <[log in to unmask]>
>Sent: Monday, May 16, 2016 8:44:51 AM
>To: [log in to unmask]
>Subject: Re: Key binding to toggle modelling toolbar
>
>Dear Jan, the script I use is here: https://www.dropbox.com/s/0b4bebwxw0p9x0e/oli_custom.py?dl=0
>
>Feel free to modify and redistribute as you like.
>
>This script has a lot of custom key bindings defined, and also a "Custom" menu with a bunch of shortcuts for common tasks.
>
>I did actually attempt at one point to start something like what you suggest (http://cootscripts.tiddlyspace.com/), but it never really took off so I stopped updating it (although the link to the script remains current).
>
>Cheers,
>Oli.
>
>On Mon, 16 May 2016 09:14:06 +0200, Jan Stransky <[log in to unmask]> wrote:
>
>>Cool.
>>
>>Oli., you did a lot of interesting work for coot recently. Are your
>>script available somewhere on the web?
>>
>>May be, it would be nice to have some centralized repository of ALL
>>(user-created) coot scripts.
>>
>>Jan
>>
>>On 05/14/2016 01:29 AM, Oliver Clarke wrote:
>>> Hi all,
>>>
>>> I use Coot mostly on a laptop, where screen real estate is a precious commodity, so I wrote this key binding to hide/show the modelling toolbar on the side, thought maybe someone else might find it useful too.
>>>
>>> It assumes that the modelling toolbar is shown at the start of the session.
>>>
>>> Cheers,
>>> Oli
>>>
>>> #Toggle display of modelling toolbar (assumes it is shown by default)
>>> toolbar_toggle_var=1
>>> def toggle_toolbar_display():
>>> global toolbar_toggle_var
>>> if toolbar_toggle_var==0:
>>> hide_modelling_toolbar()
>>> toolbar_toggle_var=1
>>> elif toolbar_toggle_var==1:
>>> show_modelling_toolbar()
>>> toolbar_toggle_var=0
>>> add_key_binding("Toggle toolbar display","H",
>>> lambda: toggle_toolbar_display())
>>
>>--
>>Jan Stransky, PhD student
>>Institute of Biotechnology, CAS
>>Laboratory of structure and function of biomolecules
>>Prumyslova 595
>>Vestec
>>Czech Republic
>>
>>+420325873758
#Oli's Coot customizations:
#Usage: Copy to ~/.coot-preferences
#When Coot is restarted, a new "Custom" menu will appear, with some new shortcuts for various model-building tasks.
#Also there will be a bunch of new keyboard shortcuts - check "Extensions...Settings...Key bindings" for details.
#****Settings****
#Make symmetry copies a brighter color
set_symmetry_colour(255,35,0)
#Consider clashes when autofitting rotamers.
set_auto_fit_best_rotamer_clash_flag(1)
#Increase the default limit for the max number of residues to refine
set_refine_max_residues(100)
#Sets "Backrub" rotamers as default (best at low res)
set_rotamer_search_mode(ROTAMERSEARCHLOWRES)
#Use ramachandran restraints in real space refinement
set_refine_ramachandran_angles(1)
#Use finer map sampling
set_map_sampling_rate(2.0)
#When rendering using raster 3D, make waters spherical rather than cross shaped.
#Would be useful to do this for ions also, but such an option does not exist.
#Also, don't use shadows - they look ugly with density maps.
set_raster3d_water_sphere(1)
set_raster3d_shadows_enabled(0)
#Display probe dots when picking rotamers. Unfortunately they persist after
#rotamer selection - I don't know how to globally undisplay probe dots.
set_do_probe_dots_on_rotamers_and_chis(1)
#Increase number of trials for add terminal residue
set_add_terminal_residue_n_phi_psi_trials(1000)
#change back to old rubber banding behaviour
set_refinement_drag_elasticity(0.5)
#set default refinement weighting for low resolution
set_matrix(20.0)
#Make scrolling faster
set_smooth_scroll_flag(0)
#Update map after dragging - improves speed with large map radius
set_active_map_drag_flag(0)
#set rotation speed for spin
set_idle_function_rotate_angle(1.5)
#Default to not showing environment distances, anf only showing h-bonds if shown
set_show_environment_distances(0)
set_show_environment_distances_bumps(0)
set_show_environment_distances_h_bonds(1)
#Set distance limits for environment distances
set_environment_distances_distance_limits(2.1,3.2)
#Set default map radius
set_map_radius(20)
#Increase default B for new atoms
set_default_temperature_factor_for_new_atoms(50.0)
#Post-refine when adding term res and don't rigid body fit (better for low res)
set_add_terminal_residue_do_post_refine(1)
set_terminal_residue_do_rigid_body_refine(0)
#real spece refine after mutating residue
set_mutate_auto_fit_do_post_refine(1)
#Don't change contour level with scroll wheel (use +/- and shift+1-9 instead)
set_scroll_by_wheel_mouse(0)
#Set symmetry radius to 30 A
set_symmetry_size(30)
#Ignore nomenclature errors
set_nomenclature_errors_on_read("ignore")
#****Keybindings and toolbar buttons****
# Measure distance shortcut
coot_toolbar_button("Measure distance",
"do_distance_define()", icon_name="geom.svg")
#Toggle display of symmetry copies
coot_toolbar_button("Sym?",
"set_show_symmetry_master(not get_show_symmetry())",
icon_name="cell+symm.svg")
#place helix with prosmart alpha helix restraints and depict in rainbow
add_key_binding("Place helix here","h",
lambda: place_helix_with_restraints())
#Toggle display of modelling toolbar (assumes initial state is shown)
add_key_binding("Toggle toolbar display","H",
lambda: toggle_toolbar_display())
#Quicksave active mol (overwrite orig)
add_key_binding("Save and overwrite active model","Q",
lambda: quicksave_active())
#Refine zond (click two atoms)
add_key_binding("Refine zone","A",
lambda: refine_click())
#Bring up place atom at pointer dialog
add_key_binding("Place atom at pointer","P",
lambda: place_atom_at_pointer())
#Flip peptide.
add_key_binding("Flip peptide","q",
lambda: pepflip_active_residue())
#place helix with prosmart alpha helix restraints and depict in rainbow
add_key_binding("Auto refine zone","a",
lambda: auto_refine(10))
#Jiggle fit active res
add_key_binding("Jiggle Fit","J",
lambda: using_active_atom(fit_to_map_by_random_jiggle,"aa_imol","aa_chain_id","aa_res_no","aa_ins_code",1000,0.1))
#Clear pending picks
add_key_binding("Clear Pending Picks","Tab",
lambda: clear_pending_picks())
#Toggle environment distances
add_key_binding("Toggle environment distances","D",
lambda: toggle_env_dist())
#Delete active residue
add_key_binding("Delete this residue","X",
lambda: using_active_atom(delete_residue,"aa_imol","aa_chain_id","aa_res_no","aa_ins_code"))
#Delete sidechain
add_key_binding("Kill Sidechain","K",
lambda: using_active_atom(delete_residue_sidechain,"aa_imol","aa_chain_id","aa_res_no","aa_ins_code",0))
#Fill sidechain
add_key_binding("Fill Sidechain","k",
lambda: using_active_atom(fill_partial_residue,"aa_imol","aa_chain_id","aa_res_no","aa_ins_code"))
#place water without refinement
add_key_binding("Add Water","w",
lambda: place_typed_atom_at_pointer("Water"))
#place water with refinement
add_key_binding("Add Water +","W",
lambda: [place_typed_atom_at_pointer("Water"),refine_active_residue()])
#add terminal residue
add_key_binding("Add terminal residue","y",
lambda: add_term_shortcut())
#add terminal residue
add_key_binding("Add terminal residue (override)","Y",
lambda: add_term_shortcut_force())
#Refine active residue
add_key_binding("Refine Active Residue","r",
lambda: manual_refine_residues(0))
#Undo Symm view
add_key_binding("Undo Symmetry View", "V",
lambda: undo_symmetry_view())
#Cycle through rotamers for active reidue with 'R"
add_key_binding("Cycle rotamers","R",
lambda: cycle_rotamers())
#Undo function for keybinding. Undoes last change to active mol.
add_key_binding("Undo","z",
lambda: undo_visible())
#Redo function for keybinding. Undoes last change to active mol.
add_key_binding("Redo","x",
lambda: redo_visible())
add_key_binding("Cycle representation mode forward","[",
lambda: cycle_rep_up(active_residue()[0],cycle_rep_flag.get(active_residue()[0],0)))
add_key_binding("Cycle representation mode back","]",
lambda: cycle_rep_down(active_residue()[0],cycle_rep_flag.get(active_residue()[0],0)))
add_key_binding("Cycle symm representation mode forward","{",
lambda: cycle_symm_up(active_residue()[0],cycle_symm_flag.get(active_residue()[0],0)))
add_key_binding("Cycle symm representation mode back","}",
lambda: cycle_symm_down(active_residue()[0],cycle_symm_flag.get(active_residue()[0],0)))
add_key_binding("Toggle map display","`",
lambda: toggle_map_display())
add_key_binding("Toggle mol display","/",
lambda: toggle_mol_display())
#Clear distances/labels
add_key_binding("Clear distances and labels","Z",
lambda: clear_distances_and_labels())
#Show local sequence context for active residue
coot_toolbar_button("Sequence context",
"sequence_context()", icon_name="")
#Force accept real space refinemnt
coot_toolbar_button("Accept RSR",
"accept_regularizement()", icon_name="")
#mutate active residue to entered residue code (upper or lower case single-letter)
add_key_binding("Mutate by single letter code","M",
lambda: mutate_by_entered_code())
#Bind next_res() and prev_res() to ">" and "<"
add_key_binding("Next residue in chain",">",
lambda: next_res())
add_key_binding("Prev residue in chain","<",
lambda: prev_res())
#The nine key bindings elow allow easy setting of map
#level by rmsd - shift + any single digit integer
#sets the currently scrollable map to that level
# in rmsd. Useful when on a laptop with touchpad,
#when changing the contour using the scrollwheel is
#not practical and using +/- is too slow.
add_key_binding("Map to 1 sigma","!",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),1))
add_key_binding("Map to 2 sigma","@",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),2))
add_key_binding("Map to 3 sigma","#",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),3))
add_key_binding("Map to 4 sigma","$",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),4))
add_key_binding("Map to 5 sigma","%",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),5))
add_key_binding("Map to 6 sigma","^",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),6))
add_key_binding("Map to 7 sigma","&",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),7))
add_key_binding("Map to 8 sigma","*",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),8))
add_key_binding("Map to 9 sigma","(",
lambda: set_contour_level_in_sigma(scroll_wheel_map(),9))
add_key_binding("Map plus 0.5 sigma","|",
lambda: step_map_coarse_up(scroll_wheel_map()))
add_key_binding("Map minus 0.5 sigma","_",
lambda: step_map_coarse_down(scroll_wheel_map()))
#Undisplay all models except the active one.
#If only one model is displayed, cycle through
#all available models.
add_key_binding("Display only the active model","?",
lambda: display_only_active())
#Undisplay all maps except the active one.
#If only one map is displayed, cycle through
#all available models.
add_key_binding("Display only the active map","~",
lambda: display_only_active_map())
#Go to equivalent residue on ncs master chain
def goto_ncs_master():
mol_id=active_residue()[0]
resno=active_residue()[2]
atom_name=active_residue()[4]
ncs_ch_id=ncs_master_chain_id(mol_id)
set_go_to_atom_chain_residue_atom_name(ncs_ch_id,resno,atom_name)
add_key_binding("Go to NCS master chain","O",
lambda: goto_ncs_master())
#****Misc. functions (for keybindings and scripting****
def display_only_active_map():
active_map=scroll_wheel_map()
if not map_is_displayed(active_map):
set_map_displayed(active_map,1)
displayed_maps_count=0
for map_id in map_molecule_list():
displayed_maps_count=displayed_maps_count+map_is_displayed(map_id)
if (map_is_displayed(map_id)==1) and (map_id!=active_map):
set_map_displayed(map_id,0)
if map_is_displayed(map_id):
displayed_map=map_id
if displayed_maps_count==1:
index_displayed=map_molecule_list().index(active_map)
try:
next_map=map_molecule_list()[index_displayed+1]
except IndexError:
next_map=map_molecule_list()[0]
set_map_displayed(active_map,0)
set_map_displayed(next_map,1)
for map_id in map_molecule_list():
if map_is_displayed(map_id):
set_scrollable_map(map_id)
set_scroll_wheel_map(map_id) #New
def hide_active_mol():
mol_id=active_residue()[0]
set_mol_displayed(mol_id,0)
def display_only_active():
mol_id_active=active_residue()[0]
displayed_mols_count=0
for mol_id in model_molecule_list():
displayed_mols_count=displayed_mols_count+mol_is_displayed(mol_id)
if (mol_is_displayed(mol_id)==1) and (mol_id!=mol_id_active):
set_mol_displayed(mol_id,0)
if mol_is_displayed(mol_id):
displayed_mol=mol_id
if displayed_mols_count==1:
index_displayed=model_molecule_list().index(mol_id_active)
try:
next_mol=model_molecule_list()[index_displayed+1]
except IndexError:
next_mol=model_molecule_list()[0]
set_mol_displayed(displayed_mol,0)
set_mol_displayed(next_mol,1)
def step_map_coarse_up(mol_id):
current_level=get_contour_level_in_sigma(mol_id)
if (current_level >= 0.5) and (current_level <= 10.0):
new_level=current_level+0.5
elif (current_level<0.5):
new_level=0.5
elif (current_level>10.0):
new_level=10.0
set_contour_level_in_sigma(mol_id,new_level)
def step_map_coarse_down(mol_id):
current_level=get_contour_level_in_sigma(mol_id)
if (current_level >= 0.5) and (current_level <= 10.0):
new_level=current_level-0.5
elif (current_level<0.5):
new_level=0.5
elif (current_level>10.0):
new_level=10.0
set_contour_level_in_sigma(mol_id,new_level)
#Go to next residue in current polymer chain.
def next_res():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
sn=sn_of_active_res()
next_sn=sn+1
next_res=seqnum_from_serial_number(mol_id,"%s"%(ch_id),next_sn)
if (next_res!=-10000 and is_protein_chain_p(mol_id,ch_id)==1):
set_go_to_atom_chain_residue_atom_name(ch_id,next_res,"CA")
elif (next_res!=-10000 and is_nucleotide_chain_p(mol_id,ch_id)==1):
set_go_to_atom_chain_residue_atom_name(ch_id,next_res,"P")
#Go to previous residue in current polymer chain.
def prev_res():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
sn=sn_of_active_res()
if (sn>=1):
sn=sn-1
prev_res=seqnum_from_serial_number(mol_id,"%s"%(ch_id),sn)
if (prev_res!=-10000 and is_protein_chain_p(mol_id,ch_id)==1):
set_go_to_atom_chain_residue_atom_name(ch_id,prev_res,"CA")
elif (prev_res!=-10000 and is_nucleotide_chain_p(mol_id,ch_id)==1):
set_go_to_atom_chain_residue_atom_name(ch_id,prev_res,"P")
def mutate_by_entered_code():
def mutate_single_letter(X):
entry=str(X).upper()
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resno=active_residue()[2]
ins_code=active_residue()[3]
resname=residue_name(mol_id,ch_id,resno,ins_code)
map_id=imol_refinement_map()
aa_dic={'A':'ALA','R':'ARG','N':'ASN','D':'ASP','C':'CYS','E':'GLU','Q':'GLN','G':'GLY','H':'HIS','I':'ILE','L':'LEU','K':'LYS','M':'MET','F':'PHE','P':'PRO','S':'SER','T':'THR','W':'TRP','Y':'TYR','V':'VAL'}
nt_list=['A','C','T','G','U']
if (resname in aa_dic.values()) and (aa_dic.get(entry,0)!=0):
mutate(mol_id,ch_id,resno,ins_code,aa_dic.get(entry,0))
elif (resname in nt_list) and (entry in nt_list):
mutate_base(mol_id,ch_id,resno,ins_code,entry)
else:
info_dialog("Invalid target residue! Must be protein or nucleic acid, and entered code must be single letter.")
generic_single_entry("New residue? (single letter code)","A","Mutate by single-letter code",mutate_single_letter)
def sequence_context():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resnum=active_residue()[2]
ins_code=active_residue()[3]
resname=residue_name(mol_id,ch_id,resnum,ins_code)
def get_aa_code(resnum):
mol_id=active_residue()[0]
ch_id=active_residue()[1]
ins_code=active_residue()[3]
if residue_name(mol_id,ch_id,resnum,ins_code):
aa_code=three_letter_code2single_letter(residue_name(mol_id,ch_id,resnum,ins_code))
if (len(residue_name(mol_id,ch_id,resnum,ins_code))==1):
aa_code=residue_name(mol_id,ch_id,resnum,ins_code)
if (residue_name(mol_id,ch_id,resnum,ins_code)!="ALA") and (aa_code=="A") and (len(residue_name(mol_id,ch_id,resnum,ins_code))!=1):
aa_code="X"
else:
aa_code="-"
return aa_code
current_res=get_aa_code(resnum)
minus_context=""
for i in range(1,10):
aa_code=str(get_aa_code(resnum-i))
minus_context=aa_code + minus_context
plus_context=""
for i in range(1,10):
aa_code=str(get_aa_code(resnum+i))
plus_context=plus_context + aa_code
final_string="Residue: " + resname + " " + str(resnum) +" Sequence context: ..." + minus_context + "[" + current_res + "]" + plus_context + "..."
info_dialog(final_string)
#Toggle display of active map
map_disp_flag={0:0}
map_disp_flag_cycle=0
def toggle_map_display():
global map_disp_flag
global map_disp_flag_cycle
if map_disp_flag_cycle==0:
for map_id in map_molecule_list():
disp_value=map_is_displayed(map_id)
map_disp_flag[map_id]=disp_value
if disp_value==1:
set_map_displayed(map_id,0)
map_disp_flag_cycle=1
elif map_disp_flag_cycle==1:
for map_id in map_molecule_list():
if map_id not in map_disp_flag:
disp_value=map_is_displayed(map_id)
map_disp_flag[map_id]=disp_value
if map_disp_flag[map_id]==1:
set_map_displayed(map_id,1)
map_disp_flag_cycle=0
#Toggle display of modelling toolbar (assumes it is shown by default)
toolbar_toggle_var=1
def toggle_toolbar_display():
global toolbar_toggle_var
if toolbar_toggle_var==0:
hide_modelling_toolbar()
toolbar_toggle_var=1
elif toolbar_toggle_var==1:
show_modelling_toolbar()
toolbar_toggle_var=0
#Toggle display of active model
mol_disp_flag={0:0}
mol_disp_flag_cycle=0
def toggle_mol_display():
global mol_disp_flag
global mol_disp_flag_cycle
if mol_disp_flag_cycle==0:
for mol_id in model_molecule_list():
mol_disp_value=mol_is_displayed(mol_id)
mol_disp_flag[mol_id]=mol_disp_value
if mol_disp_value==1:
set_mol_displayed(mol_id,0)
mol_disp_flag_cycle=1
elif mol_disp_flag_cycle==1:
for mol_id in model_molecule_list():
if mol_id not in mol_disp_flag:
disp_value=mol_is_displayed(mol_id)
mol_disp_flag[mol_id]=disp_value
if mol_disp_flag[mol_id]==1:
set_mol_displayed(mol_id,1)
mol_disp_flag_cycle=0
#Cycle representation mode forward/back
cycle_rep_flag={0:0}
def cycle_rep_up(mol_id,flag):
global cycle_rep_flag
cycle_rep_flag[mol_id]=flag
if cycle_rep_flag[mol_id]==0:
graphics_to_ca_plus_ligands_representation(mol_id)
cycle_rep_flag[mol_id]=1
elif cycle_rep_flag[mol_id]==1:
graphics_to_ca_plus_ligands_and_sidechains_representation(mol_id)
cycle_rep_flag[mol_id]=2
elif cycle_rep_flag[mol_id]==2:
graphics_to_rainbow_representation(mol_id)
cycle_rep_flag[mol_id]=3
elif cycle_rep_flag[mol_id]==3:
graphics_to_bonds_representation(mol_id)
cycle_rep_flag[mol_id]=0
def cycle_rep_down(mol_id,flag):
global cycle_rep_flag
cycle_rep_flag[mol_id]=flag
if cycle_rep_flag[mol_id]==3:
graphics_to_ca_plus_ligands_and_sidechains_representation(mol_id)
cycle_rep_flag[mol_id]=2
elif cycle_rep_flag[mol_id]==2:
graphics_to_ca_plus_ligands_representation(mol_id)
cycle_rep_flag[mol_id]=1
elif cycle_rep_flag[mol_id]==1:
graphics_to_bonds_representation(mol_id)
cycle_rep_flag[mol_id]=0
elif cycle_rep_flag[mol_id]==0:
graphics_to_rainbow_representation(mol_id)
cycle_rep_flag[mol_id]=3
#Cycle symmetry represntation mode forward/back
cycle_symm_flag={0:0}
def cycle_symm_up(mol_id,flag):
global cycle_symm_flag
cycle_symm_flag[mol_id]=flag
if cycle_symm_flag[mol_id]==0:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,1)
cycle_symm_flag[mol_id]=1
elif cycle_symm_flag[mol_id]==1:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,0)
set_symmetry_whole_chain(mol_id,1)
cycle_symm_flag[mol_id]=2
elif cycle_symm_flag[mol_id]==2:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,0)
set_symmetry_whole_chain(mol_id,0)
cycle_symm_flag[mol_id]=3
elif cycle_symm_flag[mol_id]==3:
get_show_symmetry()
set_show_symmetry_master(0)
cycle_symm_flag[mol_id]=0
def cycle_symm_down(mol_id,flag):
global cycle_symm_flag
cycle_symm_flag[mol_id]=flag
if cycle_symm_flag[mol_id]==3:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,0)
set_symmetry_whole_chain(mol_id,1)
cycle_symm_flag[mol_id]=2
elif cycle_symm_flag[mol_id]==2:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,1)
cycle_symm_flag[mol_id]=1
elif cycle_symm_flag[mol_id]==1:
get_show_symmetry()
set_show_symmetry_master(0)
cycle_symm_flag[mol_id]=0
elif cycle_symm_flag[mol_id]==0:
get_show_symmetry()
set_show_symmetry_master(1)
symmetry_as_calphas(mol_id,0)
set_symmetry_whole_chain(mol_id,0)
cycle_symm_flag[mol_id]=3
def undo_visible():
set_undo_molecule(active_residue()[0])
apply_undo()
def redo_visible():
set_undo_molecule(active_residue()[0])
apply_redo()
#Cycle rotamers for active residue
rotamer_number=0
def cycle_rotamers():
global rotamer_number
mol_id=active_residue()[0]
ch_id=active_residue()[1]
res_here=active_residue()[2]
ins_code=""
alt_conf=""
n_rots=n_rotamers(mol_id, ch_id, res_here, ins_code)-1
turn_off_backup(mol_id)
update_go_to_atom_from_current_position()
if rotamer_number>=n_rots:
rotamer_number=0
set_residue_to_rotamer_number(mol_id,ch_id,res_here,ins_code,alt_conf,rotamer_number)
else:
rotamer_number=rotamer_number+1
set_residue_to_rotamer_number(mol_id,ch_id,res_here,ins_code,alt_conf,rotamer_number)
turn_on_backup(mol_id)
#Toggle environment distances
def toggle_env_dist():
if show_environment_distances_state()==1:
set_show_environment_distances(0)
else:
set_show_environment_distances(1)
#Check if residue is in a polymer by comparing resname to list
def is_polymer_residue(mol_id,ch_id,sn):
valid_resnames=['A','C','T','G','U','ALA','UNK','ARG','ASN','ASP','CYS','GLU','GLN','GLY','HIS','ILE','LEU','LYS','MET','MSE','PHE','PRO','SER','THR','TRP','TYR','VAL']
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname in valid_resnames:
return 1
else:
return 0
#Return last residue in polymer
def last_polymer_residue(mol_id,ch_id):
if ((valid_model_molecule_qm(mol_id)) and (ch_id in chain_ids(mol_id))):
if not is_solvent_chain_qm(mol_id,ch_id):
n=chain_n_residues(ch_id,mol_id)-1
valid_resnames=['A','C','T','G','U','ALA','UNK','ARG','ASN','ASP','CYS','GLU','GLN','GLY','HIS','ILE','LEU','LYS','MET','MSE','PHE','PRO','SER','THR','TRP','TYR','VAL']
while resname_from_serial_number(mol_id,"%s"%(ch_id),n) not in valid_resnames:
n=n-1
result=seqnum_from_serial_number(mol_id,"%s"%(ch_id),n)
return result
else:
return -1
def first_polymer_residue(mol_id,ch_id):
if ((valid_model_molecule_qm(mol_id)) and (ch_id in chain_ids(mol_id))):
if not is_solvent_chain_qm(mol_id,ch_id):
n=0
valid_resnames=['A','C','T','G','U','ALA','UNK','ARG','ASN','ASP','CYS','GLU','GLN','GLY','HIS','ILE','LEU','LYS','MET','MSE','PHE','PRO','SER','THR','TRP','TYR','VAL']
while resname_from_serial_number(mol_id,"%s"%(ch_id),n) not in valid_resnames:
n=n+1
result=seqnum_from_serial_number(mol_id,"%s"%(ch_id),n)
return result
else:
return -1
#Return last res (polymer or not)
def last_residue(mol_id,ch_id):
n=chain_n_residues(ch_id,mol_id)-1
result=seqnum_from_serial_number(mol_id,"%s"%(ch_id),n)
return result
#Return first res (polymer or not)
def first_residue(mol_id,ch_id):
result=seqnum_from_serial_number(mol_id,"%s"%(ch_id),0)
return result
#Check if chain is polymer
def is_polymer(mol_id,ch_id):
a=is_protein_chain_p(mol_id,"%s"%(ch_id))
b=is_nucleotide_chain_p(mol_id,"%s"%(ch_id))
if (a==1) or (b==1):
result=1
else:
result=0
return result
#Check if residue is last in polymer
def is_last_polymer_residue_sn(mol_id,ch_id,sn):
if ((valid_model_molecule_qm(mol_id)) and (ch_id in chain_ids(mol_id))):
if not is_solvent_chain_qm(mol_id,ch_id):
valid_resnames=['A','C','T','G','U','ALA','UNK','ARG','ASN','ASP','CYS','GLU','GLN','GLY','HIS','ILE','LEU','LYS','MET','MSE','PHE','PRO','SER','THR','TRP','TYR','VAL']
if (resname_from_serial_number(mol_id,"%s"%(ch_id),sn) in valid_resnames) and (resname_from_serial_number(mol_id,"%s"%(ch_id),sn+1) not in valid_resnames):
return 1
else:
return -1
#get serial number from resnum
def get_sn_from_resno(mol_id,ch_id,resno):
if resno>0:
sn=resno
else:
sn=chain_n_residues(ch_id,mol_id)
resno_out=0
if resno>last_residue(mol_id,ch_id) or resno<first_residue(mol_id,ch_id):
return -1
elif resno==first_residue(mol_id,ch_id):
return 0
elif resno==chain_n_residues(ch_id,mol_id):
return chain_n_residues(ch_id,mol_id)
else:
while (resno_out!=resno):
resno_out=seqnum_from_serial_number(mol_id,ch_id,sn)
sn=sn-1
return sn+1
#check if res is at C-term side of break in mid chain
def is_term_type_mc(mol_id,ch_id,resno):
sn=get_sn_from_resno(mol_id,ch_id,resno)
if (type(sn) is int) and (is_polymer_residue(mol_id,ch_id,sn)==1) and (is_polymer_residue(mol_id,ch_id,sn+1)==1):
resn_here=resno
resn_next=seqnum_from_serial_number(mol_id,ch_id,sn+1)
diff_next=resn_next-resn_here
if (diff_next>=2):
return 1
else:
return 0
else:
return 0
def is_term_type_mc_sn(mol_id,ch_id,sn):
if sn in range(1,chain_n_residues(ch_id,mol_id)):
resn_here=seqnum_from_serial_number(mol_id,ch_id,sn)
if (is_polymer_residue(mol_id,ch_id,sn)==1) and (is_polymer_residue(mol_id,ch_id,sn+1)==1):
resn_next=seqnum_from_serial_number(mol_id,ch_id,sn+1)
diff_next=resn_next-resn_here
if (diff_next>=2):
return 1
else:
return 0
else:
return 0
else:
return 0
#check if res is at N-term side of break in mid chain
def is_term_type_mn(mol_id,ch_id,resno):
sn=get_sn_from_resno(mol_id,ch_id,resno)
if type(sn) is int:
if sn in range(1,chain_n_residues(ch_id,mol_id)) and (is_polymer_residue(mol_id,ch_id,sn)==1):
resn_here=resno
resn_prev=seqnum_from_serial_number(mol_id,ch_id,sn-1)
diff_prev=resn_here-resn_prev
if (diff_prev>=2):
return 1
else:
return 0
else:
return 0
else:
return 0
def is_term_type_mn_sn(mol_id,ch_id,sn):
if sn in range(1,chain_n_residues(ch_id,mol_id)):
resn_here=seqnum_from_serial_number(mol_id,ch_id,sn)
if (is_polymer_residue(mol_id,ch_id,sn)==1):
resn_prev=seqnum_from_serial_number(mol_id,ch_id,sn-1)
diff_prev=resn_here-resn_prev
if (diff_prev>=2):
return 1
else:
return 0
else:
return 0
else:
return 0
#Check for last residue in active segment
#goes into endless loop if fed res no before first res in ch
#gives incorrect value if fed last res in ch
def last_residue_in_seg(mol_id,ch_id,current_res_no):
if current_res_no==last_polymer_residue(mol_id,ch_id) or is_term_type_mc(mol_id,ch_id,current_res_no):
output=current_res_no
elif current_res_no>last_residue(mol_id,ch_id):
output=last_residue(mol_id,ch_id)
else:
while not (is_term_type_mc(mol_id,ch_id,current_res_no) or (current_res_no==last_polymer_residue(mol_id,ch_id))):
current_res_no=current_res_no+1
output=current_res_no
return output
#Check for first residue in segment
def first_residue_in_seg(mol_id,ch_id,current_res_no):
if current_res_no==first_polymer_residue(mol_id,ch_id) or is_term_type_mn(mol_id,ch_id,current_res_no):
output=current_res_no
elif current_res_no<first_residue(mol_id,ch_id):
output=first_residue(mol_id,ch_id)
else:
while not (is_term_type_mn(mol_id,ch_id,current_res_no) or (current_res_no==first_polymer_residue(mol_id,ch_id))):
current_res_no=current_res_no-1
output=current_res_no
return output
#Get serial number of active residue
def sn_of_active_res():
sn=0
resn_to_match=active_residue()[2]
mol_id=active_residue()[0]
ch_id=active_residue()[1]
current_resn=seqnum_from_serial_number(mol_id,"%s"%(ch_id),sn)
while (current_resn!=resn_to_match):
sn=sn+1
current_resn=seqnum_from_serial_number(mol_id,"%s"%(ch_id),sn)
return sn
#Get monomer and delete hydrogens
def get_monomer_no_H(mon):
get_monomer(mon)
delete_hydrogens(molecule_number_list()[-1])
#Return list of segments in active mol
def segment_list(mol_id):
sn=0
list_out=[]
for ch_id in chain_ids(mol_id):
while is_polymer_residue(mol_id,ch_id,sn+1)==1:
if sn==0:
res_start=seqnum_from_serial_number(mol_id,ch_id,sn)
while is_term_type_mc_sn(mol_id,ch_id,sn)==0 and seqnum_from_serial_number(mol_id,ch_id,sn+1)!=-10000 and is_polymer_residue(mol_id,ch_id,sn+1)==1:
sn=sn+1
res_end=seqnum_from_serial_number(mol_id,ch_id,sn)
list_out.append([mol_id,ch_id,res_start,res_end])
else:
while is_term_type_mn_sn(mol_id,ch_id,sn)==0:
sn=sn+1
res_start=seqnum_from_serial_number(mol_id,ch_id,sn)
while is_term_type_mc_sn(mol_id,ch_id,sn)==0 and seqnum_from_serial_number(mol_id,ch_id,sn+1)!=-10000 and is_polymer_residue(mol_id,ch_id,sn+1)==1:
sn=sn+1
res_end=seqnum_from_serial_number(mol_id,ch_id,sn)
list_out.append([mol_id,ch_id,res_start,res_end])
sn=0
return list_out
#rigid body refine zone here +/- n+1, then real space refine zone here +/-n
def auto_refine(n):
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resno=active_residue()[2]
altloc=active_residue()[5]
res_start=resno
res_end=resno
i=0
fpr=first_polymer_residue(mol_id,ch_id)
lpr=last_polymer_residue(mol_id,ch_id)
while not (is_term_type_mn(mol_id,ch_id,res_start) or res_start==fpr or i==n):
res_start=res_start-1
i=i+1
i=0
while not (is_term_type_mc(mol_id,ch_id,res_end) or res_end==lpr or i==n):
res_end=res_end+1
i=i+1
rigid_body_refine_zone(res_start,res_end,ch_id,mol_id)
accept_regularizement()
refine_zone(mol_id,ch_id,res_start,res_end,altloc)
#**** "Custom menu item functions ****
#Deletes active chain
def delete_chain():
active_chain_id=active_residue()[1]
active_mol_id=active_residue()[0]
while (is_polymer(active_mol_id,active_chain_id)==1) or (
is_solvent_chain_p(active_mol_id,active_chain_id)!=-1):
first_res=first_residue(active_mol_id,active_chain_id)
last_res=last_residue(active_mol_id,active_chain_id)
delete_residue_range(active_mol_id,active_chain_id,first_res,last_res)
#Fits all polymer chains to map
def rigid_fit_all_chains():
mol_id=active_residue()[0]
turn_off_backup(mol_id)
for ch_id in chain_ids(mol_id): #Rigid body refine each chain
if is_polymer(mol_id,ch_id)==1:
rigid_body_refine_by_atom_selection(mol_id, "//%s//"%(ch_id))
accept_regularizement()
turn_on_backup(mol_id)
#Fits active chain to map
def rigid_fit_active_chain():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
rigid_body_refine_by_atom_selection(mol_id, "//%s//"%(ch_id))
#Copies active chain
def copy_active_chain():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
new_molecule_by_atom_selection(mol_id, "//%s//"%(ch_id))
#Cuts active chain
def cut_active_chain():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
new_molecule_by_atom_selection(mol_id, "//%s//"%(ch_id))
while (is_polymer(mol_id,ch_id)==1) or (is_solvent_chain_p(mol_id,ch_id)!=-1):
first_res=first_residue(mol_id,ch_id)
last_res=last_residue(mol_id,ch_id)
delete_residue_range(mol_id,ch_id,first_res,last_res)
#Copy active segment
def copy_active_segment():
mol_id=active_residue()[0]
segments=segment_list(mol_id)
res_here=active_residue()[2]
ch_id=active_residue()[1]
for seg in segments:
if (res_here>=seg[2]) and (res_here<=seg[3]) and (ch_id==seg[1]):
res_start=seg[2]
res_end=seg[3]
ch_id=seg[1]
new_molecule_by_atom_selection(mol_id, "/{mol_id}/{ch_id}/{res_start}-{res_end}/".format(mol_id=mol_id,ch_id=ch_id,res_start=res_start,res_end=res_end))
#Cur active segment
def cut_active_segment():
mol_id=active_residue()[0]
segments=segment_list(mol_id)
res_here=active_residue()[2]
ch_id=active_residue()[1]
for seg in segments:
if (res_here>=seg[2]) and (res_here<=seg[3]) and (ch_id==seg[1]):
res_start=seg[2]
res_end=seg[3]
ch_id=seg[1]
new_molecule_by_atom_selection(mol_id, "/{mol_id}/{ch_id}/{res_start}-{res_end}/".format(mol_id=mol_id,ch_id=ch_id,res_start=res_start,res_end=res_end))
delete_residue_range(mol_id,ch_id,res_start,res_end)
#Jiggle-fits active chain to map
def jiggle_fit_active_chain():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
ch_id=active_residue()[1]
fit_chain_to_map_by_random_jiggle(mol_id,ch_id,1000,0.1)
#Jiggle-fit active chain to B-smoothed map
def jiggle_fit_active_chain_smooth():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
sharpen(imol_refinement_map(),200)
mol_id=active_residue()[0]
ch_id=active_residue()[1]
fit_chain_to_map_by_random_jiggle(mol_id,ch_id,1000,0.1)
sharpen(imol_refinement_map(),0)
#Jiggle-fits active chain to map (more thorough)
def jiggle_fit_active_chain_slow():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
ch_id=active_residue()[1]
score_string=""
for scale_fac in range(1,1000,100):
scale_fac2=scale_fac/10.0
score=fit_chain_to_map_by_random_jiggle(mol_id,ch_id,100,scale_fac2)
score_string=score_string+"scale:"+str(scale_fac2)+"score:"+str(score)
print(score_string)
#Fits all polymer chains to map
def jiggle_fit_all_chains():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
turn_off_backup(mol_id)
for ch_id in chain_ids(mol_id): #Rigid body refine each chain
if is_polymer(mol_id,ch_id)==1:
fit_chain_to_map_by_random_jiggle(mol_id,ch_id,1000,0.1)
accept_regularizement()
turn_on_backup(mol_id)
#Jiggle-fit current molecule to map
def jiggle_fit_active_mol():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
fit_molecule_to_map_by_random_jiggle(mol_id,1000,0.1)
#Clear labels and distances
def clear_distances_and_labels():
remove_all_atom_labels()
clear_simple_distances()
#Delete hydrogens from active molecule
def delete_h_active():
mol_id=active_residue()[0]
delete_hydrogens(mol_id)
#click the start and end point, then fit the gap between them with polyala
def fit_polyala_gui():
def fit_polyala(res1,res2):
length=abs(res1[3]-res2[3])-1
loop_seq=length*"A"
fit_gap(res1[1],res1[2],res1[3],res2[3],loop_seq,1)
user_defined_click(2,fit_polyala)
#Real space refine for keyboard shortcut
def refine_click():
def refine_click_a(res1,res2):
mol_id_1=res1[1]
mol_id_2=res2[1]
ch_id_1=res1[2]
ch_id_2=res2[2]
resno_1=res1[3]
resno_2=res2[3]
alt_conf_1=res1[4]
alt_conf_2=res2[4]
if resno_2>=resno_1:
refine_zone(mol_id_1,ch_id_1,resno_1,resno_2,alt_conf_1)
else:
refine_zone(mol_id_1,ch_id_1,resno_2,resno_1,alt_conf_1)
user_defined_click(2,refine_click_a)
#Copy fragment (click start and end)
def copy_frag_by_click():
def copy_frag(res1,res2):
mol_id_1=res1[1]
mol_id_2=res2[1]
ch_id_1=res1[2]
ch_id_2=res2[2]
resno_1=res1[3]
resno_2=res2[3]
if (mol_id_1==mol_id_2) and (ch_id_1==ch_id_2):
if resno_1>resno_2:
atom_sel="//%s/%s-%s" %(ch_id_1,resno_2,resno_1)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
elif resno_2>resno_1:
atom_sel="//%s/%s-%s" %(ch_id_1,resno_1,resno_2)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
else:
atom_sel="//%s/%s" %(ch_id_1,resno_2)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
else:
info_dialog("Start and end residues must be in the same molecule and chain!")
user_defined_click(2,copy_frag)
#Cut fragment (click start and end)
def cut_frag_by_click():
def cut_frag(res1,res2):
mol_id_1=res1[1]
mol_id_2=res2[1]
ch_id_1=res1[2]
ch_id_2=res2[2]
resno_1=res1[3]
resno_2=res2[3]
if (mol_id_1==mol_id_2) and (ch_id_1==ch_id_2):
if resno_1>resno_2:
atom_sel="//%s/%s-%s" %(ch_id_1,resno_2,resno_1)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
delete_residue_range(mol_id_1,ch_id_1,resno_2,resno_1)
elif resno_2>resno_1:
atom_sel="//%s/%s-%s" %(ch_id_1,resno_1,resno_2)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
delete_residue_range(mol_id_1,ch_id_1,resno_1,resno_2)
else:
atom_sel="//%s/%s" %(ch_id_1,resno_2)
new_molecule_by_atom_selection(mol_id_1,atom_sel)
delete_residue_range(mol_id_1,ch_id_1,resno_2)
else:
info_dialog("Start and end residues must be in the same molecule and chain!")
user_defined_click(2,cut_frag)
#Delete sidechain range (click start and end)
def delete_sidechain_range_by_click_a():
def delete_sidechain_range_by_click_b(res1,res2):
if (res1[1]!=res2[1]) or (res1[2]!=res2[2]) or (res1[3]==res2[3]):
info_dialog("Start and end points must be in the same mol and chain!")
else:
if (res1[3] > res2[3]):
res_start=res2[3]-1
res_end=res1[3]+1
else:
res_start=res1[3]-1
res_end=res2[3]+1
mol_id=res1[1]
ch_id=res1[2]
turn_off_backup(mol_id)
delete_sidechain_range(mol_id,ch_id,res_start,res_end)
turn_on_backup(mol_id)
user_defined_click(2,delete_sidechain_range_by_click_b)
#Mutate range to poly-unk
def mutate_residue_range_by_click_a():
def mutate_residue_range_by_click_b(res1,res2):
if (res1[1]!=res2[1]) or (res1[2]!=res2[2]) or (res1[3]==res2[3]):
info_dialog("Start and end points must be in the same mol and chain!")
else:
if (res1[3] > res2[3]):
res_start=res2[3]
res_end=res1[3]
n=res_end-res_start+1
else:
res_start=res1[3]
res_end=res2[3]
n=res_end-res_start+1
mol_id=res1[1]
ch_id=res1[2]
target_seq=n*"A"
turn_off_backup(mol_id)
mutate_residue_range(mol_id,ch_id,res_start,res_end,target_seq)
for n in range(res_start,res_end+1):
set_residue_name(mol_id,ch_id,n,"","UNK")
turn_on_backup(mol_id)
user_defined_click(2,mutate_residue_range_by_click_b)
#Mutate range to polyala
def mutate_residue_range_by_click_ala_a():
def mutate_residue_range_by_click_ala_b(res1,res2):
if (res1[1]!=res2[1]) or (res1[2]!=res2[2]) or (res1[3]==res2[3]):
info_dialog("Start and end points must be in the same mol and chain!")
else:
if (res1[3] > res2[3]):
res_start=res2[3]
res_end=res1[3]
n=res_end-res_start+1
else:
res_start=res1[3]
res_end=res2[3]
n=res_end-res_start+1
mol_id=res1[1]
ch_id=res1[2]
target_seq=n*"A"
turn_off_backup(mol_id)
mutate_residue_range(mol_id,ch_id,res_start,res_end,target_seq)
for n in range(res_start,res_end+1):
set_residue_name(mol_id,ch_id,n,"","ALA")
turn_on_backup(mol_id)
user_defined_click(2,mutate_residue_range_by_click_ala_b)
#Merge two fragments
def merge_fragments():
def merge_2_fragments(res1,res2):
mol_daughter=[res2[1]]
mol_ref=res1[1]
merge_molecules(mol_daughter,mol_ref)
toggle_display_mol(mol_ref)
toggle_display_mol(mol_ref)
user_defined_click(2,merge_2_fragments)
#Force addition of residue - useful when
#Coot says "No acceptable position found"
# but density is clear.
def force_add_terminal_residue():
def force_addition(res1):
mol_id=res1[1]
ch_id=res1[2]
res_no=res1[3]
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-57.82,-47)
if residue_exists_qm(mol_id,ch_id,res_no+1,res1[4]):
set_b_factor_residue_range(mol_id,ch_id,res_no+1,res_no+1,default_new_atoms_b_factor())
elif residue_exists_qm(mol_id,ch_id,res_no-1,res1[4]):
set_b_factor_residue_range(mol_id,ch_id,res_no-1,res_no-1,default_new_atoms_b_factor())
sort_residues(mol_id)
user_defined_click(1,force_addition)
def force_add_terminal_residue_noclick(mol_id,ch_id,res_no):
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-57.82,-47)
if residue_exists_qm(mol_id,ch_id,res_no+1,""):
set_b_factor_residue_range(mol_id,ch_id,res_no+1,res_no+1,default_new_atoms_b_factor())
elif residue_exists_qm(mol_id,ch_id,res_no-1,""):
set_b_factor_residue_range(mol_id,ch_id,res_no-1,res_no-1,default_new_atoms_b_factor())
sort_residues(mol_id)
#Grow helix from selected terminus
def grow_helix():
def grow_helix_post_click(res1):
def grow_helix_enter_resn(n):
mol_id=res1[1]
ch_id=res1[2]
res_no=res1[3]
res_no_0=res_no
for i in range(1,(int(n)+1)):
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-57.82,-47)
sort_residues(mol_id)
if (res_no==(first_residue_in_seg(mol_id,ch_id,res_no)+1)):
res_no=res_no-1
elif (res_no==(last_residue_in_seg(mol_id,ch_id,res_no)-1)):
res_no=res_no+1
set_b_factor_residue_range(mol_id,ch_id,res_no_0,res_no,default_new_atoms_b_factor())
generic_single_entry("How many residues for helix?",
"10","Grow helix",grow_helix_enter_resn)
user_defined_click(1,grow_helix_post_click)
#Grow strand from selected terminus
def grow_strand():
def grow_strand_post_click(res1):
def grow_strand_enter_resn(n):
mol_id=res1[1]
ch_id=res1[2]
res_no=res1[3]
res_no_0=res_no
for i in range(1,(int(n)+1)):
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-139,135)
sort_residues(mol_id)
if (res_no==(first_residue_in_seg(mol_id,ch_id,res_no)+1)):
res_no=res_no-1
elif (res_no==(last_residue_in_seg(mol_id,ch_id,res_no)-1)):
res_no=res_no+1
set_b_factor_residue_range(mol_id,ch_id,res_no_0,res_no,default_new_atoms_b_factor())
generic_single_entry("How many residues for strand?",
"10","Grow strand",grow_strand_enter_resn)
user_defined_click(1,grow_strand_post_click)
#Grow para strand from selected terminus
def grow_parallel_strand():
def grow_parallel_strand_post_click(res1):
def grow_parallel_strand_enter_resn(n):
mol_id=res1[1]
ch_id=res1[2]
res_no=res1[3]
for i in range(1,(int(n)+1)):
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-119,113)
sort_residues(mol_id)
if (res_no==(first_residue_in_seg(mol_id,ch_id,res_no)+1)):
res_no=res_no-1
elif (res_no==(last_residue_in_seg(mol_id,ch_id,res_no)-1)):
res_no=res_no+1
generic_single_entry("How many residues for parallel strand?",
"10","Grow parallel strand",grow_parallel_strand_enter_resn)
user_defined_click(1,grow_parallel_strand_post_click)
#Grow 3-10 helix from selected terminus
def grow_helix_3_10():
def grow_helix_post_click(res1):
def grow_helix_enter_resn(n):
mol_id=res1[1]
ch_id=res1[2]
res_no=res1[3]
for i in range(1,(int(n)+1)):
res_type="auto"
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-49,-26)
sort_residues(mol_id)
if (res_no==(first_residue_in_seg(mol_id,ch_id,res_no)+1)):
res_no=res_no-1
elif (res_no==(last_residue_in_seg(mol_id,ch_id,res_no)-1)):
res_no=res_no+1
generic_single_entry("How many residues for helix?",
"10","Grow 3-10 helix",grow_helix_enter_resn)
user_defined_click(1,grow_helix_post_click)
#Renumbers the active chain (from active_residue()). User enters new starting residue number.
def renumber_by_first_res():
def renum_chain(new_num):
new_num=int(new_num)
mol_id=active_residue()[0]
ch_id=active_residue()[1]
first_res=first_residue(mol_id,ch_id)
last_res=last_residue(mol_id,ch_id)
offset=new_num-first_res
renumber_residue_range(mol_id,ch_id,first_res,last_res,int(offset))
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New number for first residue in this chain?",
str(seqnum_from_serial_number(active_residue()[0],
"%s"%(active_residue()[1]),0)),"Renumber",renum_chain)
#Renumbers the active chain (from active_residue()). User enters new last residue number.
def renumber_by_last_res():
def renum_chain(new_num):
new_num=int(new_num)
mol_id=active_residue()[0]
ch_id=active_residue()[1]
first_res=first_residue(mol_id,ch_id)
last_res=last_residue(mol_id,ch_id)
offset=new_num-last_res
renumber_residue_range(mol_id,ch_id,first_res,last_res,int(offset))
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New number for last residue in this chain?",
str(seqnum_from_serial_number(active_residue()[0],
"%s"%(active_residue()[1]),
(chain_n_residues(active_residue()[1],active_residue()[0])-1))),"Renumber",renum_chain)
#Renumbers the active chain (from active_residue()). User enters new active residue number.
def renumber_by_active_res():
def renum_chain(new_num):
new_num=int(new_num)
mol_id=active_residue()[0]
ch_id=active_residue()[1]
current_num=active_residue()[2]
first_res=first_residue(mol_id,ch_id)
last_res=last_residue(mol_id,ch_id)
offset=new_num-current_num
renumber_residue_range(mol_id,ch_id,first_res,last_res,int(offset))
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New number for this residue?",
str(active_residue()[2]),"Renumber",renum_chain)
#Renumber from N-term to current residue
def renumber_n_term_segment():
def renumber_n_term_segment_entry(new_resn):
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
first_res=seqnum_from_serial_number(mol_id,"%s"%(ch_id),0)
offset=int(new_resn)-resn
renumber_residue_range(mol_id,ch_id,first_res,resn,offset)
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New residue number?",
str(active_residue()[2]),"Renumber",renumber_n_term_segment_entry)
#Renumber from current residue to C-term
def renumber_c_term_segment():
def renumber_c_term_segment_entry(new_resn):
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
def last_residue(mol_id,ch_id):
n=chain_n_residues(ch_id,mol_id)-1
result=seqnum_from_serial_number(mol_id,"%s"%(ch_id),n)
return result
last_res=last_residue(mol_id,ch_id)
offset=int(new_resn)-resn
renumber_residue_range(mol_id,ch_id,resn,last_res,offset)
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New residue number?",
str(active_residue()[2]),"Renumber",renumber_c_term_segment_entry)
#Sharpen or blur map. Slider jerky on large maps.
def sharpen_by_entered_factor():
if (scroll_wheel_map()==-1):
info_dialog("You need a map!")
else:
def sharpen_by_entry(B):
B=int(B)
sharpen(scroll_wheel_map(),B)
generic_single_entry("New B-factor for map?",
"-100","Sharpen/Blur",sharpen_by_entry)
#Reload map with different hi-res limit
def change_hires_limit():
if (scroll_wheel_map()==-1):
info_dialog("You need a map!")
else:
def change_hires_by_entry(new_res):
mol=scroll_wheel_map()
new_res=float(new_res)
mtz_file=map_parameters(mol)[0]
F_col=map_parameters(mol)[1]
PHI_col=map_parameters(mol)[2]
make_and_draw_map_with_reso_with_refmac_params(mtz_file,F_col,PHI_col,"",0,0,0,"Fobs:None-specified",
"SigF:None-specified","RFree:None-specified",0,0,1,1000.0,new_res)
close_molecule(mol)
generic_single_entry("New high-res limit for map?",
"5.0","Change high resolution limit for active map",change_hires_by_entry)
def change_hires_limit_copy():
if (scroll_wheel_map()==-1):
info_dialog("You need a map!")
else:
def change_hires_by_entry(new_res):
mol=scroll_wheel_map()
new_res=float(new_res)
mtz_file=map_parameters(mol)[0]
F_col=map_parameters(mol)[1]
PHI_col=map_parameters(mol)[2]
make_and_draw_map_with_reso_with_refmac_params(mtz_file,F_col,PHI_col,"",0,0,0,"Fobs:None-specified",
"SigF:None-specified","RFree:None-specified",0,0,1,1000.0,new_res)
generic_single_entry("New high-res limit for map?",
"5.0","Make low pass filtered copy of active map",change_hires_by_entry)
#Mutate mets to MSE
def mutate_all_mets_to_mse():
mol_id=active_residue()[0]
turn_off_backup(mol_id)
for ch_id in chain_ids(mol_id):
for resn in range(0,chain_n_residues(ch_id,mol_id)):
if (resname_from_serial_number(mol_id,ch_id,resn)=="MET"):
seqnum=seqnum_from_serial_number(mol_id,ch_id,resn)
ins_id=str(insertion_code_from_serial_number(mol_id,ch_id,resn))
delete_residue_with_full_spec(mol_id,1,ch_id,seqnum,ins_id,"B")
delete_residue_with_full_spec(mol_id,1,ch_id,seqnum,ins_id,"C")
mutate(mol_id,ch_id,seqnum,ins_id,"MSE")
map_id=imol_refinement_map()
if (map_id!=-1):
auto_fit_best_rotamer(seqnum,"",ins_id,ch_id,mol_id,map_id,1,0.01)
turn_on_backup(mol_id)
#Mutate MSEs to MET
def mutate_all_mse_to_met():
mol_id=active_residue()[0]
turn_off_backup(mol_id)
for ch_id in chain_ids(mol_id):
for resn in range(0,chain_n_residues(ch_id,mol_id)):
if (resname_from_serial_number(mol_id,ch_id,resn)=="MSE"):
seqnum=seqnum_from_serial_number(mol_id,ch_id,resn)
ins_id=str(insertion_code_from_serial_number(mol_id,ch_id,resn))
delete_residue_with_full_spec(mol_id,1,ch_id,seqnum,ins_id,"B")
delete_residue_with_full_spec(mol_id,1,ch_id,seqnum,ins_id,"C")
mutate(mol_id,ch_id,seqnum,ins_id,"MET")
map_id=imol_refinement_map()
if (map_id!=-1):
auto_fit_best_rotamer(seqnum,"",ins_id,ch_id,mol_id,map_id,1,0.01)
turn_on_backup(mol_id)
#Shorten loop by one residue
def shorten_loop():
active_atom=active_residue()
mol_id=active_atom[0]
ch_id=active_atom[1]
resn=active_atom[2]
ins_code=active_atom[3]
delete_residue(mol_id,ch_id,resn,ins_code)
first_res=seqnum_from_serial_number(mol_id,"%s"%(ch_id),0)
renumber_residue_range(mol_id,ch_id,first_res,resn,1)
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
r1=resn-1
r2=resn+2
set_refinement_immediate_replacement(1)
refine_zone(mol_id,ch_id,r1,r2,"")
accept_regularizement()
set_refinement_immediate_replacement(0)
#Lengthen loop by one residue
def lengthen_loop():
active_atom=active_residue()
mol_id=active_atom[0]
ch_id=active_atom[1]
resn=active_atom[2]
first_res=seqnum_from_serial_number(mol_id,"%s"%(ch_id),0)
renumber_residue_range(mol_id,ch_id,first_res,resn,-1)
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
r1=resn-1
r2=resn
set_refinement_immediate_replacement(1)
fit_gap(mol_id,ch_id,r1,r2,"A",1)
accept_regularizement()
set_refinement_immediate_replacement(0)
#Get fractional coordinates of active atom. Useful when inspecting heavy atom sites.
def get_fract_coords():
a=active_residue()
x_cart=atom_specs(a[0],a[1],a[2],a[3],a[4],a[5])[3]
y_cart=atom_specs(a[0],a[1],a[2],a[3],a[4],a[5])[4]
z_cart=atom_specs(a[0],a[1],a[2],a[3],a[4],a[5])[5]
mol_id=active_residue()[0]
cell_a=cell(mol_id)[0]
cell_b=cell(mol_id)[1]
cell_c=cell(mol_id)[2]
cell_alpha=math.radians(cell(mol_id)[3])
cell_beta=math.radians(cell(mol_id)[4])
cell_gamma=math.radians(cell(mol_id)[5])
cos_alpha_star=(math.cos(cell_beta)*math.cos(cell_gamma)-math.cos(cell_alpha))/(math.sin(cell_beta)*math.sin(cell_gamma))
sin_alpha_star=math.sqrt(1-cos_alpha_star**2)
z_fract=z_cart/(cell_c*math.sin(cell_beta)*sin_alpha_star)
y_fract=(y_cart-(-1*cell_c*math.sin(cell_beta)*cos_alpha_star)*z_fract)/(cell_b*math.sin(cell_gamma))
x_fract=(x_cart-(cell_b*math.cos(cell_gamma))*y_fract-(cell_c*math.cos(cell_beta))*z_fract)/cell_a
x_y_z_string=str("("+str("%.3f" % x_fract)+","+str("%.3f" % y_fract)+","+str("%.3f" % z_fract)+")")
info_dialog("The fractional coordinates of the active atom are: %s"%(x_y_z_string))
#Go to center of scroll wheel map.
def goto_center_of_map():
if (scroll_wheel_map()==-1):
info_dialog("You need a map!")
else:
mol_id=scroll_wheel_map()
a=float(cell(mol_id)[0])
b=float(cell(mol_id)[1])
c=float(cell(mol_id)[2])
x=a*0.5
y=b*0.5
z=c*0.5
set_rotation_centre(x,y,z)
#Make a button list for inserting common monomers
def pick_common_monomers():
get_ddm=["DDM", lambda func: get_monomer_no_H("LMT")]
get_dm=["DM", lambda func: get_monomer_no_H("DMU")]
get_bog=["OG", lambda func: get_monomer_no_H("HSH")]
get_ldao=["LDAO", lambda func: get_monomer_no_H("LDA")]
get_mpg=["Monoolein", lambda func: get_monomer_no_H("MPG")]
get_glycerol=["Glycerol", lambda func: get_monomer_no_H("GOL")]
get_eg=["Ethylene glycol", lambda func: get_monomer_no_H("EDO")]
get_acetate=["Acetate", lambda func: get_monomer_no_H("ACT")]
get_dmso=["DMSO", lambda func: get_monomer_no_H("DMS")]
get_tris=["Tris", lambda func: get_monomer_no_H("TAM")]
get_hepes=["HEPES", lambda func: get_monomer_no_H("EPE")]
get_mes=["MES", lambda func: get_monomer_no_H("MES")]
get_cac=["Cacodylate", lambda func: get_monomer_no_H("CAD")]
get_peg=["PEG", lambda func: get_monomer_no_H("1PE")]
button_list=[get_acetate,get_eg,get_glycerol,get_dmso,get_ddm,get_dm,get_bog,get_ldao,get_mpg,get_tris,get_hepes,get_mes,get_cac,get_peg]
generic_button_dialog("Common small molecules",button_list)
#Switch all models to CA representation
def all_mols_to_ca():
for mol_id in molecule_number_list():
graphics_to_ca_plus_ligands_representation(mol_id)
#Set b-factor color scaling based on mean B of active mol
def autoscale_b_factor():
mol_id=active_residue()[0]
mean_b=average_temperature_factor(mol_id)
scale_fac=50/mean_b
set_b_factor_bonds_scale_factor(mol_id,scale_fac)
graphics_to_b_factor_representation(mol_id)
#Make copy of active mol colored by rotamer probability (as pseudo-B)
def make_rotamer_colored_copy():
mol_list1=model_molecule_list()
current_mol=active_residue()[0]
copy_molecule(current_mol)
mol_list2=model_molecule_list()
mol_id=mol_list2[-1]
is_missing=[]
i=0
turn_off_backup(mol_id)
set_b_factor_molecule(mol_id,100)
for x in missing_atom_info(mol_id):
x_ch=x[0]
x_resn=x[1]
set_b_factor_residue_range(mol_id,x_ch,x_resn,x_resn,999)
for ch_id in chain_ids(mol_id):
first_res=first_residue(mol_id,ch_id)
print("FIRST",first_res)
last_res=last_residue(mol_id,ch_id)
print("LAST",last_res)
for resn in range(first_res,last_res):
if residue_exists_qm(mol_id,ch_id,resn,""):
if (((residue_info(mol_id,ch_id,resn,"")[0])[0])[0]==" N "):
if (((residue_info(mol_id,ch_id,resn,"")[1])[1])[1]!=999.0):
rot_prob=rotamer_score(mol_id,ch_id,resn,"","")
set_b_factor_residue_range(mol_id,ch_id,resn,resn,rot_prob)
if (residue_name(mol_id,ch_id,resn,"")=="ALA") or (residue_name(mol_id,ch_id,resn,"")=="GLY"):
set_b_factor_residue_range(mol_id,ch_id,resn,resn,999)
set_b_factor_bonds_scale_factor(mol_id,100)
graphics_to_b_factor_representation(mol_id)
set_molecule_name(mol_id,"Bad rotamers in mol %s"%(mol_id))
turn_on_backup(mol_id)
#Make copy of active mol colored by missing atoms
def make_missing_atoms_colored_copy():
mol_list1=model_molecule_list()
current_mol=active_residue()[0]
copy_molecule(current_mol)
mol_list2=model_molecule_list()
mol_id=mol_list2[-1]
is_missing=[]
i=0
turn_off_backup(mol_id)
set_b_factor_molecule(mol_id,0)
for x in missing_atom_info(mol_id):
x_ch=x[0]
x_resn=x[1]
set_b_factor_residue_range(mol_id,x_ch,x_resn,x_resn,100)
graphics_to_b_factor_representation(mol_id)
set_molecule_name(mol_id,"Missing atoms in mol %s"%(mol_id))
turn_on_backup(mol_id)
#Mutate active chain to entered sequence
default_seq="MAAAA"
def mutate_by_resnum():
def enter_seq(seq):
global default_seq
seq=str(seq).upper()
seq.replace(" ", "")
seq_dic={}
len_seq=len(seq)
n=0
nmax=len_seq+1
aa_dic={'A':'ALA','R':'ARG','N':'ASN','D':'ASP','C':'CYS','E':'GLU',
'Q':'GLN','G':'GLY','H':'HIS','I':'ILE','L':'LEU','K':'LYS','M':'MET',
'F':'PHE','P':'PRO','S':'SER','T':'THR','W':'TRP','Y':'TYR','V':'VAL'}
clean_seq=''
while (n<len_seq):
if ((seq[n].isalpha() and (seq[n] in aa_dic))):
clean_seq=clean_seq+seq[n]
n=n+1
seq=clean_seq
default_seq=seq
len_seq=len(seq)
n=0
while (n<len_seq):
value=aa_dic[seq[n]]
seq_dic[n+1]=value
n=n+1
mol_id=active_residue()[0]
ch_id=active_residue()[1]
sn=0
last_sn=chain_n_residues(ch_id,mol_id)-1
turn_off_backup(mol_id)
while (sn<=last_sn):
res=resname_from_serial_number(mol_id,ch_id,sn)
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
ins_id=str(insertion_code_from_serial_number(mol_id,ch_id,sn))
if ((res!=seq_dic.get(seqnum)) and ((res in aa_dic.values()) or (res=="MSE"))):
if seq_dic.get(seqnum):
mutate(mol_id,ch_id,seqnum,ins_id,seq_dic.get(seqnum))
delete_residue_sidechain(mol_id,ch_id,seqnum,ins_id,0)
sn=sn+1
turn_on_backup(mol_id)
generic_single_entry("Enter raw amino acid sequence (must be complete!)",
default_seq,"Mutate active chain to match sequence using PDB numbering", enter_seq)
#Highlight various items with ball-and-stick and lines
def highlight_chain_breaks():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
turn_off_backup(mol_id)
obj_number=generic_object_with_name("chain_breaks")
generic_object_clear(obj_number)
valid_resnames=['A','C','T','G','U','ALA','UNK','ARG','ASN','ASP','CYS','GLU','GLN','GLY','HIS','ILE','LEU','LYS','MET','MSE','PHE','PRO','SER','THR','TRP','TYR','VAL']
for ch_id in chain_ids(mol_id):
for resn in range(0,chain_n_residues(ch_id,mol_id)):
resname=resname_from_serial_number(mol_id,ch_id,resn)
print(resname)
if (resname in valid_resnames):
if ((is_term_type_mc_sn(mol_id,ch_id,resn)==1) or (is_term_type_mn_sn(mol_id,ch_id,resn)==1)):
seqnum=seqnum_from_serial_number(mol_id,ch_id,resn)
# sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
# make_ball_and_stick(mol_id,sel_string,0,0.5,1)
if (is_term_type_mn_sn(mol_id,ch_id,resn)==1):
x_mn=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-3]
y_mn=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-2]
z_mn=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-1]
x_mid=(x_mn+x_here)/2
y_mid=(y_mn+y_here)/2
z_mid=(z_mn+z_here)/2
to_generic_object_add_dashed_line(obj_number,"red",3,3,x_here,y_here,z_here,x_mn,y_mn,z_mn)
#res_missing=seqnum-seqnum_from_serial_number(mol_id,ch_id,resn-1)
#if res_missing>=20:
# place_text(str(res_missing),x_mid,y_mid,z_mid,1)
else:
x_here=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-3]
y_here=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-2]
z_here=atom_specs(mol_id,ch_id,seqnum,"","CA","")[-1]
if (resn==0):
seqnum=seqnum_from_serial_number(mol_id,ch_id,resn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
if (is_last_polymer_residue_sn(mol_id,ch_id,resn)==1):
seqnum=seqnum_from_serial_number(mol_id,ch_id,resn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
set_display_generic_object(obj_number,1)
turn_on_backup(mol_id)
def highlight_glycines():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="GLY":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_cys():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="CYS":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_prolines():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="PRO":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_polars():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
polars=["ASP","GLU","ARG","HIS","ASN","GLN","SER"]
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname in polars:
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_mets():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="MET" or resname=="MSE":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_glu_asp():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="GLU" or resname=="ASP":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
def highlight_arg_lys():
mol_id=active_residue()[0]
clear_ball_and_stick(mol_id)
for ch_id in chain_ids(mol_id):
sn_max=chain_n_residues(ch_id,mol_id)
for sn in range(0,sn_max+1):
resname=resname_from_serial_number(mol_id,ch_id,sn)
if resname=="ARG" or resname=="LYS":
seqnum=seqnum_from_serial_number(mol_id,ch_id,sn)
sel_string="//"+str(ch_id)+"/"+str(seqnum)+"/CA"
make_ball_and_stick(mol_id,sel_string,0,0.5,1)
#Make an alkyl chain of entered length and autofit to map if available
def make_alkyl_chain():
def make_alkyl_chain_length_n(n):
smiles_string=int(int(n)+1)*"c"
new_molecule_by_smiles_string("",smiles_string,force_libcheck=True)
delete_hydrogens(molecule_number_list()[-1])
mol_id=molecule_number_list()[-1]
ch_id="A"
res_no=1
ins_code=""
altloc=""
new_residue_name="UNL"
set_residue_name(mol_id,ch_id,res_no,ins_code,new_residue_name)
delete_atom(mol_id,ch_id,res_no,ins_code," C ",altloc)
prodrg_ify(mol_id,ch_id,res_no,ins_code)
close_molecule(molecule_number_list()[-1])
close_molecule(molecule_number_list()[-1])
if imol_refinement_map()!=-1:
fit_chain_to_map_by_random_jiggle(mol_id,ch_id,1000,0.1)
generic_single_entry("How many carbons do you want in the chain?",
"10","Make alkyl chain",make_alkyl_chain_length_n)
#Place helix and add helix restraints
def place_helix_with_restraints():
size_initial=len(model_molecule_number_list())
if place_helix_here():
size_after=len(model_molecule_number_list())
size_diff=size_after-size_initial
for i in range(1,size_diff+1):
mol_id=model_molecule_number_list()[-i]
set_b_factor_molecule(mol_id,default_new_atoms_b_factor())
graphics_to_rainbow_representation(mol_id)
ch_id=""
res1=seqnum_from_serial_number(mol_id,ch_id,0)
res2=last_polymer_residue(mol_id,ch_id)
for resn in range(res1,res2-2):
add_extra_bond_restraint(mol_id,
ch_id, resn , "", " O ", "",
ch_id, resn + 3, "", " N ", "",
3.3, 0.1)
if (resn + 4 <= res2):
add_extra_bond_restraint(mol_id,
ch_id, resn , "", " O ", "",
ch_id, resn + 4, "", " N ", "",
2.9, 0.05)
#Make new helix (don't fit)
def place_new_helix():
def place_new_helix_entry(n):
get_monomer_no_H("ALA")
mol_id=model_molecule_list()[-1]
ch_id=chain_ids(mol_id)[0]
res_no=1
ins_code=""
altloc=""
delete_atom(mol_id,ch_id,1,ins_code," OXT",altloc)
res_type="auto"
for i in range(1,int(n)):
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-57.82,-47)
res_no=res_no+1
generic_single_entry("How many residues for helix?",
"10","Place helix",place_new_helix_entry)
#Make new strand (don't fit)
def place_new_strand():
def place_new_strand_entry(n):
get_monomer_no_H("ALA")
mol_id=model_molecule_list()[-1]
ch_id=chain_ids(mol_id)[0]
res_no=1
ins_code=""
altloc=""
delete_atom(mol_id,ch_id,1,ins_code," OXT",altloc)
res_type="auto"
for i in range(1,int(n)):
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-139,135)
res_no=res_no+1
generic_single_entry("How many residues for strand?",
"10","Place strand",place_new_strand_entry)
#Make new 3-10 helix (don't fit)
def place_new_3_10_helix():
def place_new_3_10_helix_entry(n):
get_monomer_no_H("ALA")
mol_id=model_molecule_list()[-1]
ch_id=chain_ids(mol_id)[0]
res_no=1
ins_code=""
altloc=""
delete_atom(mol_id,ch_id,1,ins_code," OXT",altloc)
res_type="auto"
for i in range(1,int(n)):
add_terminal_residue_using_phi_psi(mol_id,ch_id,res_no,
res_type,-49,-26)
res_no=res_no+1
generic_single_entry("How many residues for 3-10 helix?",
"10","Place 3-10 helix",place_new_3_10_helix_entry)
#Merge two chains (throw error msg if they overlap in numbering)
#This needs fixing - says selections overlap in cases where sel1 has one segment on either side from sel2
#Fixed now, I think.
def merge_chains():
def merge_chains_by_click(res1,res2):
mol_id_1=res1[1]
mol_id_2=res2[1]
ch_id_1=res1[2]
ch_id_2=res2[2]
first_res_sel1=first_residue(mol_id_1,ch_id_1)
last_res_sel1=last_residue(mol_id_1,ch_id_1)
first_res_sel2=first_residue(mol_id_2,ch_id_2)
last_res_sel2=last_residue(mol_id_2,ch_id_2)
size_2=abs(last_res_sel2-first_res_sel2)
size_1=abs(last_res_sel1-first_res_sel1)
if (mol_id_1!=mol_id_2) or (ch_id_1==ch_id_2):
info_dialog("No can do, chains must be in the same mol and have non-overlapping ranges!")
elif (mol_id_1==mol_id_2) and (ch_id_1!=ch_id_2) and (size_1<=size_2):
out=change_chain_id_with_result(mol_id_1,ch_id_1,ch_id_2,1,first_res_sel1,last_res_sel1)
if out[0]==0:
info_dialog(out[1])
elif (mol_id_1==mol_id_2) and (ch_id_1!=ch_id_2) and (size_2<size_1):
out=change_chain_id_with_result(mol_id_1,ch_id_2,ch_id_1,1,first_res_sel2,last_res_sel2)
if out[0]==0:
info_dialog(out[1])
else:
info_dialog("No can do, chains must be in the same mol and have non-overlapping ranges!")
user_defined_click(2,merge_chains_by_click)
#Renumber active segment by active residue
def renumber_seg_by_active_res():
def renum_seg(new_num):
new_num=int(new_num)
current_num=active_residue()[2]
mol_id=active_residue()[0]
ch_id=active_residue()[1]
seg_count=0
segments=segment_list(mol_id)
last_res=last_polymer_residue(mol_id,ch_id)
print(last_res)
first_res=first_residue(mol_id,ch_id)
print(first_res)
new_seg_list=[]
for seg in segments:
if ch_id==seg[1]:
new_seg_list.append(seg)
print(new_seg_list)
for seg in new_seg_list:
seg_count=seg_count+1
if (current_num>=seg[2]) and (current_num<=seg[3]):
res_start=seg[2]
res_end=seg[3]
ch_id=seg[1]
if res_end<last_res:
seg_next=new_seg_list[seg_count]
if res_start>first_res:
seg_prev=new_seg_list[seg_count-2]
offset=new_num-current_num
if ((((res_start==first_res) or (res_start+offset)>seg_prev[3])) and (((res_end==last_res) or (res_end+offset)<seg_next[2]))):
renumber_residue_range(mol_id,ch_id,res_start,res_end,int(offset))
else:
info_dialog("No can do, this would result in overlapping sequence numbering!")
delete_all_extra_restraints(mol_id)
set_show_extra_restraints(mol_id,0)
set_show_extra_restraints(mol_id,1)
generic_single_entry("New number for this residue?",
str(active_residue()[2]),"Renumber",renum_seg)
#Fit all segments to map
def rigid_body_fit_segments():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
segments=segment_list(mol_id)
for seg in segments:
res_start=seg[2]
res_end=seg[3]
ch_id=seg[1]
turn_off_backup(mol_id)
set_refinement_immediate_replacement(1)
rigid_body_refine_zone(res_start,res_end,ch_id,mol_id)
accept_regularizement()
set_refinement_immediate_replacement(0)
turn_on_backup(mol_id)
#Fit current segment
def fit_this_segment():
if (imol_refinement_map()==-1):
info_dialog("You must set a refinement map!")
else:
mol_id=active_residue()[0]
segments=segment_list(mol_id)
res_here=active_residue()[2]
ch_id=active_residue()[1]
for seg in segments:
if (res_here>=seg[2]) and (res_here<=seg[3]) and (ch_id==seg[1]):
res_start=seg[2]
res_end=seg[3]
ch_id=seg[1]
turn_off_backup(mol_id)
set_refinement_immediate_replacement(1)
rigid_body_refine_zone(res_start,res_end,ch_id,mol_id)
accept_regularizement()
set_refinement_immediate_replacement(0)
turn_on_backup(mol_id)
#Set default b-fac for new atoms to mean B for active mol
def set_new_atom_b_fac_to_mean():
mol_id=active_residue()[0]
mean_b=average_temperature_factor(mol_id)
set_default_temperature_factor_for_new_atoms(mean_b)
#Shortcut for adding terminal residue (to bind to key)
def add_term_shortcut():
if imol_refinement_map()!=-1:
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
first_in_seg=first_residue_in_seg(mol_id,ch_id,resn)
last_in_seg=last_residue_in_seg(mol_id,ch_id,resn)
delta_first=abs(first_in_seg-resn)
delta_last=abs(last_in_seg-resn)
set_new_atom_b_fac_to_mean()
if delta_first<=delta_last:
set_go_to_atom_chain_residue_atom_name(ch_id,first_in_seg,"CA")
add_terminal_residue(mol_id,ch_id,first_in_seg,"auto",1)
sort_residues(mol_id)
set_go_to_atom_chain_residue_atom_name(ch_id,first_in_seg-1,"CA")
else:
set_go_to_atom_chain_residue_atom_name(ch_id,last_in_seg,"CA")
add_terminal_residue(mol_id,ch_id,last_in_seg,"auto",1)
sort_residues(mol_id)
set_go_to_atom_chain_residue_atom_name(ch_id,last_in_seg+1,"CA")
else:
info_dialog("You must set a refinement map!")
def add_term_shortcut_force():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
resn=active_residue()[2]
first_in_seg=first_residue_in_seg(mol_id,ch_id,resn)
last_in_seg=last_residue_in_seg(mol_id,ch_id,resn)
delta_first=abs(first_in_seg-resn)
delta_last=abs(last_in_seg-resn)
set_new_atom_b_fac_to_mean()
if delta_first<=delta_last:
set_go_to_atom_chain_residue_atom_name(ch_id,first_in_seg,"CA")
force_add_terminal_residue_noclick(mol_id,ch_id,first_in_seg)
sort_residues(mol_id)
set_go_to_atom_chain_residue_atom_name(ch_id,first_in_seg-1,"CA")
else:
set_go_to_atom_chain_residue_atom_name(ch_id,last_in_seg,"CA")
force_add_terminal_residue_noclick(mol_id,ch_id,last_in_seg)
sort_residues(mol_id)
set_go_to_atom_chain_residue_atom_name(ch_id,last_in_seg+1,"CA")
#Add h-bond restraints to active mol with Prosmart
def run_prosmart_self():
"""
target is my molecule, ref is the homologous (high-res) model
extra arg: include_side_chains=False
"""
imol_target=active_residue()[0]
dir_stub = "coot-ccp4"
prosmart_dir="ProSMART_Output"
make_directory_maybe(dir_stub)
make_directory_maybe(prosmart_dir)
target_pdb_file_name = os.path.join(dir_stub,
molecule_name_stub(imol_target, 0).replace(" ", "_") + \
"-prosmart.pdb")
prosmart_out = os.path.join("ProSMART_Output",
molecule_name_stub(imol_target, 0).replace(" ", "_") + \
"-prosmart.txt")
write_pdb_file(imol_target, target_pdb_file_name)
prosmart_exe = find_exe("prosmart")
if prosmart_exe:
l = ["-p1", target_pdb_file_name,
"-h","-self_restrain","-bond_max","4.0","-bond_override", "2","-o",prosmart_dir]
popen_command(prosmart_exe,
l,
[],
os.path.join(dir_stub, "prosmart.log"),
False)
if (not os.path.isfile(prosmart_out)):
print "file not found", prosmart_out
else:
print "Reading ProSMART restraints from", prosmart_out
add_refmac_extra_restraints(imol_target, prosmart_out)
#Fix all atoms in active residue
def fix_active_residue():
ar=active_residue() #ar[0] is mol_id, 1 is ch_id, 2 is resnum, 3 is ins code, 4 is atom name (CA) and 5 is alt conf
residue_info_list=residue_info(ar[0],ar[1],ar[2],ar[3])
atom_list=[]
for item in residue_info_list: # residue item is list of list of lists. first item in first list of each list in the list is the atom name :-)
atom_name=item[0][0]
atom_info=[ar[1],ar[2],ar[3],atom_name,ar[5]] #Make a list of chain id, res number, ins code, atom name and alt conf. Not sure if alt conf and ins code are right way around here...
atom_list.append(atom_info)
mark_multiple_atoms_as_fixed(ar[0],atom_list,1)
#Save and overwrite active model:
def quicksave_active():
import shutil
mol_id=active_residue()[0]
filename=molecule_name(mol_id)
filename_bak=filename+".bak"
shutil.copy(filename,filename_bak)
save_coordinates(mol_id,filename)
info_dialog("Saved {filename} (molecule {mol_id}). \n If this was an accident, you can find a backup of the original file here: \n {filename_bak}".format(filename=filename,mol_id=mol_id,filename_bak=filename_bak))
#Refresh model from file (if changed externally for example)
def reload_model():
mol_id=active_residue()[0]
filename=molecule_name(mol_id)
clear_and_update_model_molecule_from_file(mol_id,filename)
#Copy changes from active chain to NCS equivalents.
def copy_ncs_chain_from_active():
mol_id=active_residue()[0]
ch_id=active_residue()[1]
ncs_control_change_ncs_master_to_chain_id(mol_id,ch_id)
copy_from_ncs_master_to_others(mol_id,ch_id)
#Test post manipulation background func
# import time, threading
# def background_func():
# threading.Timer(0.01, post_manip_background).start()
# if condition:
# do something
# post_manip_background()
# def post_manipulation_script(imol, mode):
# print "BL DEBUG:: imol and mode", imol, mode
# if (mode == DELETED):
# print "BL DEBUG:: deleted something in mol ", imol
# return 1
#
# def post_manipulation_script2(imol, mode):
# print "BL DEBUG:: imol and mode", imol, mode
# if (mode == MUTATED):
# print "BL DEBUG:: moved something in mol ", imol
# return 1
#****Make and arrange menus****
menu=coot_menubar_menu("Custom")
#make submenus
submenu_display=gtk.Menu()
menuitem_2=gtk.MenuItem("Display...")
menuitem_2.set_submenu(submenu_display)
menu.append(menuitem_2)
menuitem_2.show()
submenu_fit=gtk.Menu()
menuitem_3=gtk.MenuItem("Fit...")
menuitem_3.set_submenu(submenu_fit)
menu.append(menuitem_3)
menuitem_3.show()
submenu_renumber=gtk.Menu()
menuitem_4=gtk.MenuItem("Renumber...")
menuitem_4.set_submenu(submenu_renumber)
menu.append(menuitem_4)
menuitem_4.show()
submenu_settings=gtk.Menu()
menuitem_5=gtk.MenuItem("Settings...")
menuitem_5.set_submenu(submenu_settings)
menu.append(menuitem_5)
menuitem_5.show()
submenu_build=gtk.Menu()
menuitem_6=gtk.MenuItem("Build...")
menuitem_6.set_submenu(submenu_build)
menu.append(menuitem_6)
menuitem_6.show()
submenu_mutate=gtk.Menu()
menuitem_7=gtk.MenuItem("Mutate...")
menuitem_7.set_submenu(submenu_mutate)
menu.append(menuitem_7)
menuitem_7.show()
submenu_copy=gtk.Menu()
menuitem_8=gtk.MenuItem("Copy...")
menuitem_8.set_submenu(submenu_copy)
menu.append(menuitem_8)
menuitem_8.show()
submenu_delete=gtk.Menu()
menuitem_9=gtk.MenuItem("Delete...")
menuitem_9.set_submenu(submenu_delete)
menu.append(menuitem_9)
menuitem_9.show()
submenu_merge=gtk.Menu()
menuitem_10=gtk.MenuItem("Merge...")
menuitem_10.set_submenu(submenu_merge)
menu.append(menuitem_10)
menuitem_10.show()
submenu_maps=gtk.Menu()
menuitem_11=gtk.MenuItem("Maps...")
menuitem_11.set_submenu(submenu_maps)
menu.append(menuitem_11)
menuitem_11.show()
#**** Populate submenus ****
#"Display..."
add_simple_coot_menu_menuitem(submenu_display, "All Molecules use \"C-alpha\" Symmetry", lambda func: map(lambda imol: valid_model_molecule_qm(imol) and symmetry_as_calphas(imol, 1), molecule_number_list()))
add_simple_coot_menu_menuitem(submenu_display, "Toggle Symmetry",
lambda func: set_show_symmetry_master(not get_show_symmetry()))
add_simple_coot_menu_menuitem(submenu_display, "Clear labels and distances",
lambda func: clear_distances_and_labels())
add_simple_coot_menu_menuitem(submenu_display,
"Switch all mols to CA representation",lambda func: all_mols_to_ca())
add_simple_coot_menu_menuitem(submenu_display,
"Make copy of active mol colored by rotamer prob (Slow!)", lambda func: make_rotamer_colored_copy())
add_simple_coot_menu_menuitem(submenu_display,
"Make copy of active mol colored by missing atoms (Slow!)", lambda func: make_missing_atoms_colored_copy())
add_simple_coot_menu_menuitem(submenu_display, "Highlight chain breaks in active mol", lambda func: highlight_chain_breaks())
add_simple_coot_menu_menuitem(submenu_display, "Highlight glycines in active mol", lambda func: highlight_glycines())
add_simple_coot_menu_menuitem(submenu_display, "Highlight cysteines in active mol", lambda func: highlight_cys())
add_simple_coot_menu_menuitem(submenu_display, "Highlight prolines in active mol", lambda func: highlight_prolines())
add_simple_coot_menu_menuitem(submenu_display, "Highlight polars in active mol", lambda func: highlight_polars())
add_simple_coot_menu_menuitem(submenu_display, "Highlight methionines in active mol", lambda func: highlight_mets())
add_simple_coot_menu_menuitem(submenu_display, "Highlight Glu/Asp in active mol", lambda func: highlight_glu_asp())
add_simple_coot_menu_menuitem(submenu_display, "Highlight Arg/Lys in active mol", lambda func: highlight_arg_lys())
#"Fit..."
add_simple_coot_menu_menuitem(submenu_fit, "Fit all chains to map",
lambda func: rigid_fit_all_chains())
add_simple_coot_menu_menuitem(submenu_fit, "Fit current chain to map",
lambda func: rigid_fit_active_chain())
add_simple_coot_menu_menuitem(submenu_fit,
"Jiggle-fit current chain to map (Slow!)", lambda func: jiggle_fit_active_chain())
add_simple_coot_menu_menuitem(submenu_fit,
"Jiggle-fit current chain to B-smoothed map (Slow!)", lambda func: jiggle_fit_active_chain_smooth())
add_simple_coot_menu_menuitem(submenu_fit, "Jiggle-fit all chains to map (very slow!)",
lambda func: jiggle_fit_all_chains())
add_simple_coot_menu_menuitem(submenu_fit,
"Jiggle-fit current mol to map (Slow!)", lambda func: jiggle_fit_active_mol())
add_simple_coot_menu_menuitem(submenu_fit,
"Fit polyala loop (click start and end)", lambda func: fit_polyala_gui())
add_simple_coot_menu_menuitem(submenu_fit, "Fit all segments", lambda func: rigid_body_fit_segments())
add_simple_coot_menu_menuitem(submenu_fit, "Fit this segment", lambda func: fit_this_segment())
add_simple_coot_menu_menuitem(submenu_fit,
"Prosmart self restrain active mol",lambda func: run_prosmart_self())
#"Renumber..."
add_simple_coot_menu_menuitem(submenu_renumber, "Renumber active chain by first res",
lambda func: renumber_by_first_res())
add_simple_coot_menu_menuitem(submenu_renumber,
"Renumber active chain by last res", lambda func: renumber_by_last_res())
add_simple_coot_menu_menuitem(submenu_renumber,
"Renumber active chain by current res", lambda func: renumber_by_active_res())
add_simple_coot_menu_menuitem(submenu_renumber,"Renumber from N-term to active residue",
lambda func: renumber_n_term_segment())
add_simple_coot_menu_menuitem(submenu_renumber,"Renumber from active residue to C-term",
lambda func: renumber_c_term_segment())
add_simple_coot_menu_menuitem(submenu_renumber, "Renumber segment by active res", lambda func: renumber_seg_by_active_res())
#"Settings..."
add_simple_coot_menu_menuitem(submenu_settings,
"Auto-scale B-factor coloring for active mol",lambda func: autoscale_b_factor())
add_simple_coot_menu_menuitem(submenu_settings,
"Set Bfac for new atoms to mean B for active mol",lambda func: set_new_atom_b_fac_to_mean())
#"Build..."
add_simple_coot_menu_menuitem(submenu_build,
"Forced addition of terminal residue (click terminus)",
lambda func: force_add_terminal_residue())
add_simple_coot_menu_menuitem(submenu_build,
"Grow helix (click terminus)",
lambda func: grow_helix())
add_simple_coot_menu_menuitem(submenu_build,
"Grow strand (click terminus)",
lambda func: grow_strand())
add_simple_coot_menu_menuitem(submenu_build,
"Grow parallel strand (click terminus)",
lambda func: grow_parallel_strand())
add_simple_coot_menu_menuitem(submenu_build,
"Grow 3-10 helix (click terminus)",
lambda func: grow_helix_3_10())
add_simple_coot_menu_menuitem(submenu_build,
"Shorten loop by one residue", lambda func: shorten_loop())
add_simple_coot_menu_menuitem(submenu_build,
"Lengthen loop by one residue", lambda func: lengthen_loop())
add_simple_coot_menu_menuitem(submenu_build,
"Get fractional coordinates of active atom",lambda func: get_fract_coords())
add_simple_coot_menu_menuitem(submenu_build,
"Common monomers",lambda func: pick_common_monomers())
add_simple_coot_menu_menuitem(submenu_build, "Make alkyl chain of length n", lambda func: make_alkyl_chain())
add_simple_coot_menu_menuitem(submenu_build, "Make alpha helix of length n", lambda func: place_new_helix())
add_simple_coot_menu_menuitem(submenu_build, "Make 3-10 helix of length n", lambda func: place_new_3_10_helix())
#"Mutate...
add_simple_coot_menu_menuitem(submenu_mutate,
"Mutate range to UNK (click start and end)", lambda func: mutate_residue_range_by_click_a())
add_simple_coot_menu_menuitem(submenu_mutate,
"Mutate range to ALA (click start and end)", lambda func: mutate_residue_range_by_click_ala_a())
add_simple_coot_menu_menuitem(submenu_mutate, "Mutate all Mets to MSE", lambda func: mutate_all_mets_to_mse())
add_simple_coot_menu_menuitem(submenu_mutate, "Mutate all MSEs to Met", lambda func: mutate_all_mse_to_met())
add_simple_coot_menu_menuitem(submenu_mutate,
"Mutate active chain to template sequence (numbering must match sequence!)", lambda func: mutate_by_resnum())
#"Copy..."
add_simple_coot_menu_menuitem(submenu_copy, "Copy current chain",
lambda func: copy_active_chain())
add_simple_coot_menu_menuitem(submenu_copy, "Cut current chain",
lambda func: cut_active_chain())
add_simple_coot_menu_menuitem(submenu_copy, "Copy active segment", lambda func: copy_active_segment())
add_simple_coot_menu_menuitem(submenu_copy, "Cut active segment", lambda func: cut_active_segment())
add_simple_coot_menu_menuitem(submenu_copy,
"Copy fragment (click start and end)", lambda func: copy_frag_by_click())
add_simple_coot_menu_menuitem(submenu_copy,
"Cut fragment (click start and end)", lambda func: cut_frag_by_click())
add_simple_coot_menu_menuitem(submenu_copy,
"Copy active chain to NCS equivs", lambda func: copy_ncs_chain_from_active())
#"Delete..."
add_simple_coot_menu_menuitem(submenu_delete,
"Delete active chain", lambda func: delete_chain())
add_simple_coot_menu_menuitem(submenu_delete,
"Delete hydrogens from molecule", lambda func: delete_h_active())
add_simple_coot_menu_menuitem(submenu_delete,
"Delete sidechains in range (click start and end)", lambda func: delete_sidechain_range_by_click_a())
#"Merge..."
add_simple_coot_menu_menuitem(submenu_merge,
"Merge two mols (click two; 2nd into 1st)", lambda func: merge_fragments())
add_simple_coot_menu_menuitem(submenu_merge, "Merge chains (click two; 2nd into 1st)", lambda func: merge_chains())
#"Maps..."
add_simple_coot_menu_menuitem(submenu_maps,
"Sharpen (enter B-factor)",lambda func: sharpen_by_entered_factor())
add_simple_coot_menu_menuitem(submenu_maps,
"Change hi-res limit for map",lambda func: change_hires_limit_copy())
add_simple_coot_menu_menuitem(submenu_maps,
"Go to center of scrollable map",lambda func: goto_center_of_map())
|