Package net.sf.basedb.core.plugin
Class AbstractAnalysisPlugin
- java.lang.Object
-
- net.sf.basedb.core.plugin.AbstractPlugin
-
- net.sf.basedb.core.plugin.AbstractAnalysisPlugin
-
- All Implemented Interfaces:
Plugin
- Direct Known Subclasses:
Base1PluginExecuter
,ExternalProgramExecutor
,FormulaFilter
,JepExtraValueCalculator
,JepIntensityTransformer
,LowessNormalization
,ManualDerivedBioAssayCreator
,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: 2019-02-26 11:10:15 +0100 (tis, 26 feb. 2019) $
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
-
-
Field Summary
Fields Modifier and Type Field Description 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 GuiContext
CONTEXT_DERIVEDBIOASSAY
GuiContext = [Item.DERIVEDBIOASSAY, 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
protected static String
SOURCE_DERIVEDBIOASSAY
private PluginParameter<BioAssaySet>
sourceBioAssaySetParameter
The source parameter for bioassay set.private static ItemParameterType<BioAssaySet>
sourceBioAssaySetType
The parameter type for the source bioassay set.private PluginParameter<DerivedBioAssay>
sourceDerivedBioAssayParameter
The source parameter for derived bioassay.private static ItemParameterType<DerivedBioAssay>
sourceDerivedBioAssayType
The parameter type for the source derived bioassay.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
Constructors Modifier Constructor Description protected
AbstractAnalysisPlugin()
Create a newAbstractAnalysisPlugin
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 DerivedBioAssay
getCurrentDerivedBioAssay(DbControl dc)
Get the current source derived bioassay.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 DerivedBioAssay
getSourceDerivedBioAssay(DbControl dc)
Get the derived bioassay that is used as the source for the plugin.protected PluginParameter<DerivedBioAssay>
getSourceDerivedBioAssayParameter(String label, String description)
Get a plugin parameter that asks for a derived bioassay 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/derived bioassay and that the logged in user has permission to use the current item.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
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, requiresConfiguration, storeValue, storeValue, storeValues, supportsConfigurations, validateRequestParameters
-
-
-
-
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
-
CONTEXT_DERIVEDBIOASSAY
protected static final GuiContext CONTEXT_DERIVEDBIOASSAY
GuiContext = [Item.DERIVEDBIOASSAY, GuiContext.Type.ITEM]- Since:
- 3.0
-
defaultGuiContexts
protected static final Set<GuiContext> defaultGuiContexts
The default gui contexts where it makes sense to use an analysis plugin. Override for theInteractivePlugin.getGuiContexts()
method to specify other contexts. This set can't be modified. This set only includes theCONTEXT_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.
-
sourceBioAssaySetParameter
private PluginParameter<BioAssaySet> sourceBioAssaySetParameter
The source parameter for bioassay set.
-
sourceDerivedBioAssayType
private static final ItemParameterType<DerivedBioAssay> sourceDerivedBioAssayType
The parameter type for the source derived bioassay.- Since:
- 3.0
-
sourceDerivedBioAssayParameter
private PluginParameter<DerivedBioAssay> sourceDerivedBioAssayParameter
The source parameter for derived bioassay.- Since:
- 3.0
- See Also:
getSourceDerivedBioAssayParameter(String, String)
-
sourceSubSetParameter
private PluginParameter<BioAssay> sourceSubSetParameter
The bioAssays subset parameter. To use when working on subset of bioassays in a bioAssaySet
-
SOURCE_BIOASSAYSET
protected static final String SOURCE_BIOASSAYSET
- See Also:
- Constant Field Values
-
SOURCE_DERIVEDBIOASSAY
protected static final String SOURCE_DERIVEDBIOASSAY
- 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.
-
CHILD_DESCRIPTION
protected static final String CHILD_DESCRIPTION
The name of the parameter that asks for the description of the child bioassay set.
-
TRANSFORMATION_NAME
protected static final String TRANSFORMATION_NAME
The name of the parameter that asks for the name of the transformation.
-
-
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/derived bioassay and that the logged in user has permission to use the current item.- Parameters:
context
- Current guicontextitem
- The item to check.- Returns:
- null if the item is a valid item, 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.)
-
getSourceDerivedBioAssayParameter
protected PluginParameter<DerivedBioAssay> getSourceDerivedBioAssayParameter(String label, String description)
Get a plugin parameter that asks for a derived bioassay 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 bioassay)description
- The parameter description, or null to use the default (The derived bioassay 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 thegetSourceBioAssaySet(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
-
getCurrentDerivedBioAssay
protected DerivedBioAssay getCurrentDerivedBioAssay(DbControl dc)
Get the current source derived bioassay. We first check the job's parameter values with thegetSourceDerivedBioAssay(DbControl)
method. If this returns null we check the information in the current context:SessionControl.getCurrentContext(Item.DERIVEDBIOASSAY)
. 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 derived bioassay or null
- Since:
- 3.0
- See Also:
getSourceBioAssaySet(DbControl)
-
getSourceDerivedBioAssay
protected DerivedBioAssay getSourceDerivedBioAssay(DbControl dc)
Get the derived bioassay that is used as the source for the plugin. The source bioassay 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 derived bioassay or null
- Since:
- 3.0
- See Also:
getSourceDerivedBioAssayParameter(String, String)
-
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 theAbout.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 onbioAssays
- 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
-
-