quick questions
Peter Rice
peter.rice at uk.lionbioscience.com
Thu Dec 13 16:21:21 UTC 2001
David Mathog wrote:
>
> Consider an optional integer parameter "foobar" for which 0 is a valid
> value and also where if foobar is not specified, it is calculated based
> on the input sequences.
>
> I guess I'll have a look at the code for AjAcdGetInt and see if it's
> possible to modify that into AjAcdItemExists, returning a boolean
> T/F for when the item has been specified. Then the code would be
> (more or less like on GCG)
>
> if(AjAcdItemExists("foobar")){
> ifoobar=AjAcdGetInt("foobar");
> }
> else {
> ifoobar=calculated_value();
> }
Calculated values are intended to be calculated in the ACD file. Interfaces
such as W2H should be able to do this in JavaScript, though in some cases
they have to simply treat values as integers.
Try this ACD file. Save it as 'foobar.acd' and run as 'acdc foobar'.
It will prompt for a sequence, then prompt for foobar with the sequence
length as default but will accept any value from 0 to the sequence length.
The 'echo' string is defined you so can see the value of foobar in the
prompt.
The default value can be calculated in more exotic ways too ... see the @()
functions and the other calculated attributes. More can be easily added.
====================
appl: foobar [
documentation: "ACD example"
groups: "test"
]
sequence: sequence [
required: "Y"
]
integer: foobar [
required: "Y"
default: "$(sequence.len)"
minimum: "0"
maximum: "$(sequence.len)"
]
string: echo [
prompt: "Foobar is $(foobar)"
required: "Y"
]
===================
There are many other ways to set options. You could set a boolean to
calculate a value, and another value to define the calculation.
Testing the command line will have real problems for your original idea,
because an interface might be writing every option, with what it considers
the default value, on the command line.
--
------------------------------------------------
Peter Rice, LION Bioscience Ltd, Cambridge, UK
peter.rice at uk.lionbioscience.com +44 1223 224723
More information about the EMBOSS
mailing list