statalign.postprocess
Class Postprocess

java.lang.Object
  extended by statalign.postprocess.Postprocess
Direct Known Subclasses:
ConsensusNetwork, CurrentAlignment, Entropy, Input, LogLikelihoodTrace, MpdAlignment, PPFold, RmsdTrace, StructTrace, Structure, TreeVisualizer, VisualDistance

public abstract class Postprocess
extends java.lang.Object

Common ancestor for post-processing plugin classes. Comments for plugin developers:


Field Summary
 boolean active
          True if plugin is active (must produce its output) either because other plugins depend on it or because it is selected
 java.lang.String alignmentType
          This string tells the alignment type in which alignment must be presented
 java.io.FileWriter file
          This is the logfile writer that is written during the running and gets information from all postprocesses.
 boolean hasToolBar
          True, if the plugin implements the getToolBarItems() function.
 Mcmc mcmc
          TODO: REMOVE!!!!!!!!!!
 boolean outputable
          True if this class can generate an output
 java.io.FileWriter outputFile
          This is the output file writer, that is written by a specific postprocess.
 boolean postprocessable
          True if this class can generate a postprocess file
 boolean postprocessWrite
          True if it writes a postprocess file
 boolean rnaAssociated
          True if it should show only when running an RNA/DNA file
 boolean sampling
          True if it writes into the log file
 boolean screenable
          True if it can generate a GUI.
 boolean selected
          True if plugin is selected in the menu (and thus a tab is created for the plugin in the main window that can be used to allow the user to change settings before MCMC start and to show runtime information afterwards)
 boolean show
          True if a GUI must be shown to the user.
 
Constructor Summary
Postprocess()
           
 
Method Summary
 void addTrack(Track track)
          NB because the track is added as a Pair, it will be passed by reference, which allows it to be modified from the place where it was added, i.e.
 void afterLastSample()
          This function is called after the MCMC runs.
 void beforeFirstSample(InputData inputData)
          Called before MCMC start.
 java.lang.String[] getDependences()
          Override this and return an array of full-qualified class names of the plugins this plugin depends on.
 java.lang.String getFileExtension()
          Returns default file extension that is to appended to the input file name to get the file this plugin is writing into.
abstract  javax.swing.Icon getIcon()
           
abstract  javax.swing.JPanel getJPanel()
           
 java.util.List<ModelExtension> getModExtPlugins()
           
abstract  java.lang.String getTabName()
           
 double getTabOrder()
          Specifies the order of the tab for this plugin in the GUI.
abstract  java.lang.String getTip()
          Returns with the tip information (shown when the mouse cursor is moved over the label of the tabulated panel)
 java.util.ArrayList<javax.swing.JComponent> getToolBarItems()
          Returns the toolbar that this plugin uses.
 java.util.ArrayList<Track> getTracks()
          The extra tracks to be plotted
 void init(ModelExtManager modelExtMan)
          Called by PostprocessManager after setting the show field to allow initialisation, possibly involving GUI (toolbar etc.)
 void newPeek(State state)
          Allows peeking into the Markov chain before actual sampling begins.
 void newSample(McmcModule coreModel, State state, int no, int total)
           
 void newSample(State state, int no, int total)
          This function is called when we sample from the Markov chain.
 void newStep(McmcStep mcmcStep)
          Called after a new step is made.
 void refToDependences(Postprocess[] plugins)
          Override this to get access to instances of the plugins your plugin depends on.
 void reloadPanel()
          Reinitializes panel to accommodate a new GUI
abstract  void setSampling(boolean enabled)
          This function switches on or off the sampling mode.
 void setSelected(boolean selected)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mcmc

public Mcmc mcmc
TODO: REMOVE!!!!!!!!!!


hasToolBar

public boolean hasToolBar
True, if the plugin implements the getToolBarItems() function. Defaults to false.


selected

public boolean selected
True if plugin is selected in the menu (and thus a tab is created for the plugin in the main window that can be used to allow the user to change settings before MCMC start and to show runtime information afterwards)


screenable

public boolean screenable
True if it can generate a GUI. Not used in the current version, it is for further development if one wants to switch on and off the GUIs.


show

public boolean show
True if a GUI must be shown to the user.


active

public boolean active
True if plugin is active (must produce its output) either because other plugins depend on it or because it is selected


outputable

public boolean outputable
True if this class can generate an output


postprocessable

public boolean postprocessable
True if this class can generate a postprocess file


sampling

public boolean sampling
True if it writes into the log file


postprocessWrite

public boolean postprocessWrite
True if it writes a postprocess file


rnaAssociated

public boolean rnaAssociated
True if it should show only when running an RNA/DNA file


alignmentType

public java.lang.String alignmentType
This string tells the alignment type in which alignment must be presented


file

public java.io.FileWriter file
This is the logfile writer that is written during the running and gets information from all postprocesses.


outputFile

public java.io.FileWriter outputFile
This is the output file writer, that is written by a specific postprocess.

Constructor Detail

Postprocess

public Postprocess()
Method Detail

getTracks

public java.util.ArrayList<Track> getTracks()
The extra tracks to be plotted


addTrack

public void addTrack(Track track)
NB because the track is added as a Pair, it will be passed by reference, which allows it to be modified from the place where it was added, i.e. the desired behaviour.

Parameters:
track -

init

public void init(ModelExtManager modelExtMan)
Called by PostprocessManager after setting the show field to allow initialisation, possibly involving GUI (toolbar etc.)


getTabName

public abstract java.lang.String getTabName()
Returns:
Returns with the name that will appear on the label of the tabulated panel.

getIcon

public abstract javax.swing.Icon getIcon()
Returns:
Returns with the icon that will appear on the label of the tabulated panel.

getJPanel

public abstract javax.swing.JPanel getJPanel()
Returns:
Returns with the panel of the GUI

reloadPanel

public void reloadPanel()
Reinitializes panel to accommodate a new GUI


getTip

public abstract java.lang.String getTip()
Returns with the tip information (shown when the mouse cursor is moved over the label of the tabulated panel)


getTabOrder

public double getTabOrder()
Specifies the order of the tab for this plugin in the GUI.

E.g. we probably always want the "sequence input"-tab to appear first and therefore it returns a 1.0d here. The "current alignment"-tab returns 2.0d here and so if we want to make a tab get ordered between the "sequence input" and the "current alignment"-tabs we just make that plugin return 1.5d or something similar here. By default tabs get ordered last.

Returns:
the tab order of the tab associated with this plugin, if running in a GUI.

getFileExtension

public java.lang.String getFileExtension()
Returns default file extension that is to appended to the input file name to get the file this plugin is writing into.


getDependences

public java.lang.String[] getDependences()
Override this and return an array of full-qualified class names of the plugins this plugin depends on.


refToDependences

public void refToDependences(Postprocess[] plugins)
Override this to get access to instances of the plugins your plugin depends on. This function will be called by the PostprocessManager during its initialisation.

Parameters:
plugins - reference to Postprocess objects in the order they are specified in getDependences() or null if it returns null

beforeFirstSample

public void beforeFirstSample(InputData inputData)
Called before MCMC start. This is the first time you can use PostprocessManager.mcmc to access internal data structure


newStep

public void newStep(McmcStep mcmcStep)
Called after a new step is made. A typical run of MCMC takes hundred thousands of steps, override this function only if it takes a negligible amount of time and does not use too much memory. We use, for example, in drawing the loglikelihood trace.


newPeek

public void newPeek(State state)
Allows peeking into the Markov chain before actual sampling begins. Frequency is determined by the MCMC sampling parameter set by the user, just like for newSample(State, int, int). Unlike that method, this one is called both during and after the burn-in period.

Parameters:
state - A State object representing the current state of the chain

newSample

public void newSample(State state,
                      int no,
                      int total)
This function is called when we sample from the Markov chain. Frequency is determined by the MCMC sampling parameter set by the user. Unlike newPeek(State state), this method is only called after the burn-in period.

Parameters:
state - A State object representing the current state of the chain
no - The number of the current sample
total - The number of the total samples

newSample

public void newSample(McmcModule coreModel,
                      State state,
                      int no,
                      int total)

setSampling

public abstract void setSampling(boolean enabled)
This function switches on or off the sampling mode.

Parameters:
enabled - Set it true if you need samples.

afterLastSample

public void afterLastSample()
This function is called after the MCMC runs.


getToolBarItems

public java.util.ArrayList<javax.swing.JComponent> getToolBarItems()
Returns the toolbar that this plugin uses.


getModExtPlugins

public java.util.List<ModelExtension> getModExtPlugins()

setSelected

public void setSelected(boolean selected)