required vs optional

James Bonfield jkb at mrc-lmb.cam.ac.uk
Thu Feb 8 14:46:27 UTC 2001


On Thu, Feb 08, 2001 at 01:13:45PM +0000, Peter Rice wrote:
> OK. Since you are a good boy (i.e. you can cope with ACD expressions and
> stuff) let us experiment with a new option for GUIs only.
> 
> How about:
> 
> needed:y or needed:n
> 
> default value would be assumed to be (parameter or required or optional)
> unless you think a default of Y is better.

I think that's enough. The default will indeed cover most cases. I'll need to
ponder about the best way to code this default, but I guess that's my problem
:-}

On a related note, I've just had a hunt for cases where param and req are both
specified differently. I found one case in vectorstrip:

...
bool: vectorfile [ 
        param: Y 
        def: Y 
        prompt: "Are your vector sequences in a file?" 
] 
 
infile: vectors [ 
        param: Y 
        req: @($(vectorfile)?Y:N) 
        nullok: Y 
        def: "" 
        prompt: "Name of vectorfile" 
] 
...

The help lists this as:

   Mandatory qualifiers (* if not always prompted):
  [-sequence]          seqall     (no help text) seqall value
  [-[no]vectorfile]    bool       Are your vector sequences in a file?
* [-vectors]           infile     Name of vectorfile
*  -linkera            string     5' sequence
*  -linkerb            string     3' sequence
   -mismatch           integer    Max allowed % mismatch
   -[no]besthits       bool       Show only the best hits (minimise
                                  mismatches)?
  [-outf]              outfile    (no help text) outfile value
  [-outseq]            seqoutall  (no help text) seqoutall value

   Optional qualifiers: (none)
   Advanced qualifiers: (none)

So on the command line we can do:

vectorstrip dna.embl 1 vector_file outfile

This asks a few remaining questions, then uses a vector file named
vector_file, and finally saves the results to outfile.

However if I try:

vectorstrip dna.embl 0 outfile

then I have problems because outfile isn't a vector file. To specify this
correctly I have to use:

vectorstrip dna.embl 0 vector_file outfile

vector_file must exist, even though it's not used.
This is because of specifying both req and param. Param is always Y regardless 

of the previous question, but it's not always required. This makes sense when
specifying "-qualifier value" syntax, but not with the param syntax. I've
checked and the following works as I originally expected:

infile: vectors [ 
        param: @($(vectorfile)?Y:N) 
        nullok: Y 
        def: "" 
        prompt: "Name of vectorfile" 
] 

However this does mean there's a different number of items on the command line 

depending on whether vectorfile was set or not, however such things are
presumably only an issue for programs invoking vectorstrip, in which case
they'd be more self-documenting if they use -qualifier anyway.

James

-- 
James Bonfield (jkb at mrc-lmb.cam.ac.uk)   Tel: 01223 402499   Fax: 01223 213556
Medical Research Council - Laboratory of Molecular Biology,
Hills Road, Cambridge, CB2 2QH, England.
Also see Staden Package WWW site at http://www.mrc-lmb.cam.ac.uk/pubseq/






More information about the emboss-dev mailing list