Class GenNormalizationPlugin

java.lang.Object
  |
  +--MAEPlugin.MAEPlugin
        |
        +--MAEPlugin.CheckBoxMenuPlugin
              |
              +--MAEPlugin.analysis.AnalysisPlugin
                    |
                    +--MAEPlugin.analysis.NormalizationPlugin
                          |
                          +--GenNormalizationPlugin
All Implemented Interfaces:
java.util.EventListener, java.awt.event.ItemListener, MAEUpdateListener, Normalization, PluginStub

public class GenNormalizationPlugin
extends NormalizationPlugin
implements MAEUpdateListener

This class implements a wrapper for a general purpose class GenericNormalizationPlugin MAExplorer plugin. This lets it exist all of the time in MAExplorer and is activated with a developer wants to debug a new normalization plugin as a installed class prior to deploying and testing it as a PluginLoader .jar file.

See mae.DBUG_GENERIC_NORM_PLUGIN flag to enable this.

[NOTE] if not debugging then comment out all "gnpp." references so it will compile if you remove the actual GenericNormalizationPlugin (i.e., to put it in its own maePlugins/ folder. These are flagged with a "[GNPP] so you can grep for them as "//gnpp." and either add or remove the "//".

Note: It is designed so that it may be used as either as a MAEPlugin or called, when debugging, from the MAExplorer menu if enabled in the main program. NOTE: The debugging menu item is NOT included in official releases and is disabled in the MAExplorer.java main program.

This example can serve as a model of using various MJA API methods for writing a range of NormalizationPlugin implementations. It includes more code than is necessary for most normalization plugins. However, after it is adapted to a particular method, the additional code can be removed to "slim" it down. See (4) below for discussion on the types of data available for writing normalization plugins.

(1) Required methods you must implement for NormalizationPlugins' There are several methods that require you to overide them for this extended type of FilterPlugin.

  resetPipeline() - is called by the main MAExplorer data Filter for you to
                    initialize your data prior to processing each gene
                    with geneOperation(mid) calls. This sets the 
                    sampleDataType so that the plugin could use it for
                    computing advanced normalizations.
  finalizePipeline() - is called at the end of the main MAExplorer data
                    Filter for you post-process your data structures if
                    you need to.
  calcIntensityScaleExtrema() - is called to compute Intensity Scale upper
                    and lower limits extrema of raw data for each sample
when the normalization method is changed.
  recalcNormalizationExtrema() - compute the intensity extreama for each 
                    sample and save back in the sample.
  scaleIntensityData() - is called to scale a data point.

(2) Data structure "SampleStats" can be used for saving sample specific data You can optionally use the local SampleStats class to hold statistics and other data on a per-sample basis and accessed via ssList[0:maxSamples]. You must popupulate this structure if you need it.

(3) Notes on required calls to MJAclasses for extended NormalizationPlugins' We get the state of MAExplorer through various calls to MJAxxxx methods in the initState() method.

(4) Types of data that may be accessed in this generic normalization plugin There are two types of data typically used: a) global (i.e. normalized by a median, Zscore, etc.); and b) data dependent in which all relevant data must be retrieved and used to precompute the analysis method prior to doing the actual normalization. This may be done in the resetPipeline() method which is called at the start of a pipeline processing cycle. Note that there may occasionally be other calls to scaleIntensityData() to scale the data (e.g. when you click on the current spot and it will report the data). It is critical that the resetPipeline() was previously called prior to using scaleIntensityData().

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/03/04 12:28:52 $ / $Revision: 1.2 $
Author:
Jai Evans (DECA/CIT), C. Santos (DECA/CIT), P. Lemkin (NCI-Frederick)

Field Summary
static int DBUG_MAX_MIDS
          only report mids analysis in this range if DBUG_FLAG is on
static int DBUG_MIN_MIDS
          only report mids analysis in this range if DBUG_FLAG is on
 
Fields inherited from class MAEPlugin.analysis.NormalizationPlugin
activeNormalization, sample
 
Fields inherited from class MAEPlugin.MAEPlugin
DBUG_MAEP, jarResources, maestub, menuFlag, menuHook, menuInsertionPointName, menuItem, plugInFileName, plugInName, propertySupport, registry, registryMaxSize
 
Fields inherited from interface MAEPlugin.PluginStub
PLUGIN_VERSION
 
Constructor Summary
GenNormalizationPlugin(MaeJavaAPI mJA, boolean doTestDbugFlag)
          GenNormalizationPlugin() - constructor ONLY for use with debugging using the mae.DBUG_GENERIC_NORM_PLUGIN flag to add (Analysis | Normalization | Test Generic Norm Plugin [DBUG]) to the normalization menu.
 
Method Summary
 float[] calcIntensityScaleExtrema(float maxRI, float minRI, float maxRaw, float minRaw, int sampleNbr)
          calcIntensityScaleExtrema() - compute scaled intensity extrema.
 void close(boolean preserveDataStructuresFlag)
          close() - close the plugin
 boolean finishPipeline(int optArg)
          finishPipeline() - overide finish filter at end of normalization of all genes (if required).
 void recalcNormalizationExtrema()
          recalcNormalizationExtrema() - set the extrema for all samples for this plugin.
 boolean resetPipeline(int optArg)
          resetPipeline() - reset filter at start of data Normalization.
 float scaleIntensityData(float rawIntensityPoint)
          scaleIntensityData() - scale raw intensity data as fct of normalization mode.
 float scaleIntensityData(float rawIntensity, float rawBkgrd, int mid, int gid, int sampleNbr)
          scaleIntensityData() - the gene normalization operating on gene mid for sampleIdx where the data is ether extracted here or from the resetPipeline pre-analysis.
 float scaleIntensityData(float rawIntensity, int mid, int gid, int sampleNbr)
          scaleIntensityData() - scale raw intensity data as fct of normalization mode.
 void updateCurGene(int mid)
          updateCurGene() - update any data since current gene has changed.
 void updateFilter()
          updateFilter() - update any dependent data since Filter has changed.
 void updateLabels()
          updateLabels() - update any dependent data since global labels have changed.
 void updateSlider()
          updateSlider() - update any dependent data sincea threshold slider has changed.
 
Methods inherited from class MAEPlugin.analysis.NormalizationPlugin
disableNormalizationPlugin, getActiveNormalization, getNormalizationState, getSample, pluginHalt, pluginMain, setActiveNormalization, setSample
 
Methods inherited from class MAEPlugin.CheckBoxMenuPlugin
getState, itemStateChanged, setState
 
Methods inherited from class MAEPlugin.MAEPlugin
, getFlag, getInstance, getMAEStub, getMenuHook, getMenuInsertionPointName, getMenuItem, getNumberPlugins, getPluginDescription, getPluginFileName, getPluginName, getPlugins, menuActivated, pluginInit, removePlugin, setFlag, setJarResources, setMAEStub, setMenuHook, setMenuInsertionPointName, setMenuItem, setMenuLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface MAEPlugin.Normalization
getState, setState
 

Field Detail

DBUG_MIN_MIDS

public static int DBUG_MIN_MIDS
only report mids analysis in this range if DBUG_FLAG is on

DBUG_MAX_MIDS

public static int DBUG_MAX_MIDS
only report mids analysis in this range if DBUG_FLAG is on
Constructor Detail

GenNormalizationPlugin

public GenNormalizationPlugin(MaeJavaAPI mJA,
                              boolean doTestDbugFlag)
GenNormalizationPlugin() - constructor ONLY for use with debugging using the mae.DBUG_GENERIC_NORM_PLUGIN flag to add (Analysis | Normalization | Test Generic Norm Plugin [DBUG]) to the normalization menu. It is not used otherwise.
Parameters:
MaeJavaAPI - mJA is instance of MaeJavaAPI
doTestDbugFlag - to invoke the dummy testDbug() method.
Method Detail

resetPipeline

public boolean resetPipeline(int optArg)
resetPipeline() - reset filter at start of data Normalization. We will test for ALL GENES (if required) using the midOK[] boolean created here to later determine if we actually perform the test. This sets up the state that may be used during the pipeline operation.
Overrides:
resetPipeline in class NormalizationPlugin
Parameters:
optArg - - optional argument
Returns:
true if succeed

finishPipeline

public boolean finishPipeline(int optArg)
finishPipeline() - overide finish filter at end of normalization of all genes (if required). This may be used to clean up the state after the pipeline operation.
Overrides:
finishPipeline in class NormalizationPlugin
Parameters:
optArg - - optional argument
Returns:
true if succeed

scaleIntensityData

public float scaleIntensityData(float rawIntensityPoint)
scaleIntensityData() - scale raw intensity data as fct of normalization mode. This is called on a per-spot basis from the normalization.
Overrides:
scaleIntensityData in class NormalizationPlugin
Parameters:
rawIntensity - is unnormalized data for the spot
Returns:
scaled normalized spot data

scaleIntensityData

public float scaleIntensityData(float rawIntensity,
                                int mid,
                                int gid,
                                int sampleNbr)
scaleIntensityData() - scale raw intensity data as fct of normalization mode. This assumes that either the rawIntensity was background corrected, or we ignore the background by supplying 0.0 for additional corrections. This is called on a per-spot basis. There is a (gid,sampleNbr) dependence on the normalization.
Overrides:
scaleIntensityData in class NormalizationPlugin
Parameters:
rawIntensity - is unnormalized data for the spot
mid - is MID of the spot
gid - is GID of point
sampleNbr - for the sample
Returns:
scaled normalized spot data

scaleIntensityData

public float scaleIntensityData(float rawIntensity,
                                float rawBkgrd,
                                int mid,
                                int gid,
                                int sampleNbr)
scaleIntensityData() - the gene normalization operating on gene mid for sampleIdx where the data is ether extracted here or from the resetPipeline pre-analysis. If the normalization is inoperative, then just return 0.0. The mid must be >=0 since -1 indicates an illegal gene. The midOK[mid] must be true, else it indicates an illegal gene. [NOTE] The plugin writer should try to avoid doing special analyses here that need to be computed DURING the processing and instead do the computations during the resetPipeline() operation if possible. That may be able to optimized and the data cached to avoid constant recomputation.
Overrides:
scaleIntensityData in class NormalizationPlugin
Parameters:
rawIntensity - is intensity value to be normalized
rawBkgrd - is background intensity to be used in normalization if the use Background flag is set. If there is no background, then supply 0.0F as the arg.
mid - is the Master Gene ID to test if not -1 and the gene exists
gid - is the spot Geometry Gene Index to test if not -1 and the spot exists
sampleNbr - is the HybridSample index number for single sample. For Cy3 vs Cy5 mode, it is 0 for Cy3 (F1), and 1 for Cy5 (F2). For HP-X 'set' vs HP-Y 'set' mode, it is 0 for HP-X 'set', and 1 for HP-Y 'set'
Returns:
scaled data if normalization is active, else 0.0F

calcIntensityScaleExtrema

public float[] calcIntensityScaleExtrema(float maxRI,
                                         float minRI,
                                         float maxRaw,
                                         float minRaw,
                                         int sampleNbr)
calcIntensityScaleExtrema() - compute scaled intensity extrema. This includes the upper and lower limits of raw data for each sample. It is called to get the extrema for use in scaling displays and other computations where the limits must be known.
Overrides:
calcIntensityScaleExtrema in class NormalizationPlugin
Parameters:
maxRI - maximum raw ratio intensity
minRI - minimum raw ratio intensity
maxRaw - maximum raw intensity max(rawF1,rawF2)
minRaw - minimum raw intensity min(rawF1,rawF2)
sampleNbr - for the sample sample number in the range [1:maxSamples]
Returns:
an array with the following scaled data:
   element 0= maxDataS
   element 1= minDataS
   element 2= maxRawS
   element 3= minRawS

recalcNormalizationExtrema

public void recalcNormalizationExtrema()
recalcNormalizationExtrema() - set the extrema for all samples for this plugin. [NOTE] This method is used if we want to compute all extrema for all samples simultaneously. Otherwise, since calcIntensityScaleExtrema() is called repeatedly for all samples, that may be adequate.
Overrides:
recalcNormalizationExtrema in class NormalizationPlugin

updateCurGene

public void updateCurGene(int mid)
updateCurGene() - update any data since current gene has changed. This is invoked from the PopupRegistry
Specified by:
updateCurGene in interface MAEUpdateListener
Overrides:
updateCurGene in class NormalizationPlugin
Parameters:
mid - is the MID (Master Gene ID) that is the new current gene.

updateFilter

public void updateFilter()
updateFilter() - update any dependent data since Filter has changed. This is invoked from the PopupRegistry
Specified by:
updateFilter in interface MAEUpdateListener
Overrides:
updateFilter in class NormalizationPlugin

updateSlider

public void updateSlider()
updateSlider() - update any dependent data sincea threshold slider has changed. This is invoked from the PopupRegistry.
Specified by:
updateSlider in interface MAEUpdateListener
Overrides:
updateSlider in class NormalizationPlugin

updateLabels

public void updateLabels()
updateLabels() - update any dependent data since global labels have changed. This is invoked from the PopupRegistry.
Specified by:
updateLabels in interface MAEUpdateListener
Overrides:
updateLabels in class NormalizationPlugin

close

public void close(boolean preserveDataStructuresFlag)
close() - close the plugin
Specified by:
close in interface MAEUpdateListener
Overrides:
close in class NormalizationPlugin
Parameters:
preserveDataStructuresFlag - to save data structures