ChimeraX and Isolde
Useful script for labelling secondary structure in ChimeraX:
label_height=2
fromchimerax.atomicimportall_atomic_structures
forsinall_atomic_structures(session):
helix_label_targets= []
strand_label_targets= []
cur_key=None
ss_run= []
forrins.residues:
ifr.ss_type==r.SS_COIL:
key=None
else:
key= (r.chain_id, r.ss_type, r.ss_id)
ifkey==cur_key:
ifkeyisnotNone:
ss_run.append(r)
continue
ifcur_keyisnotNone:
mid_res=ss_run[int(len(ss_run)/2)]
ifcur_key[1] ==r.SS_HELIX:
helix_label_targets.append(mid_res)
else:
strand_label_targets.append(mid_res)
ss_run= []
ifkeyisnotNone:
ss_run.append(r)
cur_key=key
ifcur_keyisnotNone:
mid_res=ss_run[int(len(ss_run)/2)]
ifcur_key[1] ==r.SS_HELIX:
helix_label_targets.append(mid_res)
else:
strand_label_targets.append(mid_res)
fromchimerax.core.commandsimportrun
fromchimerax.atomicimportconcise_residue_spec
prefix='{0.chain_id} 'ifs.num_chains>1else""
ifhelix_label_targets:
run(session, "label %s residues text '%sα{0.ss_id}' height %g"% (concise_residue_spec(session,
helix_label_targets), prefix, label_height))
ifstrand_label_targets:
run(session, "label %s residues text '%sβ{0.ss_id}' height %g"% (concise_residue_spec(session,
strand_label_targets), prefix, label_height))