diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/resource/DownloadResourcesTool.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/resource/DownloadResourcesTool.java index c0f24c0ebb..3139a769a9 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/resource/DownloadResourcesTool.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/resource/DownloadResourcesTool.java @@ -11,8 +11,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.List; import static org.opencb.opencga.core.tools.ResourceManager.RESOURCES_FOLDER_NAME; @@ -24,21 +22,14 @@ priority = Enums.Priority.HIGH) public class DownloadResourcesTool extends OpenCgaTool { - public static final String ID = "resource-download-all"; - public static final String DESCRIPTION = "Download all resources"; - - public static final String DOWNLOAD_RESOURCES_STEP = "download-resources"; - public static final String MOVE_RESOURCES_STEP = "move-resources"; + public static final String ID = "resource-downloader"; + public static final String DESCRIPTION = "Download all resources from the server"; private Path resourcePath; @ToolParams protected final DownloadResourcesToolParams analysisParams = new DownloadResourcesToolParams(); - protected List getSteps() { - return Arrays.asList(DOWNLOAD_RESOURCES_STEP, MOVE_RESOURCES_STEP); - } - @Override protected void check() throws Exception { super.check(); @@ -53,21 +44,12 @@ protected void check() throws Exception { @Override protected void run() throws Exception { // Download all resources - step(DOWNLOAD_RESOURCES_STEP, this::downloadResources); - - // Move resources to the installation folder - step(MOVE_RESOURCES_STEP, this::moveResources); + step(ID, this::downloadResources); } private void downloadResources() throws IOException, NoSuchAlgorithmException { - ResourceManager resourceManager = new ResourceManager(getOpencgaHome(), analysisParams.getBaseurl()); + ResourceManager resourceManager = new ResourceManager(getOpencgaHome(), analysisParams.getBaseUrl()); resourceManager.downloadAllResources(getOutDir().resolve(RESOURCES_FOLDER_NAME), Boolean.TRUE.equals(analysisParams.getOverwrite())); } - - private void moveResources() { - - } - - } diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java index 02c7e429ef..545e552e0e 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java @@ -201,9 +201,8 @@ private RestResponse downloadAllResource() throws Exception { .readValue(new java.io.File(commandOptions.jsonFile), DownloadResourcesToolParams.class); } else { ObjectMap beanParams = new ObjectMap(); - putNestedIfNotEmpty(beanParams, "baseurl", commandOptions.baseurl, true); + putNestedIfNotEmpty(beanParams, "baseUrl", commandOptions.baseUrl, true); putNestedIfNotNull(beanParams, "overwrite", commandOptions.overwrite, true); - putNestedIfNotEmpty(beanParams, "outdir", commandOptions.outdir, true); downloadResourcesToolParams = JacksonUtils.getDefaultObjectMapper().copy() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AdminCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AdminCommandOptions.java index 2f7ade23d7..d949f2db08 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AdminCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AdminCommandOptions.java @@ -137,7 +137,7 @@ public class JwtCatalogCommandOptions { } - @Parameters(commandNames = {"resource-download-all"}, commandDescription ="Download all resources") + @Parameters(commandNames = {"resource-download-all"}, commandDescription ="Download all resources from the server") public class DownloadAllResourceCommandOptions { @ParametersDelegate @@ -170,15 +170,12 @@ public class DownloadAllResourceCommandOptions { @Parameter(names = {"--job-dry-run"}, description = "Flag indicating that the job will be executed in dry-run mode. In this mode, OpenCGA will validate that all parameters and prerequisites are correctly set for successful execution, but the job will not actually run.", required = false, arity = 1) public Boolean jobDryRun; - @Parameter(names = {"--baseurl"}, description = "Base URL where the resources are located", required = false, arity = 1) - public String baseurl; + @Parameter(names = {"--base-url"}, description = "Base URL where the resources are located, this is an optional parameter, by default the resources will be downloaded from the OpenCB repository.", required = false, arity = 1) + public String baseUrl; - @Parameter(names = {"--overwrite"}, description = "Download and overwrite previously downloaded resources", required = false, arity = 1) + @Parameter(names = {"--overwrite"}, description = "Download and overwrite previously downloaded resources if they already exist.", required = false, arity = 1) public Boolean overwrite; - @Parameter(names = {"--outdir"}, description = "Output dir for the job.", required = false, arity = 1) - public String outdir; - } @Parameters(commandNames = {"users-create"}, commandDescription ="Create a new user") diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java index b9dc5e1956..c4c20d749e 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java @@ -679,7 +679,7 @@ public class RunInterpreterExomiserCommandOptions { @Parameter(names = {"--job-dry-run"}, description = "Flag indicating that the job will be executed in dry-run mode. In this mode, OpenCGA will validate that all parameters and prerequisites are correctly set for successful execution, but the job will not actually run.", required = false, arity = 1) public Boolean jobDryRun; - @Parameter(names = {"--clinical-analysis"}, description = "Clinical analysis ID.", required = false, arity = 1) + @Parameter(names = {"--clinical-analysis"}, description = "Clinical analysis ID to be analysed.", required = false, arity = 1) public String clinicalAnalysis; @Parameter(names = {"--exomiser-version"}, description = "Exomiser version in the format X.Y where X is the major version and Y the minor version, e.g.: 14.0. If the version is not specified, the default version will be used. Refer to the configuration file to view all installed Exomiser versions and identify the default version.", required = false, arity = 1) diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java index 44a0ad64dd..baf763981f 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java @@ -428,7 +428,7 @@ public class RunExomiserCommandOptions { @Parameter(names = {"--job-dry-run"}, description = "Flag indicating that the job will be executed in dry-run mode. In this mode, OpenCGA will validate that all parameters and prerequisites are correctly set for successful execution, but the job will not actually run.", required = false, arity = 1) public Boolean jobDryRun; - @Parameter(names = {"--sample"}, description = "Sample ID.", required = false, arity = 1) + @Parameter(names = {"--sample"}, description = "Sample ID to be analysed.", required = false, arity = 1) public String sample; @Parameter(names = {"--exomiser-version"}, description = "Exomiser version in the format X.Y where X is the major version and Y the minor version, e.g.: 14.0. If the version is not specified, the default version will be used. Refer to the configuration file to view all installed Exomiser versions and identify the default version.", required = false, arity = 1) diff --git a/opencga-client/src/main/R/R/Admin-methods.R b/opencga-client/src/main/R/R/Admin-methods.R index 20c429b0c7..4e214e0a16 100644 --- a/opencga-client/src/main/R/R/Admin-methods.R +++ b/opencga-client/src/main/R/R/Admin-methods.R @@ -67,7 +67,7 @@ setMethod("adminClient", "OpencgaR", function(OpencgaR, user, endpointName, para subcategoryId=NULL, action="jwt", params=params, httpMethod="POST", as.queryParam=NULL, ...), #' @section Endpoint /{apiVersion}/admin/resource/downloadAll: - #' Download all resources. + #' Download all resources from the server. #' @param jobId Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not provided. #' @param jobDescription Job description. #' @param jobDependsOn Comma separated list of existing job IDs the job will depend on. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java index 5cb9d16ee5..5ec7dab254 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java @@ -103,7 +103,7 @@ public RestResponse jwtCatalog(JWTParams data, ObjectMap params) thro } /** - * Download all resources. + * Download all resources from the server. * @param data Download-resources tool parameters. * @param params Map containing any of the following optional parameters. * jobId: Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not provided. diff --git a/opencga-client/src/main/javascript/Admin.js b/opencga-client/src/main/javascript/Admin.js index 4d6bc1850a..5106728492 100644 --- a/opencga-client/src/main/javascript/Admin.js +++ b/opencga-client/src/main/javascript/Admin.js @@ -69,7 +69,7 @@ export default class Admin extends OpenCGAParentClass { return this._post("admin", null, "catalog", null, "jwt", data, params); } - /** Download all resources + /** Download all resources from the server * @param {Object} data - Download-resources tool parameters. * @param {Object} [params] - The Object containing the following optional parameters: * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py index 8ce1ea84f2..3b410bb31d 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py @@ -67,7 +67,7 @@ def jwt_catalog(self, data=None, **options): def download_all_resource(self, data=None, **options): """ - Download all resources. + Download all resources from the server. PATH: /{apiVersion}/admin/resource/downloadAll :param dict data: Download-resources tool parameters. (REQUIRED) diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java index 64daeb77dd..23b8cee110 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java @@ -549,14 +549,16 @@ public class FieldConstants { public static final String ALIGNMENT_QC_OVERWRITE_DESCRIPTION = "To overwrite the QC metrics already computed."; // Exomiser - public static final String EXOMISER_CLINICAL_ANALYSIS_DESCRIPTION = "Clinical analysis ID."; - public static final String EXOMISER_SAMPLE_DESCRIPTION = "Sample ID."; + public static final String EXOMISER_CLINICAL_ANALYSIS_DESCRIPTION = "Clinical analysis ID to be analysed."; + public static final String EXOMISER_SAMPLE_DESCRIPTION = "Sample ID to be analysed."; public static final String EXOMISER_CLINICAL_ANALYSIS_TYPE_DESCRIPTION = "Clinical analysis type: SINGLE or FAMILY."; public static final String EXOMISER_VERSION_DESCRIPTION = "Exomiser version in the format X.Y where X is the major version and Y the" + " minor version, e.g.: 14.0. If the version is not specified, the default version will be used. Refer to the configuration" + " file to view all installed Exomiser versions and identify the default version."; // Download all resources - public static final String DOWNLOAD_ALL_RESOURCES_BASEURL_DESCRIPTION = "Base URL where the resources are located"; - public static final String DOWNLOAD_ALL_RESOURCES_OVERWRITE_DESCRIPTION = "Download and overwrite previously downloaded resources"; + public static final String DOWNLOAD_ALL_RESOURCES_BASEURL_DESCRIPTION = "Base URL where the resources are located, this is an optional" + + " parameter, by default the resources will be downloaded from the OpenCB repository."; + public static final String DOWNLOAD_ALL_RESOURCES_OVERWRITE_DESCRIPTION = "Download and overwrite previously downloaded resources if" + + " they already exist."; } diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/resource/DownloadResourcesToolParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/resource/DownloadResourcesToolParams.java index 7af2d47552..1d6cddfe79 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/resource/DownloadResourcesToolParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/resource/DownloadResourcesToolParams.java @@ -20,46 +20,39 @@ import org.opencb.opencga.core.api.FieldConstants; import org.opencb.opencga.core.tools.ToolParams; -import java.util.List; - public class DownloadResourcesToolParams extends ToolParams { public static final String DESCRIPTION = "Download-resources tool parameters"; - @DataField(id = "baseurl", description = FieldConstants.DOWNLOAD_ALL_RESOURCES_BASEURL_DESCRIPTION) - private String baseurl; + @DataField(id = "baseUrl", description = FieldConstants.DOWNLOAD_ALL_RESOURCES_BASEURL_DESCRIPTION) + private String baseUrl; @DataField(id = "overwrite", description = FieldConstants.DOWNLOAD_ALL_RESOURCES_OVERWRITE_DESCRIPTION) private Boolean overwrite; - @DataField(id = "outdir", description = FieldConstants.JOB_OUT_DIR_DESCRIPTION) - private String outdir; - public DownloadResourcesToolParams() { } - public DownloadResourcesToolParams(String baseurl, Boolean overwrite, String outdir) { - this.baseurl = baseurl; + public DownloadResourcesToolParams(String baseUrl, Boolean overwrite) { + this.baseUrl = baseUrl; this.overwrite = overwrite; - this.outdir = outdir; } @Override public String toString() { - final StringBuilder sb = new StringBuilder("DownloadResourcesToolParams{"); - sb.append("baseurl='").append(baseurl).append('\''); + final StringBuilder sb = new StringBuilder("DownloadResourcesParams{"); + sb.append("baseUrl='").append(baseUrl).append('\''); sb.append(", overwrite=").append(overwrite); - sb.append(", outdir='").append(outdir).append('\''); sb.append('}'); return sb.toString(); } - public String getBaseurl() { - return baseurl; + public String getBaseUrl() { + return baseUrl; } - public DownloadResourcesToolParams setBaseurl(String baseurl) { - this.baseurl = baseurl; + public DownloadResourcesToolParams setBaseUrl(String baseUrl) { + this.baseUrl = baseUrl; return this; } @@ -71,13 +64,4 @@ public DownloadResourcesToolParams setOverwrite(Boolean overwrite) { this.overwrite = overwrite; return this; } - - public String getOutdir() { - return outdir; - } - - public DownloadResourcesToolParams setOutdir(String outdir) { - this.outdir = outdir; - return this; - } }