required vs optional

Peter Rice Peter.Rice at uk.lionbioscience.com
Wed Feb 7 18:18:20 UTC 2001


James Bonfield wrote:
> Incidently is there a list anywhere of all the default values? Eg including
> info, prompt, etc. Sometimes info: is used and sometimes prompt:, but often
> none are present. However emboss still prompts with an appropriate query -
> where does this come from? I can see some in the ajacd.c code, but not
> all. Besides reading the code to find the defaults isn't my idea of fun :-)

All very much cleaned up since PISE started building their interface.

All applications should be using info, and so should you. That was its
original purpose.

For cases where the prompt to the interactive user would be different, we
invented 'prompt:' which applications can use if available, but the
(unwritten) standard says that when prompts are being specified, info must
always be there.

However, certain data types have their own prompts. Sequence for example.
Those are defined interally as secret codes, and have their own automatic
prompts.

If you try the following:

% make check
% entrails   emboss.ent

Almost all will be revealed in file 'emboss.ent'. entrails was written for
interface developers who need to see these kinds of internals.

For some reason, the 'make check' applications do not get installed so you
need to run them from the original emboss directory.

It should be not too hard to add the default prompts to entrails.

Oops. I see it has the explanations swapped for input and output formats too.
Needs some work. Which means ... Let me know what internals you need to peek
at, and I can hack it for you while I fix the rest.

> Agreed. So just to clarify things, if the physical values or results from
> expressions give the following, then I need to enable or disable (grey-out)
> the question appropriately:
> 
> req          opt                greyed out
> Y            N                  N
> Y            Y                  N
> N            N                  N
> N            Y                  Y

Swap those last two. opt:y means it can be useful opt:n means you can change
it if you dare.
 
> Do req:N opt:N and req:Y opt:Y ever occur? They sound like inconsistencies.

They are rare, but they are possible (especially with expressions around).
EMBOSS only has to decide whether to prompt. req:y prompts always. opt:y has
to test whether -options (or EMBOSS_OPTIONS) is set. No conflict. EMBOSS will
always prompt if it finds a reason to.

> Anyway, only when it's optional and not required should I grey them out.
> However as optional defaults to N only places where opt:Y is explicitly stated
> will I ever grey out paramaters, which unfortunately includes all those
> graphics options (eg this is syco):

Some misunderstanding of 'required' perhaps?

Required means the application would like to know what the user really wants,
and it will prompt if it doesn't know.

Optional means the user may want to set it, and he/she can ask for a prompt.

With nothing set, the user can only set the value on the command line. These
are the ones I would expect you to grey out.

In processing, EMBOSS sets everything. If there is no prompt, and nothing on
the command line, there is always a default value.

>  bool: plot [ opt: N info: "Produce plot" ]
> 
>  xygraph: graph [ req: $(plot) multi: 3 ]
> 
>  outfile: outfile [ req: @(!$(plot)) ]
> 
> I assume that I can just add opt:Y to the graph and outfile without breaking
> anything. I must admit though that this would be much easier if there was one
> single parameter to check as it makes the tcl variable tracing harder to
> write - rather than a trace of a single variable I have to produce a new
> variable consistencing of an expression (using req and opt) and trace that
> instead.

Can you just generate the tcl variable you need? If only req or opt will be
used you can just pick the value of whichever one is being set. Spare 'N'
settings can be safely ignored, as they are the default anyway.


-- 
------------------------------------------------
Peter Rice, LION Bioscience Ltd, Cambridge, UK
peter.rice at uk.lionbioscience.com +44 1223 224723






More information about the emboss-dev mailing list