W2H: How to post-processed the output files
With a flood of nice viewers, Java applets and specific post-processors,
it becomes important to have a possibility to call these applications from
within W2H.
This document explains how to integrate new scripts which are called when
a user clicks on an output file in the W2H Output manager window. Together
with this document there is also a very simple example script (without any useful
meaning) in pp-scripts/map-pp-example.
Also there are other post-processing scripts distributed (by courtesy of
people from German Cancer Research Center, Heidelberg, who developed them).
These scripts are in subdirectory pp-scripts and they manage to
bind output of some applications with SRS service. Please read a README
file in that subdirectory.
There are two steps for adding your own data post-processor:
- configure W2H
- create (or find) a suitable post-processing program
Configuring W2H
The configuration file
Cfg.pl has two variables regarding the post-processing:
- $POSTPROCESS_WRAPPER
- This variable should contain a suffix which is added to an extension of the
output file name to create a name of the post-processing script.
An example: An output file from the Map program has an extension map.
$POSTPROCESS_WRAPPER contains -pp.
You have to write a script named map-pp.
- $POSTPROCESS_PATH
- This variable contains a full UNIX path to a directory where all your
post-processing scripts are stored. This arrangement saves time.
A specialized post-processing script for a given file extension is used
only if it is found in this directory.
Creating a post-processing program
You can either find a suitable data viewer or even an applet, or write your
own script. In all cases the script must obey the following rules:
- The script name is created from a file extension and from $POSTPROCESS_WRAPPER
as described above.
- W2h invokes the script with a file name on the command line. The file name
points to an output file clicked on by a user.
- The script should print a document on its standard output. The document
will be displayed by W2H in a separate
Netscape window. The first line of the document should define a proper
content type of the document. An example:
Content-type: text/html
one blank line here (!)
W2H checks it and if a Content-type line is missing it uses a text/plain type.
- If the script encounters an error it can write a message on its standard error
output and ends with a non-zero exit code.
- Before starting the post-processing script, W2H sets some environment variables
which can be used by the post-processor. Each of these variable starts with letters
W2H_ followed by a name of a W2H global user preference (in lower cases).
The preferences names used can be found in $HOME/.w2h-www/.w2h-history. The most
useful environment variables set are probably:
- W2H_workdir containing a name of the current working directory
- W2H_worklist with a name of the current working list
In addition, W2H sets the following environment variables:
|
W2H_BIN_ROOT |
value of $BIN_ROOT in Cfg.pl |
W2H_YA_ROOT |
value of $YA_ROOT in Cfg.pl |
W2H_DOC_ROOT |
value of $DOC_ROOT in Cfg.pl |
W2H_POSTPROCESS_PATH |
value of $POSTPROCESS_PATH in Cfg.pl |
W2H_FILE_EXTENSION |
file extension, triggering this post-processor |
Examples
W2H is distributed with some post-processing scripts for the output of
one of the following programs of W2H:
- Map
- Factor
- ProSite
- BlastP, BlastN, BlastX, BlastP2, BlastN2, TBlastN, TBlastX, BlastX2,
TBlastN2, TBlastX2
- FastA, TFastA
- WordSearch, TWordSearch
- BlastAlign
- Blimps
- FrameSearch
- SW
- HMMSW, HMMFS
The post-processing scripts hyperlink
database:sequence pairs
in the output files to the suitable database using the SRS program and
inserts internal links from the sequence listing at the beginning of
many outputs to the alignments in the body of the files. Read the README
file and the inslink.pl file for more information.
It would be nice to share more scripts for post-processing of
output files. If you have some to offer you can either distribute them
using the W2H mailing list, or inform us about them and we can mention
them on the W2H Homepage - whatever you prefer.