Help
A general tutorial and feature overview can be found in the PROMPT
Case Studies section.
If you issue is not covered here, please feel free to contact
us or write to the PROMPT community mailing list.
PROMPT Reference
Schmidt, T. and Frishman, D. (2006) PROMPT: A protein mapping and comparison tool. BMC Bioinformatics, 7(1),331.Media
- Short general presentation about PROMPT (22 slides) as PPT or PDF
- PEDANT integration in PROMPT (9 slides) as PPT or PDF
- PROMPT splash screen as PNG
Advanced questions:
- How to script?
- How to use PROMPT's Java API directly?
- How to set the R path (in my own scripts or applications)?
- How to install additional R packages?
- How to extend the classpath within Beanshell scripts dynamically?
How to script? top
The complete functionality of PROMPT can be automated and used in own applications, client-server architectures (e.g. web servers) and (distributed) processing pipelines. The first and simplest possibility is to use the Beanshell language. This is a super set of Java allowing light-weight and straight forward scripting in addition to full syntax-conform Java. All existing Java classes (e.g. Web Services like Axis) can be used in Beanshell code.
PROMPT "writes" the programs for you:
click to enlargeWithin PROMPT's graphical user interface (GUI), you can find -next to the Infos and Messages field- the Beanshell Macro tab.
Here PROMPT records all actions that are performed within the GUI directly as Beanshell commands.
This is very convenient as you do not need to look up any details about classes or method names. Simply do it once in the GUI and let PROMPT log the script code. With the right-mouse click at the Beanshell tab you can save the recorded commands to a file and execute the workflow at any time.
All Beanshell scripts (or complete JAVA source code) can be executed by the PROMPT framework by a varity of ways:
- Call PROMPT with the script filename as first parameter
Examples with scriptfile.bsh contains your commands.
All platforms from the command line
java -jar prompt_complete.jar scriptfile.bsh
or
alias prompt="java -jar prompt_complete.jar"
prompt scriptfile.bsh
Windows only
prompt_complete.exe scriptfile.bshNote: Please keep in mind that files without absolute filenames that are referenced in your script (e.g. "seq.fasta" instead of "c:\data\seq.fasta") are searched relatively to the current directory from where the script was started. In this case it is recommended to either supply absolute filenames or change into the directory where your script file can be found.
- Send your commands to PROMPT as input stream
You can easily send your scripting commands to PROMPT via a standard input stream. Simply call PROMPT with the parameter -stdin. This is frequently used in pipelines or processes that connect multiple programs.
Examples for Linux:
less scriptfile.bsh | java -jar prompt_complete.jar -stdin
or using an alias
less scriptfile.bsh | prompt -stdin
- Call the Beanshell interpreter directly from Java to avoid spanning an extenal process
In large-scale calculations speed is often a critical factor. Calling PROMPT from the command line usually implies starting a new Java interpreter. Depending on your Java Runtime and operating system this overhead from the Java virtual machine can be annoying. If you are calling PROMPT's functionality out of a Java program already, it is recommended to avoid an additional extra process. Instead you can run your scripting commands directly using the Beanshell interpreter.
Supply script commands as stream (replace System-streams with your data-streams):
import bsh.Interpreter;
Interpreter interpreter = new Interpreter(
new InputStreamReader(System.in),
System.out, System.err, true);
Reader sourceIn = new BufferedReader(
new InputStreamReader(System.in));
interpreter.eval(sourceIn);
sourceIn.close();Supply script commands as file
import bsh.Interpreter;
FileReader file = new FileReader(filename);
file.ready();
Interpreter.main(filename);Note: Make sure that you have included the prompt_complete.jar in your classpath (download page).
How to use PROMPT's Java API directly? top
Simply include the prompt_complete.jar (download page) in your classpath and use the classes and methods in your Java program as any other classes. One practical approach is to let the PROMPT GUI log the actions and then extend the Beanshell script to full Java syntax.
How to set the R path (in my own scripts or applications)? top
In all cases in which PROMPT uses R as statistical calculation engine or as visualisation backend the path and name of the R executable is expected to be set in the Java-System Property rproject.rexe. This System property as well as all other configuration settings of the PROMPT framework can be set by a multitude of ways:
- Directly in your code: Set the System property using Java's setProperty method
e.g. System.setProperty("rproject.rexe","C:\ProgramFiles\R\bin\R.exe");
.- Directly from the command line:
If you do not want to hardcode the R-path in your application you can either pass the setting from the command line with the -D parameter when calling PROMPT.
e.g. java -Drproject.rexe=C:\ProgramFiles\R\bin\R.exe
-jar prompt_complete.jar ...
.- Loading PROMPT's XML configuration file:
Within PROMPT's configuration file bs_studio.cfg.xml (example file, DTD) all System Properties that would be expected are stored as config-key elements. If any settings are changed in the PROMPT GUI the file bs_studio.cfg.xml is stored in the corresponding user.home directory.
These settings can be imported using the GuiCfg.readCfgStudio(); method. It searches first in the user.home directory, then in the current folder and finally within the prompt-JAR file.How to install additional R packages? top
The fancy scatter plot used in PROMPT needs an additional R package. Here you can find install instructions.
How to extend the classpath within Beanshell scripts dynamically? top
The conservative way to set the classpath is during the java run call (e.g. java -classpath /home/users/...). However you can also extend the classpath dynamically within Beanshell scripts. Example:
addClassPath("c:/test/thtest.jar");
// includes the additional thtest.jar in c:\test
import *;
//automatically maps all class names and methods so that no additional imports should be necessaryMore information can be found in the Beanshell documentation .
How to hack PROMPT? top
The PROMPT framework consists of multiple modules that are basically seperated into three layers: input, engine and visualisation. As most classes are independet from each other "global" settings are accomplished via Java's System Properties. A list of all hidden parameters is given here.
Contact
Thorsten Schmidt
Hochschule Emden/Leer
Faculty of Technology
Constantiaplatz 4, 26723 Emden, Germany
Further information:
Links
CVS statistics:
- studioBase (the framework) ~ 30 000 lines of code (loc)
- studioGui (the Graphical User Interface) ~ 8 000 loc
- utils (own necessary utils code) ~ 15 000 loc