Add support for units to annotation values
Description (last modified by )
See trunk/doc/src/docbook/figures/uml/datalayer.annotations.png for an UML diagram.
Hi Nicklas, base-developpers,
Dominic an myself are currently working on a MAGE-TAB*(http://www.mged.org/mage-tab/) importer for BASE2. The format allows specifying Units to qualify descriptors such as protocol parameter, experimental factors, biomaterial descriptors. I can be quite handy for instance when having to report doses ranges of various compound fed to animals. When trying to get the unit information in BASE2, we are facing the following: Essentially, in order to retain unit information, we have to 'squeeze the information in an Annotation Type of type string that will get the numerical value + the unit value represented in the MAGE-TAB document.
Several drawbacks in using this mechanism in BASE2
- loss of data type
- loss of data validation capability offered by BASE2 Annotation Type
- loss of computation (using BASE formulas for instance) over numerical Annotation types.
The other option of creation several Annotation Type of type float with different labels to reflect unit changes, has serious User friendlyness issues.
Are there any plans to provide a support for units in BASE2 Annotation Type, and if so on which timeline ?
It is not on the timeline. I remember that we discussed it a long time ago, but it was never added as a ticket to the trac system. I think the earliest we can do is for the 2.6 relese. 2.5 is already overloaded with features.
Is it a viable options to alter Float Value and Integer Value for Annotation Type in BASE2 to allow for specification of units (possibly as free text in a first go) ?
Not if we want to do something better in the future. It is very hard to change a temporary solution.
(I reckon this would requires changes to the interface..)
Are we the only BASE2 users confronted with this units/annotation type pb and would there people out there interested in developing this feature and contribute it to BASE2 ?
I remember a few ideas that I had when this issue was discussed earlier.
- A central registry of units that defines all possible units (much like we have for MIME types already).
- To each (numerical) annotation type is an (optional) list of units that are possible to use.
- When annotating an item the user can select one of the possible units as defined by the annotation type.
There will be some problems with queries:
- If we ignore units: >=5 finds items with 5mg and 5g but not 2g
- If we require exact match of unit: >=5mg finds items with 5mg but not 0.005g
A possible solution is to convert all unit-enabled annotations to a standard unit before they are stored in the database. For example, all weights are stored in grams. Query filters are also converted to the standard unit before they are applied. The original unit is remembered by each annotation and the values are converted back when displayed. A drawback is that the conversion can only work for float/double annotation values.