Hello,
Is there any way to "attach" (associate the display status of) a generic_object to a molecule?
I use the appended function to highlight chain breaks with dashed lines and to ball-and-stickify the chain termini, which makes it easier to trace connectivity of complex molecules. This works well enough to be useful, but it would be better if the dashed lines were undisplayed/redisplayed in concert with the molecule to which they pertain. Is there a function in Coot for this? "to_generic_object_add_display_list_handle()" seems like a likely candidate, but doesn't seem to be exactly what I'm after.
Cheers,
Oli
Function (relies on some other functions, see full script here: https://www.dropbox.com/s/0b4bebwxw0p9x0e/oli_custom.py?dl=0 ):
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)
|