de.unibi.techfak.jpredictor
Class jPREdictor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by de.unibi.techfak.jpredictor.jPREdictor
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer

public class jPREdictor
extends javax.swing.JApplet

The main pogram. It is designed to work either as command line tool (type '-h' as parameter to get help), as well as GUI (if no parameters are given), as well as an applet in a browser window.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private) static ICommunicator comm
          The global communicator, used to 'talk' to the operator, what means, doing all settings and gettings through.
private static int FLAG_BS
          Flag, if the background file is a sequence rather than a table file.
private static int FLAG_DONTUSEPREDEFINED
          Flag for using the predefined motifs in no case.
private static int FLAG_FORCE
          Flag for marking a general force.
private static int FLAG_FORCE_CCC
          Flag for forcing the jPREdictor into performing a cutoff calculation.
private static int FLAG_FORCE_CLUSTERING
          Flag for forcing the jPREdictor into performing a motif clustering.
private static int FLAG_FORCE_EVOLUTION
          Flag for forcing the jPREdictor into performing a motif evolution.
private static int FLAG_FORCE_GUI
          Flag for forcing the jPREdictor to read all options and set all commnunicators fields and then starts the GUI.
private static int FLAG_FORCE_SCORING
          Flag for forcing the jPREdictor to perform a score sequence operation, and nothing else.
private static int FLAG_FORCE_SEARCHING
          Flag for forcing the jPREdictor to perform a search motifs operation.
private static int FLAG_FORCE_WEIGHTING
          Flag for forcing the jPREdictor to perform a weight motifs operation.
private static int FLAG_MS
          Flag, if the model file is a sequence rather than a table file.
private static int FLAG_T
          Flag for single occurrence output, when searching motifs.
private static int FLAG_U
          Flag for printing only the best score, when scoring sequences.
private static int FLAG_USEPREDEFINED
          Flag for using the predefined motifs in any case.
(package private) static int flags
          The local bit array for flags.
(package private) static Operator op
          The global operator, which performs all tasks on the sequences by using the motifs.
private static java.lang.String progInfo
          Informations on and description of the program.
private static java.lang.String serialVersionDate
          Version date.
private static long serialVersionUID
          Version number.
private static java.lang.String version
          Version string.
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
jPREdictor()
           
 
Method Summary
static boolean commandLineInterpreter(java.lang.String[] args)
          The command line interpreter tool.
static java.util.Vector cutoffCalc(ICommunicator comm, boolean out)
          Performs a cutoff calculation on scores received through the given communicator.
 void destroy()
          Called, short before the applet is about to be destroyed.
(package private) static void errorExit(int exitCode)
          Writes a user message to the error stream of the communicator and exits.
 java.lang.String getAppletInfo()
          Returns the version info of this program.
(package private) static int getOccurrencesFromFile(java.lang.String filename, MotifList ml, java.util.Vector[] occ, boolean norm, boolean out)
          Reads a file and stores the occurrences of the motifs named in the file to the vector array.
static java.lang.String getProgramInfo()
          Returns a description of the program.
static java.lang.String getVersionInfo()
          Returns the version info of this program.
static java.lang.String History()
          Prints the help for specialized tasks the jPREdictor can perform.
 void init()
          Inits the communicator and the operator.
static void main(java.lang.String[] args)
          The main program
(package private) static void print(boolean verify, java.lang.String s)
          Prints the string via comm.out().print(), if verify is true.
(package private) static void processScores()
          Takes the file given by option '-f' and comprises the scores in it to bands for many cutoffs.
 void stop()
          Does nothing, because the user might want the applet to work if he is gone.
(package private) static void taskCutoffCalc(boolean out)
          Starts the cutoff-calculation task.
(package private) static void taskScoreSequence()
          Starts the score-sequence task.
(package private) static void taskSearchSequence()
          Starts the search-motifs-on-sequence task.
(package private) static void taskWeightMotifs(boolean output)
          Starts the weight-motifs task.
private static void test(java.lang.String[] args)
          A method for testing purposed.
static java.lang.String Usage()
           
static java.lang.String UsageHidden()
           
static java.lang.String UsageOptionFile()
          Prints the help for writing an option file.
static java.lang.String UsageSpec()
           
(package private) static void weightMotifs(MotifList ml, ICommunicator comm)
           This method calculates the motifs weights from two table files.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Version number. Note, that 1.02 is translated into an "1.2" version string.

See Also:
Constant Field Values

serialVersionDate

private static final java.lang.String serialVersionDate
Version date.

See Also:
Constant Field Values

comm

static ICommunicator comm
The global communicator, used to 'talk' to the operator, what means, doing all settings and gettings through.


op

static Operator op
The global operator, which performs all tasks on the sequences by using the motifs.


version

private static java.lang.String version
Version string. It is created either by the main method or by the init method, depending on how the program was started.


progInfo

private static java.lang.String progInfo
Informations on and description of the program.


flags

static int flags
The local bit array for flags.


FLAG_BS

private static final int FLAG_BS
Flag, if the background file is a sequence rather than a table file. Note, that multiple files given as background are always treated as to contain sequences.

See Also:
Constant Field Values

FLAG_MS

private static final int FLAG_MS
Flag, if the model file is a sequence rather than a table file. Note, that multiple files given as model are always treated as to contain sequences.

See Also:
Constant Field Values

FLAG_USEPREDEFINED

private static final int FLAG_USEPREDEFINED
Flag for using the predefined motifs in any case. If neither this flag nor FLAG_USEPREDEFINED is set in flags the program decides from whether motifs are given whether it adds the predefined ones or not.

See Also:
Constant Field Values

FLAG_DONTUSEPREDEFINED

private static final int FLAG_DONTUSEPREDEFINED
Flag for using the predefined motifs in no case. If neither this flag nor FLAG_USEPREDEFINED is set in flags the program decides from whether motifs are given whether it adds the predefined ones or not.

See Also:
Constant Field Values

FLAG_T

private static final int FLAG_T
Flag for single occurrence output, when searching motifs.

See Also:
Constant Field Values

FLAG_U

private static final int FLAG_U
Flag for printing only the best score, when scoring sequences.

See Also:
Constant Field Values

FLAG_FORCE_SEARCHING

private static final int FLAG_FORCE_SEARCHING
Flag for forcing the jPREdictor to perform a search motifs operation. This flag might be useful when the user gives all training sets but only wishes a motif search.

See Also:
Constant Field Values

FLAG_FORCE_WEIGHTING

private static final int FLAG_FORCE_WEIGHTING
Flag for forcing the jPREdictor to perform a weight motifs operation. This flag might prove useful when the user gives all sequences but only wishes to obtain the motifs weights.

See Also:
Constant Field Values

FLAG_FORCE_SCORING

private static final int FLAG_FORCE_SCORING
Flag for forcing the jPREdictor to perform a score sequence operation, and nothing else.

See Also:
Constant Field Values

FLAG_FORCE_CCC

private static final int FLAG_FORCE_CCC
Flag for forcing the jPREdictor into performing a cutoff calculation.

See Also:
Constant Field Values

FLAG_FORCE_GUI

private static final int FLAG_FORCE_GUI
Flag for forcing the jPREdictor to read all options and set all commnunicators fields and then starts the GUI. With this the GUI can be started despite any arguments are given. This might be useful to give an option file to the GUI.

See Also:
Constant Field Values

FLAG_FORCE_CLUSTERING

private static final int FLAG_FORCE_CLUSTERING
Flag for forcing the jPREdictor into performing a motif clustering.

See Also:
Constant Field Values

FLAG_FORCE_EVOLUTION

private static final int FLAG_FORCE_EVOLUTION
Flag for forcing the jPREdictor into performing a motif evolution.

See Also:
Constant Field Values

FLAG_FORCE

private static final int FLAG_FORCE
Flag for marking a general force. Its value is the disjunction of all FORCE_FLAGS.

See Also:
Constant Field Values
Constructor Detail

jPREdictor

public jPREdictor()
Method Detail

Usage

public static java.lang.String Usage()
Returns:
The usage text for this program and all available flags as one big string.

UsageSpec

public static java.lang.String UsageSpec()
Returns:
The help for specialized tasks the jPREdictor can perform in one big string.

UsageHidden

public static java.lang.String UsageHidden()
Returns:
The help for hidden tasks the jPREdictor can perform in one big string.

UsageOptionFile

public static java.lang.String UsageOptionFile()
Prints the help for writing an option file.


History

public static java.lang.String History()
Prints the help for specialized tasks the jPREdictor can perform.


taskSearchSequence

static void taskSearchSequence()
Starts the search-motifs-on-sequence task. Prints an error message, if the search could not be started.


taskWeightMotifs

static void taskWeightMotifs(boolean output)
Starts the weight-motifs task. Prints an error message, if the search could not be started.


taskScoreSequence

static void taskScoreSequence()
Starts the score-sequence task. Test first, whether all motifs are properly weighted. Sends error messages to comm.err().


taskCutoffCalc

static void taskCutoffCalc(boolean out)
Starts the cutoff-calculation task. Test first, whether all motifs are properly weighted. Sends error messages to comm.err().

Parameters:
out - Whether progress informations are to be sent to stderr

errorExit

static void errorExit(int exitCode)
Writes a user message to the error stream of the communicator and exits. The message is 'Use parameter '-h' to get help!'. Then System.exit( exitCode ) is called.

Parameters:
exitCode - The program leaves with this code.

print

static void print(boolean verify,
                  java.lang.String s)
Prints the string via comm.out().print(), if verify is true.

Parameters:
verify - Decides whether to print the string or not.
s - The String to get printed.

weightMotifs

static void weightMotifs(MotifList ml,
                         ICommunicator comm)

This method calculates the motifs weights from two table files. Both files must contain the occurrences of the motifs in any given sequence, a previous call to the jPREdictor without '-b' or '-m' creates such a file. The table file given through parameter '-b' means the negative training set (background) searched, the one given through parameter '-m' means the positive training set (model) searched. Both corresponding filenames are taken from the communicator.

Prints first the motifs occurrences in the positive training set, second the ones of the negative training set. Note, that the calculated weights of the motifs are not output.

Parameters:
ml - The list of motifs to set the weigths for.
comm - The communicator to get some settings.

getOccurrencesFromFile

static int getOccurrencesFromFile(java.lang.String filename,
                                  MotifList ml,
                                  java.util.Vector[] occ,
                                  boolean norm,
                                  boolean out)
Reads a file and stores the occurrences of the motifs named in the file to the vector array. The file has to be of the form the parameter '-f' produces as output (without '-v'). The motif list is used to compare the names found in the file to, thus the vector of occurrences has the same order than the motif list.

Parameters:
filename - The name of the file.
ml - The motif lsit the names found in the file are compared to.
occ - The vector array to be filled. One vector for every motif, thus must be in length of the size of ml.
norm - Normalize the occurrences by sequence length or do it not.
out - Output the occurrences or not.
Returns:
Returns 0, if the vector array is valid.

processScores

static void processScores()
Takes the file given by option '-f' and comprises the scores in it to bands for many cutoffs. The width of the sequence window is taken from the static communicator. If a valid cutoff is set in the communicator no cutoff calculation is performed but the bands above that cutoff are output in the form: 'seq#:start-end:max;min;mean'.


cutoffCalc

public static java.util.Vector cutoffCalc(ICommunicator comm,
                                          boolean out)
Performs a cutoff calculation on scores received through the given communicator. A cutoff calculation means that the number of bands are calculated for every possible cutoff (in steps of one). The scores as well as the width are taken from the given communicator. Since all calculations are done by the scoring factory, the table returned upon completion is the vector received from the ScoringFactory.getCutoffTable()-method.

Parameters:
comm - The communicator the results are received from.
out - true, if the function should print some progress notes to comm.err().
Returns:
A table of integers in vector format as received by a call to ScoringFactory.getCutoffTable().
See Also:
ScoringFactory.getCutoffTable()

commandLineInterpreter

public static boolean commandLineInterpreter(java.lang.String[] args)
The command line interpreter tool.

Parameters:
args - Runtime arguments, parameters.
Returns:
If the parameter '--GUI' was given, true, in all other cases (especially error cases), false

main

public static void main(java.lang.String[] args)
The main program

Parameters:
args - Runtime arguments, parameters

init

public void init()
Inits the communicator and the operator. Builds the gui.

Overrides:
init in class java.applet.Applet

stop

public void stop()
Does nothing, because the user might want the applet to work if he is gone.

Overrides:
stop in class java.applet.Applet

destroy

public void destroy()
Called, short before the applet is about to be destroyed. Puts stop to the threads previously started.

Overrides:
destroy in class java.applet.Applet

getAppletInfo

public java.lang.String getAppletInfo()
Returns the version info of this program.

Overrides:
getAppletInfo in class java.applet.Applet
Returns:
A short text with infos about this applet.

getVersionInfo

public static java.lang.String getVersionInfo()
Returns the version info of this program.

Returns:
A short text with infos about this program.

getProgramInfo

public static java.lang.String getProgramInfo()
Returns a description of the program.

Returns:
A short text with infos about this program.

test

private static void test(java.lang.String[] args)
A method for testing purposed. Called first in the main method. In a stable version this method does nothing but to return.