Proposed CCP4i Plugins

Peter Briggs 22nd December 2006

This document outlines the ideas underlying "plugin modules" for CCP4i, which would allow CCP4i to invoke external applications in a variety of different contexts.

Functionality seen from the user perspective

A concrete example of this would be to provide a way to launch a relevant application from the "View Files From Job" menu for specific tasks. The example that is typically cited is that the user would see additional options in the menu for a Refmac job that would allow Coot or CCP4mg to be launched with the appropriate files to see the results of the refinement - see the figure for an indication of how this might appear to the user:

In this example, upon selecting the "View files in Coot" option, CCP4i would invoke the appropriate command for launching the program as a background process, e.g.:

exec /home/pjx/CCP4_CVS/ccp4/bin/coot --no-state-script \
     --pdb /home/pjx/PROJECTS/myProject/toxd_refmac1.pdb \
     --auto /home/pjx/PROJECTS/myProject/toxd_refmac1.mtz &

Some ideas on how to achieve this

The core change required to implement this in CCP4i is to modify the existing DbViewJobMenu procedure (in the database.tcl file). This procedure is responsible for generating the menu that is drawn when the user selects a job and then clicks on "View Files From Job". Additional code could be added of the form:

  # Acquire taskname and look for plugins
  set taskname [DbGetJobData $job_id TASKNAME]
  set plugins [GetPlugins $taskname $filelist]
  foreach plugin $plugins {
      puts "Adding [lindex $plugin 0]: [lindex $plugin 1]"
      $mm add command -label "[lindex $plugin 0]" \
	  -font $configure(FONT_REGULAR) \
	  -command "[lindex $plugin 1]"
  }

which would add additional menu items for each of the "plugins" found.

A new procedure GetPlugins would contain the new code that would look up possible external applications based on the name of the task, the list of files (here only the output files are sent to GetPlugins) and the availability of the applications.

The GetPlugins procedure would return a list of plugins giving the text that should appear in the menu, and the command to be executed when the plugin option is selected, for example:

{ "View results in Coot" { exec /home/pjx/CCP4_CVS/ccp4/bin/coot --no-state-script ... } }

The remaining work is to implement the GetPlugins procedure. The simplest way to implement this would be to hard-code custom checks on the taskname and file list for every possible application. This would be relatively inflexible but has the merits of being quick to add. So it would be worth considering this approach as a first step.

A more extensible approach would provide a more generic mechanism that allowed CCP4i to be configured at runtime, either through a data file containing the necessary information for each of the applications or by sourcing additional files that could be dropped into the distribution.

In either case the user might also wish to have some control over which plugins are presented to them by CCP4i, with the provision of some configuration or preference options.

The level of generality required depends on a number of factors. The key ones that I can think of now are:

Possible plugin candidates

The table below lists the candidates for plugins so far considered; please let me know of any other possibilities that I can add here.

Program Mode Requires Gotchas Command
Coot View results of refinement from Refmac Task is Refmac5; MTZ file with default Refmac labels; PDB file with refined coordinates; (optional) CIF with additional dictionaries. Need to be able to distinguish dictionary CIF from data harvesting output CIF coot --no-state-script --auto $mtz --pdb $pdb --dictionary $cif
CCP4mg ? ? ? Generally: ccp4mg -pdb $pdb -map $map -mtz $mtz

Additional Suggestions

From Francois Remacle:

From Ronan Keegan:

From Kevin Cowtan:

From Paul Emsley:

From Liz Potterton: