Class ExpressionExperimentManipulatingCLI
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.EnvironmentAware,CLI
- Direct Known Subclasses:
AffyDataFromCelCli,BatchEffectPopulationCli,DeleteDiffExCli,DeleteExperimentsCli,DifferentialExpressionAnalysisCli,DifferentialExpressionAnalysisWriterCli,ExperimentalDesignImportCli,ExperimentalDesignWriterCLI,ExpressionDataCorrMatCli,ExpressionDataMatrixWriterCLI,ExpressionExperimentDataFileGeneratorCli,ExpressionExperimentDataUpdaterCli,ExpressionExperimentMetadataChangelogEntryAdderCli,ExpressionExperimentMetadataChangelogViewerCli,ExpressionExperimentMetadataFileAdderCli,ExpressionExperimentPlatformSwitchCli,ExpressionExperimentPrimaryPubCli,ExpressionExperimentVectorsManipulatingCli,GeeqCli,LinkAnalysisCli,LockExpressionDataFileCli,MakeExperimentPrivateCli,MakeExperimentsPublicCli,OrderVectorsByDesignCli,ProcessedDataComputeCLI,RefreshExperimentCli,ReplaceDataCli,RNASeqBatchInfoCli,RNASeqDataAddCli,SingleCellDataLoaderCli,SingleCellSparsityMetricsUpdaterCli,SplitExperimentCli,SVDCli,UpdateEe2AdCli,UpdateEE2CCli,VectorMergingCli
- All EEs (if -all is supplied)
- All EEs for a particular taxon.
- A specific ExpressionExperimentSet, identified by name
- A comma-delimited list of one or more EEs identified by short name given on the command line
- From a file, with one short name per line.
- EEs matching a query string (e.g., 'brain')
- (Optional) 'Auto' mode, in which experiments to analyze are selected automatically based on their workflow state. This can be enabled and modified by subclasses who override the "needToRun" method.
- All EEs that were last processed after a given date, similar to 'auto' otherwise.
In addition, EEs can be excluded based on a list given in a separate file.
- Author:
- Paul
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classNested classes/interfaces inherited from interface ubic.gemma.cli.util.CLI
CLI.CommandGroup -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuditEventServiceprotected AuditTrailServiceprotected ExpressionExperimentServiceprotected EntityLocatorprotected EntityUrlBuilderprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from class ubic.gemma.cli.util.AbstractAutoSeekingCLI
FORCE_OPTIONFields inherited from class ubic.gemma.cli.util.AbstractCLI
ABORTED, FAILURE, FAILURE_FROM_ERROR_OBJECTS, log, SUCCESS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddExpressionDataFileOptions(org.apache.commons.cli.Options options, String what, boolean allowStandardLocation) protected voidaddExpressionDataFileOptions(org.apache.commons.cli.Options options, String what, boolean allowStandardLocation, boolean allowFile, boolean allowDirectory, boolean allowCurrentDirectory, boolean allowStdout) Add options for writing expression data files, such as raw or processed data files.protected voidaddSingleExperimentAutoOption(org.apache.commons.cli.Options options, String opt, String longOpt, String description, String noOpt, String longNoOpt, String noDescription) Add an auto option that is only available in single-experiment mode.protected <T extends Enum<T>>
voidaddSingleExperimentEnumOption(org.apache.commons.cli.Options options, String opt, String longOpt, String description, Class<T> enumClass, EnumMap<T, org.springframework.context.MessageSourceResolvable> descriptions) Add an enumerated option that is only available in single-experiment mode.protected voidaddSingleExperimentOption(org.apache.commons.cli.Options options, String opt, String longOpt, boolean hasArg, String description) Add an option that is only available in single-experiment mode.protected voidaddSingleExperimentOption(org.apache.commons.cli.Options options, org.apache.commons.cli.Option option) Add an option that is only available in single-experiment mode.protected voidbuildExperimentOptions(org.apache.commons.cli.Options options) protected final voidbuildOptions(org.apache.commons.cli.Options options) Build option implementation.protected voidprotected StringRender an experiment to string, with special handling in case of an uninitialized proxy.Obtain the command group for this CLI.getExpressionDataFileResult(org.apache.commons.cli.CommandLine commandLine, boolean allowStandardLocation) getExpressionDataFileResult(org.apache.commons.cli.CommandLine commandLine, boolean allowStandardLocation, boolean allowStdout, boolean allowCurrentDirectory) Obtain the result of the expression data file options added byaddExpressionDataFileOptions(Options, String, boolean).booleanIndicate if this CLI should abort on error or move on to the next experiment.protected booleannoNeedToRun(ExpressionExperiment auditable, Class<? extends AuditEventType> eventClass) Check if the given auditable can be skipped.protected voidpostprocessExpressionExperiments(Collection<ExpressionExperiment> expressionExperiments) Post-processExpressionExperiments that were processed by the CLI.protected Collection<ExpressionExperiment> preprocessExpressionExperiments(Collection<ExpressionExperiment> expressionExperiments) Preprocess the set ofExpressionExperimentbefore invokingprocessExpressionExperiments(Collection)orprocessExpressionExperiment(ExpressionExperiment).protected voidProcess allExpressionExperiment.protected voidprocessExperimentOptions(org.apache.commons.cli.CommandLine commandLine) protected voidprocessExpressionExperiment(ExpressionExperiment expressionExperiment) Process anExpressionExperiment.protected voidprocessExpressionExperiments(Collection<ExpressionExperiment> expressionExperiments) Process multipleExpressionExperiment.protected final voidprocessOptions(org.apache.commons.cli.CommandLine commandLine) Process command line options.protected StringreadChangelogEntryFromConsole(ExpressionExperiment expressionExperiment, String defaultText) Read a changelog entry from the console.protected voidrefreshExpressionExperimentFromGemmaWeb(ExpressionExperiment ee, boolean refreshVectors, boolean refreshReports) Refresh a dataset for Gemma Web.protected voidSet this to stop processing experiments if an error occurs.voidEnable the "all is lazy" mode.voidDefault to all datasets if no options are provided.protected voidEnable the single-experiment mode.protected voidSet this to allow reference to be retrieved instead of actual entities.protected final SerializabletoBatchObject(ExpressionExperiment object) Convert the given object to a serializable object for batch processing.Methods inherited from class ubic.gemma.cli.util.AbstractAutoSeekingCLI
addAutoOption, addAutoOption, addErrorObject, addErrorObject, addErrorObject, addForceOption, addForceOption, addLimitingDateOption, addSuccessObject, addSuccessObject, addWarningObject, addWarningObject, getAutoSeekEventType, getLimitingDate, isAutoSeek, isForce, setForceMethods inherited from class ubic.gemma.cli.util.AbstractAuthenticatedCLI
afterPropertiesSet, doWork, setAuthenticateAnonymously, setEnvironment, setRequireLoginMethods inherited from class ubic.gemma.cli.util.AbstractCLI
abort, addBatchOption, addErrorObject, addErrorObject, addErrorObject, addSuccessObject, addSuccessObject, addThreadsOption, addWarningObject, addWarningObject, allowPositionalArguments, awaitBatchExecutorService, executeCommand, getApplicationContext, getBatchTaskExecutor, getBatchTaskProgressReporter, getCliContext, getCommandAliases, getCommandName, getHelpFooter, getNumThreads, getOptions, getShortDesc, getUsage, promptConfirmationOrAbort, setAllowPositionalArguments, setApplicationContext, setEstimatedMaxTasks, setReportFrequencyMillis
-
Field Details
-
eeService
-
auditTrailService
-
auditEventService
-
entityLocator
-
entityUrlBuilder
-
OUTPUT_FILE_OPTION
- See Also:
-
OUTPUT_DIR_OPTION
- See Also:
-
STANDARD_LOCATION_OPTION
- See Also:
-
STANDARD_OUTPUT_OPTION
- See Also:
-
-
Constructor Details
-
ExpressionExperimentManipulatingCLI
protected ExpressionExperimentManipulatingCLI()
-
-
Method Details
-
getCommandGroup
Description copied from interface:CLIObtain the command group for this CLI.- Specified by:
getCommandGroupin interfaceCLI- Overrides:
getCommandGroupin classAbstractCLI
-
addSingleExperimentOption
protected void addSingleExperimentOption(org.apache.commons.cli.Options options, org.apache.commons.cli.Option option) Add an option that is only available in single-experiment mode. -
addSingleExperimentOption
protected void addSingleExperimentOption(org.apache.commons.cli.Options options, String opt, String longOpt, boolean hasArg, String description) Add an option that is only available in single-experiment mode. -
addSingleExperimentAutoOption
protected void addSingleExperimentAutoOption(org.apache.commons.cli.Options options, String opt, String longOpt, String description, String noOpt, String longNoOpt, String noDescription) Add an auto option that is only available in single-experiment mode.- See Also:
-
addSingleExperimentEnumOption
protected <T extends Enum<T>> void addSingleExperimentEnumOption(org.apache.commons.cli.Options options, String opt, String longOpt, String description, Class<T> enumClass, EnumMap<T, org.springframework.context.MessageSourceResolvable> descriptions) Add an enumerated option that is only available in single-experiment mode.- See Also:
-
addExpressionDataFileOptions
protected void addExpressionDataFileOptions(org.apache.commons.cli.Options options, String what, boolean allowStandardLocation) -
addExpressionDataFileOptions
protected void addExpressionDataFileOptions(org.apache.commons.cli.Options options, String what, boolean allowStandardLocation, boolean allowFile, boolean allowDirectory, boolean allowCurrentDirectory, boolean allowStdout) Add options for writing expression data files, such as raw or processed data files.- Parameters:
allowStandardLocation- if true, the standard location option will be addedallowFile- if true, the output file option will be added, otherwise only the output directory will be addedallowDirectory- if true, the output directory option will be addedallowCurrentDirectory- if true, writing to the current directory will be allowedallowStdout- if true, the standard output option will be added- See Also:
-
getExpressionDataFileResult
protected ExpressionExperimentManipulatingCLI.ExpressionDataFileResult getExpressionDataFileResult(org.apache.commons.cli.CommandLine commandLine, boolean allowStandardLocation) throws org.apache.commons.cli.ParseException - Throws:
org.apache.commons.cli.ParseException
-
getExpressionDataFileResult
protected ExpressionExperimentManipulatingCLI.ExpressionDataFileResult getExpressionDataFileResult(org.apache.commons.cli.CommandLine commandLine, boolean allowStandardLocation, boolean allowStdout, boolean allowCurrentDirectory) throws org.apache.commons.cli.ParseException Obtain the result of the expression data file options added byaddExpressionDataFileOptions(Options, String, boolean).- Parameters:
allowStandardLocation- if true, the standard location option will be considered and used as a default if no other destination is selected. Otherwise, standard output will be used as a default.allowStdout- if true, the standard output option will be considered and used as a default if no other destination is selected. Otherwise, the current directory will be used as a default.allowCurrentDirectory- if true, the current directory will be used as a default if no other destination is selected. Note that a file can be written to inside that directory viaExpressionExperimentManipulatingCLI.ExpressionDataFileResult.getOutputFile(String)- Throws:
org.apache.commons.cli.MissingOptionException- if no destination is selected and no default location is allowed.org.apache.commons.cli.ParseException
-
buildOptions
protected final void buildOptions(org.apache.commons.cli.Options options) Description copied from class:AbstractCLIBuild option implementation.Implement this method to add options to your command line, using the OptionBuilder.
This is called right after
AbstractCLI.buildStandardOptions(Options)so the options will be added after standard options.- Overrides:
buildOptionsin classAbstractCLI
-
buildExperimentOptions
protected void buildExperimentOptions(org.apache.commons.cli.Options options) -
processOptions
protected final void processOptions(org.apache.commons.cli.CommandLine commandLine) throws org.apache.commons.cli.ParseException Description copied from class:AbstractCLIProcess command line options.Implement this to provide processing of options. It is called after
AbstractCLI.buildOptions(Options)and right beforeAbstractCLI.doWork().- Overrides:
processOptionsin classAbstractAutoSeekingCLI<ExpressionExperiment>- Throws:
org.apache.commons.cli.ParseException- in case of unrecoverable failure (i.e. missing option or invalid value), an exception can be raised and will result in an exit code ofAbstractCLI.FAILURE.
-
processExperimentOptions
protected void processExperimentOptions(org.apache.commons.cli.CommandLine commandLine) throws org.apache.commons.cli.ParseException - Throws:
org.apache.commons.cli.ParseException
-
doAuthenticatedWork
- Specified by:
doAuthenticatedWorkin classAbstractAuthenticatedCLI- Throws:
Exception
-
preprocessExpressionExperiments
protected Collection<ExpressionExperiment> preprocessExpressionExperiments(Collection<ExpressionExperiment> expressionExperiments) Preprocess the set ofExpressionExperimentbefore invokingprocessExpressionExperiments(Collection)orprocessExpressionExperiment(ExpressionExperiment).This can be an opportunity to filter or modify the set of experiments.
-
processAllExpressionExperiments
protected void processAllExpressionExperiments()Process allExpressionExperiment.This is only called when
-alland the CLI is configured to treat it lazily withsetAllIsLazy(). -
processExpressionExperiments
Process multipleExpressionExperiment.This only called if more than one experiment was found.
-
processExpressionExperiment
protected void processExpressionExperiment(ExpressionExperiment expressionExperiment) throws Exception Process anExpressionExperiment.- Throws:
Exception
-
postprocessExpressionExperiments
protected void postprocessExpressionExperiments(Collection<ExpressionExperiment> expressionExperiments) Post-processExpressionExperiments that were processed by the CLI. -
toBatchObject
Description copied from class:AbstractAutoSeekingCLIConvert the given object to a serializable object for batch processing.- Specified by:
toBatchObjectin classAbstractAutoSeekingCLI<ExpressionExperiment>
-
refreshExpressionExperimentFromGemmaWeb
protected void refreshExpressionExperimentFromGemmaWeb(ExpressionExperiment ee, boolean refreshVectors, boolean refreshReports) throws Exception Refresh a dataset for Gemma Web.- Parameters:
refreshVectors- if true, refresh vectors from the caches, that include raw, single-cell, processed and also cached processed vectors in the form ofDataVectorValueObject.- Throws:
Exception
-
setSingleExperimentMode
protected void setSingleExperimentMode()Enable the single-experiment mode. -
setDefaultToAll
public void setDefaultToAll()Default to all datasets if no options are provided.This is a very dangerous setting that should be combined with
useReferencesIfPossible. -
setAllIsLazy
public void setAllIsLazy()Enable the "all is lazy" mode.When
-allis set, no experiments are actually loaded andprocessAllExpressionExperiments()is called instead. -
setUseReferencesIfPossible
protected void setUseReferencesIfPossible()Set this to allow reference to be retrieved instead of actual entities.This only works for entities retrieved by ID.
When this is enabled, do not access anything but
ExpressionExperiment.getId(), or else proxy-initialization will be triggered, and you will have to deal with aLazyInitializationException.The default is false.
-
isAbortOnError
public boolean isAbortOnError()Indicate if this CLI should abort on error or move on to the next experiment. -
setAbortOnError
protected void setAbortOnError()Set this to stop processing experiments if an error occurs. -
formatExperiment
Render an experiment to string, with special handling in case of an uninitialized proxy.Use this for printing datasets if
useReferencesIfPossibleis set to preventLazyInitializationException. -
noNeedToRun
protected boolean noNeedToRun(ExpressionExperiment auditable, @Nullable Class<? extends AuditEventType> eventClass) Description copied from class:AbstractAutoSeekingCLICheck if the given auditable can be skipped.- Overrides:
noNeedToRunin classAbstractAutoSeekingCLI<ExpressionExperiment>- Parameters:
auditable- auditableeventClass- can be null- Returns:
- boolean
-
readChangelogEntryFromConsole
protected String readChangelogEntryFromConsole(ExpressionExperiment expressionExperiment, @Nullable String defaultText) throws IOException, InterruptedException Read a changelog entry from the console.- Parameters:
defaultText- a default text to be shown in the editor, or null to keep the file empty- Throws:
IOExceptionInterruptedException
-