Package net.sf.basedb.plugins
Class Base1PluginExecuter
java.lang.Object
net.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.core.plugin.AbstractAnalysisPlugin
net.sf.basedb.plugins.Base1PluginExecuter
- All Implemented Interfaces:
InteractivePlugin
,Plugin
,SignalTarget
public class Base1PluginExecuter
extends AbstractAnalysisPlugin
implements InteractivePlugin, SignalTarget
This plug-in executes a plug-in from the Base1 system. It takes a base1 configuration
file to create its configuration.
- Version:
- 2.2
- Author:
- Johan Enell
- Last modified
- $Date: 2018-11-02 09:45:34 +0100 (fr, 02 nov 2018) $
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static enum
private class
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
This command is used if the user decides to configure the plugin by hand.private RequestInformation
Holds info about a job configuration request.private RequestInformation
Holds information about a manual plugin configuration request.private RequestInformation
Holds information about a plugin configuration request.private static final URL
private File
This is the directory where the plugin will generate its output.private PluginParameter<String>
The name of the executable.private static PluginParameter<String>
The path to where the plug-in executer can find the executables.private static final PluginParameter<File>
Parameter definition that asks for the configuration file that should be imported.private PluginParameter<Boolean>
If the data should be exported averaged per gene.private List<PluginParameter<?>>
This list holds the job parameters derived from the configuration file.private PluginParameter<String>
This parameter describes the job parameters that the base1 plugin needs.private PluginParameter<Boolean>
If the plug-in should leave the stdin.txt after execution.private PluginParameter<Boolean>
If the plug-in should leave the stdout.txt after execution.private PluginParameter<Integer>
The maximum number of channels, 0 means unlimited.private PluginParameter<Integer>
The minimum number of channels.private static final Set<Permissions>
The plug-in permissions.private PluginParameter<String>
The directory where the plug-in will store it's output.private PluginParameter<Boolean>
This parameter describes if the data should be exported in serial format or in matrix.private ThreadSignalHandler
private PluginParameter<String>
The reporter fields that should be exported as a tab separated string of column headers.private PluginParameter<String>
The spot fields that should be exported as a tab separated string of column headers.private PluginParameter<String>
The version number of the plug-in.Fields inherited from class net.sf.basedb.core.plugin.AbstractAnalysisPlugin
CHILD_DESCRIPTION, CHILD_NAME, CONTEXT_BIOASSAYS, CONTEXT_BIOASSAYSET, CONTEXT_DERIVEDBIOASSAY, defaultGuiContexts, nameType, optionalNameType, SOURCE_BIOASSAYS, SOURCE_BIOASSAYSET, SOURCE_DERIVEDBIOASSAY, TRANSFORMATION_NAME
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
associateFiles
(DbControl dc, Transformation trans, Directory homeDirectory) void
configure
(GuiContext context, Request request, Response response) Configure the plugin.private void
Copies the content from a File to a directory on the file system.private boolean
Deletes all files and sub directories under dir.private File
exportData
(DbControl dc, Directory workingDirectory, ProgressReporter progress) Export the bioassay set to a file called 'stdin.txt' in the plugin directory.private List<AnnotationType>
Get the experimental factors connected to a experiment.private Boolean
getBoolean
(String s) Creates a boolean from a string.private RequestInformation
Creates the information needed for job configuration and initiates the parameters.private RequestInformation
Creates the information needed for plugin configuration and initiates the parameters.private File
Get the exec directory as a java.io.File.private String
private FlatFileParser
getInitializedFlatFileParser
(InputStream stream, String charset) Creates aFlatFileParser
for a plugin configuration file.private Map<String,
Base1PluginExecuter.JobParameter> getJobParameterObjectsFromXML
(String xml, boolean hideRemoved) private List<PluginParameter<?>>
Reads the configuration file an creates the parameters found there.private List<PluginParameter<?>>
getJobParametersFromXML
(String xml, boolean hideRemoved) private RequestInformation
Creates the information needed for manual configuration and initiates the parameters.Get the data from the configuration file.Return null, which gives the plugin the same permissions as the logged in user.private Directory
getPluginDirectory
(DbControl dc, String pathName) Get adirectory
getRequestInformation
(GuiContext context, String command) This method will return theRequestInformation
for a given command, i.e.Get the signal handler that is handling signals on behalf of this object.private BioAssaySet
importData
(DbControl dc, File stdout, Transformation t, IntensityTransform resultTransform, ProgressReporter progress) Imports the data from the file stdout.txt in the execution directory.private void
importTempFiles
(DbControl dc, File[] files, Directory d) isInContext
(GuiContext context, Object item) Checks if the BioAssaySet has the number of channels specified by the configuration and that it has the extra values.boolean
Returns FALSE, since that is how the plugins used to work before this method was introduced.void
run
(Request request, Response response, ProgressReporter progress) Run the plugin.boolean
Returns TRUE, since that is how the plugins used to work before this method was introduced.Methods inherited from class net.sf.basedb.core.plugin.AbstractAnalysisPlugin
getChildDescriptionParameter, getChildNameParameter, getCurrentBioAssaySet, getCurrentDerivedBioAssay, getCurrentExperiment, getGuiContexts, getMainType, getSourceBioAssays, getSourceBioAssaySet, getSourceBioAssaySetParameter, getSourceBioAssaysParameter, getSourceDerivedBioAssay, getSourceDerivedBioAssayParameter, getTransformationName, getTransformationNameParameter, restrictSource
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, init, isLogging, log, log, storeValue, storeValue, storeValues, 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.InteractivePlugin
getGuiContexts
Methods inherited from interface net.sf.basedb.core.plugin.Plugin
done, getMainType, init
-
Field Details
-
permissions
The plug-in permissions. -
dtdFile
-
fileParameter
Parameter definition that asks for the configuration file that should be imported. -
execPathParameter
The path to where the plug-in executer can find the executables. In Base1 this was default to /usr/local/base/plugins. -
serialFormatParameter
This parameter describes if the data should be exported in serial format or in matrix. -
versionNumberParameter
The version number of the plug-in. -
execNameParameter
The name of the executable. -
geneAveragesParameter
If the data should be exported averaged per gene. -
minChannelsParameter
The minimum number of channels. -
maxChannelsParameter
The maximum number of channels, 0 means unlimited. -
leaveStdinParameter
If the plug-in should leave the stdin.txt after execution. -
leaveStdoutParameter
If the plug-in should leave the stdout.txt after execution. -
usedColumnsParameter
The reporter fields that should be exported as a tab separated string of column headers. -
usedFieldsParameter
The spot fields that should be exported as a tab separated string of column headers. -
jobParametersParameter
This parameter describes the job parameters that the base1 plugin needs. -
pluginDirectoryParameter
The directory where the plug-in will store it's output. -
COMMAND_MANUAL_CONFIG
This command is used if the user decides to configure the plugin by hand.- See Also:
-
configureJob
Holds info about a job configuration request. -
configurePlugin
Holds information about a plugin configuration request. -
configureManual
Holds information about a manual plugin configuration request. -
jobParameters
This list holds the job parameters derived from the configuration file. -
execDirectory
This is the directory where the plugin will generate its output. -
signalHandler
-
-
Constructor Details
-
Base1PluginExecuter
public Base1PluginExecuter()
-
-
Method Details
-
isInContext
Checks if the BioAssaySet has the number of channels specified by the configuration and that it has the extra values.- Specified by:
isInContext
in interfaceInteractivePlugin
- Overrides:
isInContext
in classAbstractAnalysisPlugin
- Parameters:
context
- The context from where the plugin is invoked.item
- The item that should be checked if it is in context.- Returns:
- null if the item is in context, otherwise an error message.
- See Also:
-
getRequestInformation
public RequestInformation getRequestInformation(GuiContext context, String command) throws BaseException Description copied from interface:InteractivePlugin
This method will return theRequestInformation
for a given command, i.e. the list of parameters and some nice help text.- Specified by:
getRequestInformation
in interfaceInteractivePlugin
- Parameters:
context
- The current context of the client application, it is one of the values found in set returned byInteractivePlugin.getGuiContexts()
command
- The command- Returns:
- The
RequestInformation
for the command - Throws:
BaseException
- if there is an error
-
configure
Description copied from interface:InteractivePlugin
Configure the plugin. Hopefully the client is supplying values for the parameters specified byInteractivePlugin.getRequestInformation(GuiContext, String)
.- Specified by:
configure
in interfaceInteractivePlugin
- Parameters:
context
- The current context of the client application, it is one of the values found in set returned byInteractivePlugin.getGuiContexts()
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response through
-
copy
Copies the content from a File to a directory on the file system.- Parameters:
f
- The file to be copied.d
- The directory where the file will be written.- Throws:
IOException
- If there is any error with target.
-
deleteDir
Deletes all files and sub directories under dir.- Returns:
- true if all deletions were successful
-
getPermissions
Description copied from class:AbstractPlugin
Return null, which gives the plugin the same permissions as the logged in user.- Specified by:
getPermissions
in interfacePlugin
- Overrides:
getPermissions
in classAbstractPlugin
- Returns:
- A collection of permissions or null to not use permissions
-
supportsConfigurations
public boolean supportsConfigurations()Description copied from class:AbstractPlugin
Returns TRUE, since that is how the plugins used to work before this method was introduced.- Specified by:
supportsConfigurations
in interfacePlugin
- Overrides:
supportsConfigurations
in classAbstractPlugin
- Returns:
- TRUE or FALSE
-
requiresConfiguration
public boolean requiresConfiguration()Description copied from class:AbstractPlugin
Returns FALSE, since that is how the plugins used to work before this method was introduced.- Specified by:
requiresConfiguration
in interfacePlugin
- Overrides:
requiresConfiguration
in classAbstractPlugin
- Returns:
- TRUE or FALSE
-
run
Description copied from interface:Plugin
Run the plugin. If a progress reporter object is passed it is recommended that the plugin makes use of it.- Specified by:
run
in interfacePlugin
- Parameters:
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response throughprogress
- AProgressReporter
where the plugin can report its progess, can be null
-
getSignalHandler
Description copied from interface:SignalTarget
Get the signal handler that is handling signals on behalf of this object. Multiple invokations of this method may receive the same or different objects. Null may be returned if, for some reason, the current object instance doesn't want to receive signals. Returning null is the same as not implementing this interface.- Specified by:
getSignalHandler
in interfaceSignalTarget
- Returns:
- A SignalHandler object, or null if the current instance doesn't support signals
-
exportData
Export the bioassay set to a file called 'stdin.txt' in the plugin directory.- Parameters:
dc
- DbControl used to access the databaseworkingDirectory
- Where in base' file system the exported BASEFile should be stored.- Returns:
- The file where the data is exported to.
-
getAnnotationTypes
Get the experimental factors connected to a experiment.- Returns:
- A list of
AnnotationType
:s
-
getParametersFromBaseFile
Get the data from the configuration file.- Parameters:
f
- The file.- Returns:
- A map of name->value pairs.
- Throws:
IOException
- If there i any problem reading from file.
-
getJobParameterObjectsFromXML
private Map<String,Base1PluginExecuter.JobParameter> getJobParameterObjectsFromXML(String xml, boolean hideRemoved) -
getJobParametersFromXML
-
getBoolean
Creates a boolean from a string.- Parameters:
s
- The string.- Returns:
- false if s.equals("0") else true.
-
getManualConfigureParameters
Creates the information needed for manual configuration and initiates the parameters. The parameters added are: versionNumber, usedColumns, usedFields, execName, geneAverages, SerialFormat, leaveStdin, leaveStdout, minChannel and maxCannel.- Returns:
- The RequestInformation.
-
getConfigureJobParameters
Creates the information needed for job configuration and initiates the parameters. The parameters added are: bioAssaySet and the parameters found in the configuration file.- Returns:
- The RequestInformation
-
getConfigurePluginParameters
Creates the information needed for plugin configuration and initiates the parameters. The parameters added are: file and execPath.- Returns:
- The RequestInformation.
-
getExecDirectory
Get the exec directory as a java.io.File. The exec directory is a sub directory in "java.io.tmpdir".- Returns:
- the directory.
- Throws:
IOException
-
getExecLine
-
getInitializedFlatFileParser
Creates aFlatFileParser
for a plugin configuration file.- Parameters:
stream
- The stream that the parser should read from.- Returns:
- The initialised parser
-
getJobParameters
Reads the configuration file an creates the parameters found there.- Returns:
- A list of
PluginParameter
:s - Throws:
BaseException
-
getPluginDirectory
Get adirectory
-
importData
private BioAssaySet importData(DbControl dc, File stdout, Transformation t, IntensityTransform resultTransform, ProgressReporter progress) throws SQLException, IOException Imports the data from the file stdout.txt in the execution directory.- Throws:
IOException
- if there is any error reading from stdout.txtSQLException
-
associateFiles
-
importTempFiles
-