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) $
  • Field Details

  • Constructor Details

    • AbstractAnalysisPlugin

      protected AbstractAnalysisPlugin()
      Create a new AbstractAnalysisPlugin.
  • Method Details

    • 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 guicontext
      item - 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 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

      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:
    • 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 the getSourceDerivedBioAssay(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:
    • 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:
    • 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