first previous next last contents

Calling the New Command

Once the Ok callback from the okcancelhelp widget in the main dialogue has been executed we need to process any options the user has changed within the dialogue and pass these on to the main algorithms.

For the extension widget we set the OK callback to execute a Composition2 procedure. This starts as follows.

# The actual gubbins. This can be either in straight tcl, or using Tcl and
# C. In this example, for efficiency, we'll do most of the work in C.
proc Composition2 {io t id infile} {
    # Process the dialogue results:
    if {[lorf_in_get $infile] == 4} {
        # Single contig
        set name [contig_id_gel $id]
        set lreg [contig_id_lreg $id]
        set rreg [contig_id_rreg $id]
        SetContigGlobals $io $name $lreg $rreg
        set list "{$name $lreg $rreg}"
    } elseif {[lorf_in_get $infile] == 3} {
        # All contigs
        set list [CreateAllContigList $io]
    } else {
        # List or File of contigs
        set list [lorf_get_list $infile]
    }

    # Remove the dialogue
    destroy $t

    # Do it!
    SetBusy
    set res [composition -io $io -contigs $list]
    ClearBusy

For this Gap4 command we have used the lorf_in widget to let the user select operations for a single contig, all contigs, a list of contigs, or a file of contigs. We firstly process this to build up the appropriate values to send to the -list option of the composition Tcl command. The processes involved here are explained in the lorf_in widget documentation. (FIXME: to write).

Next we remove the dialogue window, enable the busy mode to grey out other menu items, and execute the command itself saving its result in the Tcl res variable.

The procedure then continues by stepping through the res variable using tcl list and formatting commands to output to the main text window with the vmessage command. The complete code for this can be found in the appendices.


first previous next last contents
This page is maintained by staden-package. Last generated on 1 March 2001.
URL: http://www.mrc-lmb.cam.ac.uk/pubseq/manual/scripting_208.html