ViewDock: Difference between revisions

From DISI
Jump to navigation Jump to search
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
[https://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/viewdock/framevd.html ViewDock] is a [https://www.cgl.ucsf.edu/chimera/ UCSF Chimera] extension for viewing outputs from several docking software packages. There is a [https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/vdtut.html tutorial] on the Chimera web pages.
[https://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/viewdock/framevd.html ViewDock] is a [https://www.cgl.ucsf.edu/chimera/ UCSF Chimera] extension for viewing output poses from several docking software packages. There is a [https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/vdtut.html tutorial] on the Chimera web pages.


== 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, mostly written by Tom Goddard ([http://plato.cgl.ucsf.edu/pipermail/chimera-users/2020-March/016642.html Chimera 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:
<nowiki>
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[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_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
</nowiki>


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" 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).


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.
== ChimeraX/ViewDockX ==
 
There is an equivalent tool [https://www.cgl.ucsf.edu/chimerax/docs/user/tools/viewdockx.html ViewDockX] in the next generation visualisation tool [https://www.cgl.ucsf.edu/chimerax/ ChimeraX].

Latest revision as of 16:58, 16 April 2020

ViewDock is a UCSF Chimera extension for viewing output poses 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, mostly written by Tom Goddard (Chimera 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)       
  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[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_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).

ChimeraX/ViewDockX

There is an equivalent tool ViewDockX in the next generation visualisation tool ChimeraX.