Trying Something Fancy
Databases are at their best storing data, generally numeric or string data. Performing searches and returning results of numerical data in tables can be hard to interpret. Computers work with numbers in large arrays better than people do. A large set of rows and columns containing nothing but numbers can present a person with difficulty in interpretation.
The beauty of HTML and web pages is that we can make them visually more interesting. Using a web database interface we can also make our results set more easily interpreted by allowing the computer to make some assessments of the data before it is presented to the eye.
Consider the following information taken from our sample database.
|
GENE |
SW |
TYPE |
NUM |
PRODUCT |
|
alr |
ALR1 |
enzyme |
346
|
alanine racemase 1 |
|
modB |
MODB |
transport |
112
|
molybdate transport permease protein |
|
fruB |
PTFA |
enzyme |
122
|
PTS system, fructose-specific IIA/fpr component |
|
dcuB |
DCUB |
transport |
441
|
anaerobic dicarboxylate transport |
|
hisM |
HISM |
transport |
210
|
histidine transport, membrane protein M |
|
hydH |
HYDH |
enzyme |
215
|
sensor kinase for HydG, hydrogenase 3 activity (second module) |
|
hydH |
HYDH |
enzyme |
208
|
sensor kinase for HydG, hydrogenase 3 activity (entire) |
|
cydC |
CYDC |
transport |
223
|
ATP-binding component of cytochrome-related transport (two modules) |
|
cydC |
CYDC |
transport |
206
|
ATP-binding component of cytochrome-related transport (both modules) |
|
acrD |
ACRD |
putative transport |
122
|
sensitivity to acriflavine, integral membrane protein, possible efflux pump |
|
yfgA |
YFGA |
putative membrane protein |
2
|
putative membrane protein |
|
yhaF |
YHAF |
orf |
3
|
orf |
|
ispB |
ISPB |
enzyme |
4
|
octaprenyl diphosphate synthase |
The NUM column contains numeric value which were intentionally left ambiguous in meaning. They could represent anything. Imagine that in this case their value is important and that there are several threshold values that need to be monitored. Any value over 400 requires immediate attention, value between 200-400 are worth noting and under 200 are "good."
A person viewing this table (and perhaps dozens more "pages") needs to assess the numeric value of each row in order to make the proper assessment of the NUM value. This is, of course, something a computer should and can do.
Instead of a person making the assessement, we will add some conditional instructions to the results file that essentially says
If the NUM column value is greater than 400 - DO SOMETHINGIf the NUM column value is between 200 and 400 DO SOMETHING ELSE
If the NUM column value is less than 200 then DO YET SOMETHING ELSE
Since people are very good at distinguishing color then we might consider making the different condition reflected by a color change, perhaps RED for the high values, YELLOW for the mid-values, and GREEN for the low values.
In some cases, the actual value might not even be that important unless the value is in the RED. What we will do next is use an image to represent the condition. We will use the following images to represent the three conditions.
|
|
r.dot.jpg |
|
|
y.dot.jpg |
|
|
g.dot.jpg |
|
Field_Label
|
Field_Label
|
|
[FMP-FIELD: ]
|
[FMP-FIELD: ]
|
Stop! At this point we have satisfied the first condition. The contents of the box containing the red dot image will only appear if NUM is greater than 400! Any other text or images in this box will likewise only be shown when that condition is met.
[FMP-IF: NUM.gt.400]
[FMP-ELSE] [FMP-IF: NUM.gt.200]
[FMP-ELSE]
[/FMP-IF] [/FMP-IF]
Stop and name the file "dots.htm"
The logic behind this structure is as follows
If the NUM field is greater than 400 then display the red dot ELSE
If the NUM field is greater than 200 then then display the yellow dot ELSE
- display the green dot.
To view the results file in action we have to go to the search form file, "search.htm" and change the format file from results.htm to our new results file, "dots.htm"
Open the file http://yourcomputer.mbl.edu/MI99/search.htm and reload.
Run a search. Find the "a" genes.
Excercise - Add other columns to the results table. Add the NUM numeric value to just the high values along with the red dot.