2.17.2: 2011-06-17

net.sf.basedb.core.plugin
Class AbstractAnalysisPlugin

java.lang.Object
  extended by net.sf.basedb.core.plugin.AbstractPlugin
      extended by net.sf.basedb.core.plugin.AbstractAnalysisPlugin
All Implemented Interfaces:
Plugin
Direct Known Subclasses:
Base1PluginExecuter, ExternalProgramExecutor, FormulaFilter, JepExtraValueCalculator, JepIntensityTransformer, LowessNormalization, ManualTransformCreator, MedianRatioNormalization

public abstract class AbstractAnalysisPlugin
extends AbstractPlugin

This is a base class that is useful for all analysis type plugins. It has helper methods for generating some common parameter types needed by many plugins, such as the source bioassay set and child bioassay set name and description, etc.

Version:
2.0
Author:
nicklas
Last modified
$Date: 2010-08-13 12:48:17 +0200 (Fri, 13 Aug 2010) $

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
 
Field Summary
protected static String CHILD_DESCRIPTION
          The name of the parameter that asks for the description of the child bioassay set.
protected static String CHILD_NAME
          The name of the parameter that asks for the name of the child bioassay set.
protected static GuiContext CONTEXT_BIOASSAYS
          GuiContext = [Item.BIOASSAY, GuiContext.Type.LIST]
protected static GuiContext CONTEXT_BIOASSAYSET
          GuiContext = [Item.BIOASSAYSET, GuiContext.Type.ITEM]
protected static Set<GuiContext> defaultGuiContexts
          The default gui contexts where it makes sense to use an analysis plugin.
private static StringParameterType descriptionType
          A parameter type for description parameters.
protected static StringParameterType nameType
          A parameter type for name parameters which are required and must have a value.
protected static StringParameterType optionalNameType
          A parameter type for name parameters which are optional.
protected static String SOURCE_BIOASSAYS
           
protected static String SOURCE_BIOASSAYSET
           
private static ItemParameterType<BioAssaySet> sourceBioAssaySetType
          The parameter type for the source bioassay set.
private  PluginParameter<BioAssaySet> sourceParameter
          The source parameter.
private  PluginParameter<BioAssay> sourceSubSetParameter
          The bioAssays subset parameter.
protected static String TRANSFORMATION_NAME
          The name of the parameter that asks for the name of the transformation.
 
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
 
Constructor Summary
protected AbstractAnalysisPlugin()
          Create a new AbstractAnalysisPlugin.
 
Method Summary
protected  PluginParameter<String> getChildDescriptionParameter(String label, String description, String defaultValue)
          Create a plugin parameter that asks for the description of the child bioassay set.
protected  PluginParameter<String> getChildNameParameter(String label, String description, String defaultValue)
          Create a plugin parameter that asks for the name of the child bioassay set.
protected  BioAssaySet getCurrentBioAssaySet(DbControl dc)
          Get the current source bioassay set.
protected  Experiment getCurrentExperiment(DbControl dc)
          Get the current experiment from information in the current context: SessionControl.getCurrentContext(Item.EXPERIMENT).
 Set<GuiContext> getGuiContexts()
           
 Plugin.MainType getMainType()
          Get the type of the plugin.
protected  List<BioAssay> getSourceBioAssays(DbControl dc)
          Gets a list of bioassays that were selected from the current bioassay set, to use for the analysis.
protected  BioAssaySet getSourceBioAssaySet(DbControl dc)
          Get the bioassay set that is used as the source for the plugin.
protected  PluginParameter<BioAssaySet> getSourceBioAssaySetParameter(String label, String description)
          Get a plugin parameter that asks for a bioassay set to use as data source for the plugin.
protected  PluginParameter<BioAssay> getSourceBioAssaysParameter(String label, String description)
          Gets a plugin parameter that asks for a subset of bioassays to use as data source for the plugin.
protected  String getTransformationName(DbControl dc)
          Generate a name for the transformation based on the plugin and it's configuration.
protected  PluginParameter<String> getTransformationNameParameter(String label, String description, String defaultValue)
          Create a plugin parameter that asks for the name of the transformation.
 String isInContext(GuiContext context, Object item)
          Check that the item is a bioassayset and that the logged in user has permission to use the current experiment.
protected  DynamicSpotQuery restrictSource(DynamicSpotQuery query, List<BioAssay> bioAssays)
          Restricts a query to only include values from listed bioassays
 
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
checkInterrupted, cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, requiresConfiguration, storeValue, storeValue, storeValues, supportsConfigurations, validateRequestParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.core.plugin.Plugin
getAbout, run
 

Field Detail

CONTEXT_BIOASSAYSET

protected static final GuiContext CONTEXT_BIOASSAYSET
GuiContext = [Item.BIOASSAYSET, GuiContext.Type.ITEM]

Since:
2.4

CONTEXT_BIOASSAYS

protected static final GuiContext CONTEXT_BIOASSAYS
GuiContext = [Item.BIOASSAY, GuiContext.Type.LIST]

Since:
2.4

defaultGuiContexts

protected static final Set<GuiContext> defaultGuiContexts
The default gui contexts where it makes sense to use an analysis plugin. Override for the InteractivePlugin.getGuiContexts() method to specify other contexts. This set can't be modified. This set only includes the CONTEXT_BIOASSAYSET.


nameType

protected static final StringParameterType nameType
A parameter type for name parameters which are required and must have a value.


optionalNameType

protected static final StringParameterType optionalNameType
A parameter type for name parameters which are optional.


descriptionType

private static final StringParameterType descriptionType
A parameter type for description parameters.


sourceBioAssaySetType

private static final ItemParameterType<BioAssaySet> sourceBioAssaySetType
The parameter type for the source bioassay set.


sourceParameter

private PluginParameter<BioAssaySet> sourceParameter
The source parameter.

See Also:
getSourceBioAssaySetParameter(String, String)

sourceSubSetParameter

private PluginParameter<BioAssay> sourceSubSetParameter
The bioAssays subset parameter. To use when working on subset of bioassays in a bioAssaySet

See Also:
getSourceBioAssaysParameter(String, String)

SOURCE_BIOASSAYSET

protected static final String SOURCE_BIOASSAYSET
See Also:
Constant Field Values

SOURCE_BIOASSAYS

protected static final String SOURCE_BIOASSAYS
See Also:
Constant Field Values

CHILD_NAME

protected static final String CHILD_NAME
The name of the parameter that asks for the name of the child bioassay set.

See Also:
getChildNameParameter(String, String, String), Constant Field Values

CHILD_DESCRIPTION

protected static final String CHILD_DESCRIPTION
The name of the parameter that asks for the description of the child bioassay set.

See Also:
getChildDescriptionParameter(String, String, String), Constant Field Values

TRANSFORMATION_NAME

protected static final String TRANSFORMATION_NAME
The name of the parameter that asks for the name of the transformation.

See Also:
getTransformationNameParameter(String, String, String), Constant Field Values
Constructor Detail

AbstractAnalysisPlugin

protected AbstractAnalysisPlugin()
Create a new AbstractAnalysisPlugin.

Method Detail

getMainType

public Plugin.MainType getMainType()
Description copied from interface: Plugin
Get the type of the plugin. This method must always return the same value.

Returns:
Plugin.MainType.ANALYZE

getGuiContexts

public Set<GuiContext> getGuiContexts()

isInContext

public String isInContext(GuiContext context,
                          Object item)
Check that the item is a bioassayset and that the logged in user has permission to use the current experiment.

Parameters:
context - Current guicontext
item - The item to check.
Returns:
null if the item is a bioassayset, an error message otherwise
Throws:
PermissionDeniedException - If the logged in user dosen't have permission to use the Experiment

getSourceBioAssaySetParameter

protected PluginParameter<BioAssaySet> getSourceBioAssaySetParameter(String label,
                                                                     String description)
Get a plugin parameter that asks for a bioassay set to use as data source for the plugin. Calling this method multiple times return the same plugin parameter object. The label and description for the first call is always used.

Parameters:
label - The parameter label, or null to use the default (Source bioasay set)
description - The parameter description, or null to use the default (The bioassay set that is used as the data source for this job.)

getSourceBioAssaysParameter

protected PluginParameter<BioAssay> getSourceBioAssaysParameter(String label,
                                                                String description)
Gets a plugin parameter that asks for a subset of bioassays to use as data source for the plugin.

Parameters:
label - The parameter's label. Uses a default value if null.
description - Description of the parameter. Uses a default value if null.
Returns:
A plugin parameter
Since:
2.4

getChildNameParameter

protected PluginParameter<String> getChildNameParameter(String label,
                                                        String description,
                                                        String defaultValue)
Create a plugin parameter that asks for the name of the child bioassay set.

Parameters:
label - The label to use for the parameter or null to use the default label (Child name)
description - The description to use for the parameter or null to use the default description (The name of the child bioassay set)
defaultValue - The default value for the child name or null to use the default value (New bioassay set)
Returns:
A plugin parameter

getChildDescriptionParameter

protected PluginParameter<String> getChildDescriptionParameter(String label,
                                                               String description,
                                                               String defaultValue)
Create a plugin parameter that asks for the description of the child bioassay set.

Parameters:
label - The label to use for the parameter or null to use the default label (Child description)
description - The description to use for the parameter or null to use the default description (An optional description of the child bioassay set)
defaultValue - The default value for the child name or null to not use any default value
Returns:
A plugin parameter

getTransformationNameParameter

protected PluginParameter<String> getTransformationNameParameter(String label,
                                                                 String description,
                                                                 String defaultValue)
Create a plugin parameter that asks for the name of the transformation.

Parameters:
label - The label to use for the parameter or null to use the default label (Transformation name)
description - The description to use for the parameter or null to use the default description (The name of the transformation)
defaultValue - The default value for the transformation name or null to not use any default
Returns:
A plugin parameter

getCurrentExperiment

protected Experiment getCurrentExperiment(DbControl dc)
Get the current experiment from information in the current context: SessionControl.getCurrentContext(Item.EXPERIMENT). Note that this information is normally only available during the configuration phase of a plugin, not during the execution phase.

Parameters:
dc - The DbControl to use for database access
Returns:
The current experiment or null

getCurrentBioAssaySet

protected BioAssaySet getCurrentBioAssaySet(DbControl dc)
Get the current source bioassay set. We first check the job's parameter values with the getSourceBioAssaySet(DbControl) method. If this returns null we check the information in the current context: SessionControl.getCurrentContext(Item.BIOASSAYSET). Note that this information is normally only available during the configuration phase of a plugin, not during the execution phase.

Parameters:
dc - The DbControl to use for database access
Returns:
The current bioassay set or null
See Also:
getSourceBioAssaySet(DbControl)

getSourceBioAssaySet

protected BioAssaySet getSourceBioAssaySet(DbControl dc)
Get the bioassay set that is used as the source for the plugin. The source bioassay set is only available in the execution phase if the plugin has saved it as a job parameter during the configuration of a job.

Returns:
The source bioassay set or null
See Also:
getSourceBioAssaySetParameter(String, String)

getSourceBioAssays

protected List<BioAssay> getSourceBioAssays(DbControl dc)
Gets a list of bioassays that were selected from the current bioassay set, to use for the analysis.

Parameters:
dc - The DbControl to access the database with
Returns:
A list with bioassays or null.
Since:
2.4

getTransformationName

protected String getTransformationName(DbControl dc)
Generate a name for the transformation based on the plugin and it's configuration. The name is created by taking the name of the plugin from the About.getName() method and combine it with the configuration used. If no configuration is used only the plugin name is used.

Parameters:
dc - The DbControl to use for database access
Returns:
A name for the transformation

restrictSource

protected DynamicSpotQuery restrictSource(DynamicSpotQuery query,
                                          List<BioAssay> bioAssays)
Restricts a query to only include values from listed bioassays

Parameters:
query - The query to set restriction on
bioAssays - A list with bioassays the restriction should include
Returns:
A DynamicSpotQuery object. The query parameter is restricted if bioAssays holds item(s), otherwise it will it will be the same
Since:
2.4

2.17.2: 2011-06-17