def register_accelerators(): from Accelerators import standard_accelerators standard_accelerators.register_accelerators() from Accelerators import add_accelerator add_accelerator('cd', 'Mark current View Dock compound deleted', vdock_delete) add_accelerator('cx', 'Mark current View Dock compound purged', vdock_purged) add_accelerator('cv', 'Mark current View Dock compound viable', vdock_viable) add_accelerator('cn', 'Move to next View Dock compound', vdock_next) add_accelerator('cp', 'Move to next View Dock compound', vdock_previous) add_accelerator('ct', 'Print ViewDock totals to Reply Log', vdock_totals) def vdock_delete(): from ViewDock.Compound import Compound vdock_set_state(Compound.Deleted) def vdock_purged(): from ViewDock.Compound import Compound vdock_set_state(Compound.Purged) def vdock_viable(): from ViewDock.Compound import Compound vdock_set_state(Compound.Viable) def vdock_set_state(state): vd = vdock_dialog() if vd: vd.results.setSelectedState(state) vd._reloadCompounds() def vdock_next(): vdock_step(1) def vdock_previous(): vdock_step(-1) def vdock_step(step): vd = vdock_dialog() if vd: r = vd.results csel = r.selected if csel: c = csel clist = r.compoundList i = clist.index(c) if i+step < len(clist) and i+step >= 0: nextc = clist[i+step] vd.results.setSelected([nextc]) def vdock_totals(): from ViewDock.Compound import Compound print "Counting ViewDock molecules" vd = vdock_dialog() if vd: r = vd.results clist = r.compoundList if clist: n_total = 0 n_viable = 0 n_deleted = 0 n_purged = 0 for c in clist: n_total += 1 if c.state == Compound.Viable: n_viable += 1 elif c.state == Compound.Deleted: n_deleted += 1 elif c.state == Compound.Purged: n_purged += 1 print n_total, "total compounds." print n_viable, "viable compounds." print n_deleted, "deleted compounds." print n_purged, "purged compounds." print "Keep at it!" def vdock_dialog(): from ViewDock import ViewDock from chimera import extension for vd in extension.manager.instances: if isinstance(vd, ViewDock): return vd return None
To use, enable Chimera keyboard shortcuts and load the new file.
Accelerators "cv" (Viable), "cd" (Delete), "cx" (Purge), work like clicking the radio buttons in the ViewDock dialog box - they change the status of the selected compound. Accelerators "cn" and "cp" move forward or back one compound. "ct" counts the compounds with each status, the output is shown in the Chimera "Reply Log" (Tools > Utilities > Reply Log).