ViewDock: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
m (updated code)
Line 3: Line 3:
== Keyboard shortcuts ==
== Keyboard shortcuts ==


Using ViewDock as designed requires a fair amount of clicking and mouse movement. To reduce these one option is to do the following.
Using ViewDock requires a fair amount of clicking and mouse movement. To reduce these you can use this [https://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/accelerators/accelerators.html#adding Chimera accelerators script], written by Tom Goddard ([http://plato.cgl.ucsf.edu/pipermail/chimera-users/2020-March/016642.html] Chimer user list discussion):


Create a [https://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/accelerators/accelerators.html#adding Chimera accelerators script] containing this code, originally written by Tom Goddard:
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)       
                                                                                   
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[0]                                                             
          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_dialog():                                                               
    from ViewDock import ViewDock                                                 
    from chimera import extension                                                 
    for vd in extension.manager.instances:                                       
        if isinstance(vd, ViewDock):                                              
            return vd                                                             
    return None     


def register_accelerators():
To use, [https://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/accelerators/accelerators.html#dialog enable Chimera keyboard shortcuts] and load the new file.
    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)
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_dialog():
    from ViewDock import ViewDock
    from chimera import extension
    for vd in extension.manager.instances:
        if isinstance(vd, ViewDock):
            return vd
    return None


Then [https://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/accelerators/accelerators.html#dialog 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"
 
When looking at your compounds, initially assign them all status "Deleted" and show only "Deleted" compounds by choosing Compounds > List Deleted in the compound table dialog. Use accelerators "cv"and "cx" to reassign "Purged", and "Viable" statuses.

Revision as of 13:51, 30 March 2020

ViewDock is a UCSF Chimera extension for viewing outputs from several docking software packages. There is a tutorial on the Chimera web pages.

Keyboard shortcuts

Using ViewDock requires a fair amount of clicking and mouse movement. To reduce these you can use this Chimera accelerators script, written by Tom Goddard ([1] Chimer user list discussion):

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)         
                                                                                   
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[0]                                                              
          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_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"