diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java index 38953f5ff7f..fd8a0cebad5 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java @@ -230,7 +230,7 @@ public OpenCGAResult coverageStats(String studyIdStr, String String species = projectQueryResult.first().getOrganism().getScientificName(); String assembly = projectQueryResult.first().getOrganism().getAssembly(); String dataRelease = projectQueryResult.first().getCellbase().getDataRelease(); - String cellbaseToken = projectQueryResult.first().getCellbase().getToken(); + String cellbaseToken = projectQueryResult.first().getCellbase().getApiKey(); for (String geneName : geneNames) { @@ -451,7 +451,7 @@ public List mergeRegions(List regions, List genes, boole String species = projectQueryResult.first().getOrganism().getScientificName(); String assembly = projectQueryResult.first().getOrganism().getAssembly(); String dataRelease = projectQueryResult.first().getCellbase().getDataRelease(); - String cellbaseToken = projectQueryResult.first().getCellbase().getToken(); + String cellbaseToken = projectQueryResult.first().getCellbase().getApiKey(); CellBaseClient cellBaseClient = new CellBaseClient(species, assembly, dataRelease, cellbaseToken, projectQueryResult.first().getCellbase().toClientConfiguration()); GeneClient geneClient = cellBaseClient.getGeneClient(); diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/manager/VariantStorageManager.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/manager/VariantStorageManager.java index 48b5cf87114..22b337e9621 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/manager/VariantStorageManager.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/manager/VariantStorageManager.java @@ -1021,8 +1021,9 @@ private void setCellbaseConfiguration(VariantStorageEngine engine, String projec .get(project, new QueryOptions(INCLUDE, ProjectDBAdaptor.QueryParams.CELLBASE.key()), token) .first().getCellbase(); if (cellbase != null) { - if (StringUtils.isEmpty(cellbase.getToken()) || storageConfiguration.getCellbase() != null) { - cellbase.setToken(storageConfiguration.getCellbase().getToken()); + // To ensure that we use the project API key before using the storage API key + if (StringUtils.isEmpty(cellbase.getApiKey()) && storageConfiguration.getCellbase() != null) { + cellbase.setApiKey(storageConfiguration.getCellbase().getApiKey()); } engine.getConfiguration().setCellbase(cellbase); engine.reloadCellbaseConfiguration(); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpenCgaCompleter.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpenCgaCompleter.java index 07cb922d522..b023618b21f 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpenCgaCompleter.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpenCgaCompleter.java @@ -1,5 +1,5 @@ /* -* Copyright 2015-2023-09-01 OpenCB +* Copyright 2015-2023-09-08 OpenCB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpencgaCliOptionsParser.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpencgaCliOptionsParser.java index 4e3e7ed1c1f..93ae1e2ed26 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpencgaCliOptionsParser.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/OpencgaCliOptionsParser.java @@ -1,5 +1,5 @@ /* -* Copyright 2015-2023-09-01 OpenCB +* Copyright 2015-2023-09-08 OpenCB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OperationsVariantStorageCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OperationsVariantStorageCommandExecutor.java index 408f28841f3..78ed32b92dc 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OperationsVariantStorageCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OperationsVariantStorageCommandExecutor.java @@ -197,7 +197,7 @@ private RestResponse configureCellbase() throws Exception { putNestedIfNotEmpty(beanParams, "url",commandOptions.url, true); putNestedIfNotEmpty(beanParams, "version",commandOptions.version, true); putNestedIfNotEmpty(beanParams, "dataRelease",commandOptions.dataRelease, true); - putNestedIfNotEmpty(beanParams, "token",commandOptions.token, true); + putNestedIfNotEmpty(beanParams, "apiKey",commandOptions.apiKey, true); cellBaseConfiguration = JacksonUtils.getDefaultObjectMapper().copy() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/ProjectsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/ProjectsCommandExecutor.java index 7facd50d4d6..2ed3593e612 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/ProjectsCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/ProjectsCommandExecutor.java @@ -123,7 +123,7 @@ private RestResponse create() throws Exception { putNestedIfNotEmpty(beanParams, "cellbase.url",commandOptions.cellbaseUrl, true); putNestedIfNotEmpty(beanParams, "cellbase.version",commandOptions.cellbaseVersion, true); putNestedIfNotEmpty(beanParams, "cellbase.dataRelease",commandOptions.cellbaseDataRelease, true); - putNestedIfNotEmpty(beanParams, "cellbase.token",commandOptions.cellbaseToken, true); + putNestedIfNotEmpty(beanParams, "cellbase.apiKey",commandOptions.cellbaseApiKey, true); putNestedIfNotNull(beanParams, "attributes",commandOptions.attributes, true); projectCreateParams = JacksonUtils.getDefaultObjectMapper().copy() diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/OperationsVariantStorageCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/OperationsVariantStorageCommandOptions.java index c3c89bf4b1a..d0b8a26d019 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/OperationsVariantStorageCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/OperationsVariantStorageCommandOptions.java @@ -128,8 +128,8 @@ public class ConfigureCellbaseCommandOptions { @Parameter(names = {"--data-release"}, description = "CellBase data release version to be used. If empty, will use the active one", required = false, arity = 1) public String dataRelease; - @Parameter(names = {"--token"}, description = "CellBase token to access to the licensed/restricted data sources such as COSMIC, HGMD,...", required = false, arity = 1) - public String token; + @Parameter(names = {"--api-key"}, description = "API key to access to the licensed/restricted data sources (COSMIC, HGMD,...) and to manage quota.", required = false, arity = 1) + public String apiKey; } diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/ProjectsCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/ProjectsCommandOptions.java index 1f7a3782e45..a2eca8cb958 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/ProjectsCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/ProjectsCommandOptions.java @@ -110,8 +110,8 @@ public class CreateCommandOptions { @Parameter(names = {"--cellbase-data-release"}, description = "CellBase data release version to be used. If empty, will use the active one", required = false, arity = 1) public String cellbaseDataRelease; - @Parameter(names = {"--cellbase-token"}, description = "CellBase token to access to the licensed/restricted data sources such as COSMIC, HGMD,...", required = false, arity = 1) - public String cellbaseToken; + @Parameter(names = {"--cellbase-api-key"}, description = "API key to access to the licensed/restricted data sources (COSMIC, HGMD,...) and to manage quota.", required = false, arity = 1) + public String cellbaseApiKey; @DynamicParameter(names = {"--attributes"}, description = "The body web service attributes parameter. Use: --attributes key=value", required = false) public java.util.Map attributes = new HashMap<>(); //Dynamic parameters must be initialized; diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v2_9_0/catalog/RenameCellBaseToken2ApiKey.java b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v2_9_0/catalog/RenameCellBaseToken2ApiKey.java new file mode 100644 index 00000000000..72fe8e6499e --- /dev/null +++ b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v2_9_0/catalog/RenameCellBaseToken2ApiKey.java @@ -0,0 +1,50 @@ +package org.opencb.opencga.app.migrations.v2_9_0.catalog; + +import com.mongodb.client.model.Projections; +import com.mongodb.client.model.UpdateOneModel; +import com.mongodb.client.model.Updates; +import org.bson.Document; +import org.opencb.opencga.catalog.db.mongodb.MongoDBAdaptorFactory; +import org.opencb.opencga.catalog.migration.Migration; +import org.opencb.opencga.catalog.migration.MigrationTool; + +import java.util.List; + +import static com.mongodb.client.model.Filters.eq; + +@Migration(id = "rename_cellbase_token_2_api_key" , + description = "Rename CellBase Token to ApiKey", + version = "2.9.0", + domain = Migration.MigrationDomain.CATALOG, + language = Migration.MigrationLanguage.JAVA, + date = 20230829 +) +public class RenameCellBaseToken2ApiKey extends MigrationTool { + + @Override + protected void run() throws Exception { + + migrateCollection(MongoDBAdaptorFactory.USER_COLLECTION, + new Document("projects.id", new Document("$exists", true)), + Projections.include("_id", "projects"), + (userDocument, bulk) -> { + List projects = userDocument.getList("projects", Document.class); + for (int i = 0; i < projects.size(); i++) { + Document project = projects.get(i); + Document cellbase = project.get("cellbase", Document.class); + if (cellbase != null) { + String token = cellbase.getString("token"); + if (token != null) { + bulk.add(new UpdateOneModel<>( + eq("_id", userDocument.get("_id")), + Updates.combine( + Updates.set("projects." + i + ".cellbase.apiKey", token), + Updates.unset("projects." + i + ".cellbase.token") + ))); + } + } + } + }); + } + +} diff --git a/opencga-client/src/main/R/R/Admin-methods.R b/opencga-client/src/main/R/R/Admin-methods.R index da576e61ed5..52e55fc3918 100644 --- a/opencga-client/src/main/R/R/Admin-methods.R +++ b/opencga-client/src/main/R/R/Admin-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Alignment-methods.R b/opencga-client/src/main/R/R/Alignment-methods.R index e8d0ded651f..66dcf64a9a4 100644 --- a/opencga-client/src/main/R/R/Alignment-methods.R +++ b/opencga-client/src/main/R/R/Alignment-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/AllGenerics.R b/opencga-client/src/main/R/R/AllGenerics.R index 64aa34c799c..2b49e7247d0 100644 --- a/opencga-client/src/main/R/R/AllGenerics.R +++ b/opencga-client/src/main/R/R/AllGenerics.R @@ -1,6 +1,6 @@ # ############################################################################## ## UserClient -setGeneric("userClient", function(OpencgaR, filterId, users, user, endpointName, params=NULL, ...) +setGeneric("userClient", function(OpencgaR, users, user, filterId, endpointName, params=NULL, ...) standardGeneric("userClient")) # ############################################################################## @@ -10,37 +10,37 @@ setGeneric("projectClient", function(OpencgaR, projects, project, endpointName, # ############################################################################## ## StudyClient -setGeneric("studyClient", function(OpencgaR, variableSet, studies, members, group, study, templateId, endpointName, params=NULL, ...) +setGeneric("studyClient", function(OpencgaR, study, group, variableSet, studies, members, templateId, endpointName, params=NULL, ...) standardGeneric("studyClient")) # ############################################################################## ## FileClient -setGeneric("fileClient", function(OpencgaR, members, folder, annotationSet, files, file, endpointName, params=NULL, ...) +setGeneric("fileClient", function(OpencgaR, folder, annotationSet, file, members, files, endpointName, params=NULL, ...) standardGeneric("fileClient")) # ############################################################################## ## JobClient -setGeneric("jobClient", function(OpencgaR, job, members, jobs, endpointName, params=NULL, ...) +setGeneric("jobClient", function(OpencgaR, members, jobs, job, endpointName, params=NULL, ...) standardGeneric("jobClient")) # ############################################################################## ## SampleClient -setGeneric("sampleClient", function(OpencgaR, annotationSet, sample, samples, members, endpointName, params=NULL, ...) +setGeneric("sampleClient", function(OpencgaR, samples, members, sample, annotationSet, endpointName, params=NULL, ...) standardGeneric("sampleClient")) # ############################################################################## ## IndividualClient -setGeneric("individualClient", function(OpencgaR, individual, individuals, annotationSet, members, endpointName, params=NULL, ...) +setGeneric("individualClient", function(OpencgaR, individuals, members, individual, annotationSet, endpointName, params=NULL, ...) standardGeneric("individualClient")) # ############################################################################## ## FamilyClient -setGeneric("familyClient", function(OpencgaR, families, family, annotationSet, members, endpointName, params=NULL, ...) +setGeneric("familyClient", function(OpencgaR, family, members, families, annotationSet, endpointName, params=NULL, ...) standardGeneric("familyClient")) # ############################################################################## ## CohortClient -setGeneric("cohortClient", function(OpencgaR, annotationSet, cohorts, members, cohort, endpointName, params=NULL, ...) +setGeneric("cohortClient", function(OpencgaR, annotationSet, members, cohort, cohorts, endpointName, params=NULL, ...) standardGeneric("cohortClient")) # ############################################################################## @@ -60,7 +60,7 @@ setGeneric("variantClient", function(OpencgaR, endpointName, params=NULL, ...) # ############################################################################## ## ClinicalClient -setGeneric("clinicalClient", function(OpencgaR, interpretation, members, interpretations, clinicalAnalysis, clinicalAnalyses, endpointName, params=NULL, ...) +setGeneric("clinicalClient", function(OpencgaR, clinicalAnalyses, interpretation, clinicalAnalysis, interpretations, members, endpointName, params=NULL, ...) standardGeneric("clinicalClient")) # ############################################################################## diff --git a/opencga-client/src/main/R/R/Clinical-methods.R b/opencga-client/src/main/R/R/Clinical-methods.R index ae64c192aeb..36200235c2a 100644 --- a/opencga-client/src/main/R/R/Clinical-methods.R +++ b/opencga-client/src/main/R/R/Clinical-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -58,7 +58,7 @@ #' [*]: Required parameter #' @export -setMethod("clinicalClient", "OpencgaR", function(OpencgaR, interpretation, members, interpretations, clinicalAnalysis, clinicalAnalyses, endpointName, params=NULL, ...) { +setMethod("clinicalClient", "OpencgaR", function(OpencgaR, clinicalAnalyses, interpretation, clinicalAnalysis, interpretations, members, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/analysis/clinical/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Cohort-methods.R b/opencga-client/src/main/R/R/Cohort-methods.R index 3dbf84870e5..3ae1d7734b5 100644 --- a/opencga-client/src/main/R/R/Cohort-methods.R +++ b/opencga-client/src/main/R/R/Cohort-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ #' [*]: Required parameter #' @export -setMethod("cohortClient", "OpencgaR", function(OpencgaR, annotationSet, cohorts, members, cohort, endpointName, params=NULL, ...) { +setMethod("cohortClient", "OpencgaR", function(OpencgaR, annotationSet, members, cohort, cohorts, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/cohorts/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Family-methods.R b/opencga-client/src/main/R/R/Family-methods.R index c5d4cbc0485..ffeb618a259 100644 --- a/opencga-client/src/main/R/R/Family-methods.R +++ b/opencga-client/src/main/R/R/Family-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -38,7 +38,7 @@ #' [*]: Required parameter #' @export -setMethod("familyClient", "OpencgaR", function(OpencgaR, families, family, annotationSet, members, endpointName, params=NULL, ...) { +setMethod("familyClient", "OpencgaR", function(OpencgaR, family, members, families, annotationSet, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/families/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/File-methods.R b/opencga-client/src/main/R/R/File-methods.R index 3145654d92d..5db25da7799 100644 --- a/opencga-client/src/main/R/R/File-methods.R +++ b/opencga-client/src/main/R/R/File-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -54,7 +54,7 @@ #' [*]: Required parameter #' @export -setMethod("fileClient", "OpencgaR", function(OpencgaR, members, folder, annotationSet, files, file, endpointName, params=NULL, ...) { +setMethod("fileClient", "OpencgaR", function(OpencgaR, folder, annotationSet, file, members, files, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/files/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/GA4GH-methods.R b/opencga-client/src/main/R/R/GA4GH-methods.R index 7ec25d1cb31..8aae23ad4a6 100644 --- a/opencga-client/src/main/R/R/GA4GH-methods.R +++ b/opencga-client/src/main/R/R/GA4GH-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Individual-methods.R b/opencga-client/src/main/R/R/Individual-methods.R index fa208ff5bf2..35b01f1ce71 100644 --- a/opencga-client/src/main/R/R/Individual-methods.R +++ b/opencga-client/src/main/R/R/Individual-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ #' [*]: Required parameter #' @export -setMethod("individualClient", "OpencgaR", function(OpencgaR, individual, individuals, annotationSet, members, endpointName, params=NULL, ...) { +setMethod("individualClient", "OpencgaR", function(OpencgaR, individuals, members, individual, annotationSet, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/individuals/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Job-methods.R b/opencga-client/src/main/R/R/Job-methods.R index 00c06ed1483..d61eb46c702 100644 --- a/opencga-client/src/main/R/R/Job-methods.R +++ b/opencga-client/src/main/R/R/Job-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -40,7 +40,7 @@ #' [*]: Required parameter #' @export -setMethod("jobClient", "OpencgaR", function(OpencgaR, job, members, jobs, endpointName, params=NULL, ...) { +setMethod("jobClient", "OpencgaR", function(OpencgaR, members, jobs, job, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/jobs/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Meta-methods.R b/opencga-client/src/main/R/R/Meta-methods.R index 360a9dacb50..100a6e11e6f 100644 --- a/opencga-client/src/main/R/R/Meta-methods.R +++ b/opencga-client/src/main/R/R/Meta-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Operation-methods.R b/opencga-client/src/main/R/R/Operation-methods.R index f95d93bc801..73e41e1eefe 100644 --- a/opencga-client/src/main/R/R/Operation-methods.R +++ b/opencga-client/src/main/R/R/Operation-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Panel-methods.R b/opencga-client/src/main/R/R/Panel-methods.R index fe01d294f0b..bf61ce54f10 100644 --- a/opencga-client/src/main/R/R/Panel-methods.R +++ b/opencga-client/src/main/R/R/Panel-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Project-methods.R b/opencga-client/src/main/R/R/Project-methods.R index d9cb522a4e2..3911d6f5f9a 100644 --- a/opencga-client/src/main/R/R/Project-methods.R +++ b/opencga-client/src/main/R/R/Project-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Sample-methods.R b/opencga-client/src/main/R/R/Sample-methods.R index 8a8d00d9796..44d4e5e58bb 100644 --- a/opencga-client/src/main/R/R/Sample-methods.R +++ b/opencga-client/src/main/R/R/Sample-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ #' [*]: Required parameter #' @export -setMethod("sampleClient", "OpencgaR", function(OpencgaR, annotationSet, sample, samples, members, endpointName, params=NULL, ...) { +setMethod("sampleClient", "OpencgaR", function(OpencgaR, samples, members, sample, annotationSet, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/samples/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Study-methods.R b/opencga-client/src/main/R/R/Study-methods.R index 84227b71b68..ab51f6a4a8d 100644 --- a/opencga-client/src/main/R/R/Study-methods.R +++ b/opencga-client/src/main/R/R/Study-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -46,7 +46,7 @@ #' [*]: Required parameter #' @export -setMethod("studyClient", "OpencgaR", function(OpencgaR, variableSet, studies, members, group, study, templateId, endpointName, params=NULL, ...) { +setMethod("studyClient", "OpencgaR", function(OpencgaR, study, group, variableSet, studies, members, templateId, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/studies/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/User-methods.R b/opencga-client/src/main/R/R/User-methods.R index 51b6157fe7a..671c70ca6c9 100644 --- a/opencga-client/src/main/R/R/User-methods.R +++ b/opencga-client/src/main/R/R/User-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -38,7 +38,7 @@ #' [*]: Required parameter #' @export -setMethod("userClient", "OpencgaR", function(OpencgaR, filterId, users, user, endpointName, params=NULL, ...) { +setMethod("userClient", "OpencgaR", function(OpencgaR, users, user, filterId, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/users/login: diff --git a/opencga-client/src/main/R/R/Variant-methods.R b/opencga-client/src/main/R/R/Variant-methods.R index 6d17848726b..911cd8ecc94 100644 --- a/opencga-client/src/main/R/R/Variant-methods.R +++ b/opencga-client/src/main/R/R/Variant-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2023-09-01 +# Autogenerated on: 2023-09-08 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. 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 df137812b2f..b4b8cc001d6 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 @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java index 759e68f1b90..ae7aef83174 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java @@ -40,7 +40,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java index 22eeeca0ccd..912ef505958 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java @@ -51,7 +51,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java index 4afa30f7993..88cc7b62b23 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java @@ -37,7 +37,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java index ec146dbae49..61f2af635da 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java @@ -35,7 +35,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java index cbd554fe8d4..6280a7026e0 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java index fc31ad2bec2..ce6df1ebb2e 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java @@ -43,7 +43,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java index b0afdac763a..28170cb2746 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java @@ -27,7 +27,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java index 27a9af45ed5..eb24455c52a 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java index f880ed1d600..68934888520 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java @@ -37,7 +37,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java index 15ca508dc41..b68b929186c 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java @@ -28,7 +28,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java index fb3f13b0077..395b4593856 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java @@ -32,7 +32,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java index 5399ebea102..f2874078762 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java index f5cc56d0d9c..6216f78b94b 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java @@ -45,7 +45,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java index e6c291036f5..93c49bdf998 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java index 0e88f0a112c..c96321b199a 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java @@ -62,7 +62,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java index e0e2f076484..4b870042648 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java @@ -50,7 +50,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2023-09-01 +* Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Admin.js b/opencga-client/src/main/javascript/Admin.js index d372e15a01c..5edf0a466c6 100644 --- a/opencga-client/src/main/javascript/Admin.js +++ b/opencga-client/src/main/javascript/Admin.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Alignment.js b/opencga-client/src/main/javascript/Alignment.js index 7a1e4809128..874adaf6b67 100644 --- a/opencga-client/src/main/javascript/Alignment.js +++ b/opencga-client/src/main/javascript/Alignment.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/ClinicalAnalysis.js b/opencga-client/src/main/javascript/ClinicalAnalysis.js index 1054e70f292..7b04cf20cdd 100644 --- a/opencga-client/src/main/javascript/ClinicalAnalysis.js +++ b/opencga-client/src/main/javascript/ClinicalAnalysis.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Cohort.js b/opencga-client/src/main/javascript/Cohort.js index 11d9d5906f6..139868db04d 100644 --- a/opencga-client/src/main/javascript/Cohort.js +++ b/opencga-client/src/main/javascript/Cohort.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/DiseasePanel.js b/opencga-client/src/main/javascript/DiseasePanel.js index 1c427e0629f..2f8e596a9a9 100644 --- a/opencga-client/src/main/javascript/DiseasePanel.js +++ b/opencga-client/src/main/javascript/DiseasePanel.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Family.js b/opencga-client/src/main/javascript/Family.js index 90d31e15443..ffd436567e0 100644 --- a/opencga-client/src/main/javascript/Family.js +++ b/opencga-client/src/main/javascript/Family.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/File.js b/opencga-client/src/main/javascript/File.js index d5678f46153..a2455a0953f 100644 --- a/opencga-client/src/main/javascript/File.js +++ b/opencga-client/src/main/javascript/File.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/GA4GH.js b/opencga-client/src/main/javascript/GA4GH.js index 52d93be35f7..f5e18645184 100644 --- a/opencga-client/src/main/javascript/GA4GH.js +++ b/opencga-client/src/main/javascript/GA4GH.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Individual.js b/opencga-client/src/main/javascript/Individual.js index b66f0fc8aee..da0324012b5 100644 --- a/opencga-client/src/main/javascript/Individual.js +++ b/opencga-client/src/main/javascript/Individual.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Job.js b/opencga-client/src/main/javascript/Job.js index 8128ce9db7d..1125c50f9f1 100644 --- a/opencga-client/src/main/javascript/Job.js +++ b/opencga-client/src/main/javascript/Job.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Meta.js b/opencga-client/src/main/javascript/Meta.js index 96fcc5b6d68..ca2c12b459b 100644 --- a/opencga-client/src/main/javascript/Meta.js +++ b/opencga-client/src/main/javascript/Meta.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Project.js b/opencga-client/src/main/javascript/Project.js index 8c4e02f956e..9ed80c76552 100644 --- a/opencga-client/src/main/javascript/Project.js +++ b/opencga-client/src/main/javascript/Project.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Sample.js b/opencga-client/src/main/javascript/Sample.js index 74c71a5206f..ebe4b047ade 100644 --- a/opencga-client/src/main/javascript/Sample.js +++ b/opencga-client/src/main/javascript/Sample.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Study.js b/opencga-client/src/main/javascript/Study.js index 54186dac4ec..09159e5bc29 100644 --- a/opencga-client/src/main/javascript/Study.js +++ b/opencga-client/src/main/javascript/Study.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/User.js b/opencga-client/src/main/javascript/User.js index ac91b91b891..bd11746e1de 100644 --- a/opencga-client/src/main/javascript/User.js +++ b/opencga-client/src/main/javascript/User.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Variant.js b/opencga-client/src/main/javascript/Variant.js index 27eb9763570..34884a86bb7 100644 --- a/opencga-client/src/main/javascript/Variant.js +++ b/opencga-client/src/main/javascript/Variant.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/VariantOperation.js b/opencga-client/src/main/javascript/VariantOperation.js index 192a736a775..2ce54e16534 100644 --- a/opencga-client/src/main/javascript/VariantOperation.js +++ b/opencga-client/src/main/javascript/VariantOperation.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2023-09-01 + * Autogenerated on: 2023-09-08 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. 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 2a5439b0d00..53fdc052390 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 @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py index 012e5296968..091948e5f53 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py index 6bd79233875..83ab4dbb7da 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py index 4b1be07e92a..445f4a66826 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py index a6fe0e432a5..fdf80361f55 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py index 1d41d4a8488..6642396fb41 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py index e3a5a9b8988..45719c4b213 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py index 0b077f4a7c6..a7ec7e99b6c 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py index e8213458d7b..044a326dd67 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py index fd4ac0a9386..eeda7834cd9 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py index d9f841bb69d..bee9670a694 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py index b5eac020645..c3b4c0a9e38 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py index dbd8d313d8a..7cf520ad6c0 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py index 82c241c0eb2..09a0d3d5e96 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py index e7de326420c..c05e00b0e30 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py index 9e447940a11..7a2081d3bbb 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py index 87b0d72a7d2..775c3130a2b 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2023-09-01 + Autogenerated on: 2023-09-08 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java index 10cd2f3cdf2..ebcfa07153c 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java @@ -78,7 +78,7 @@ public class ParamConstants { public static final String CELLBASE_URL = "https://ws.zettagenomics.com/cellbase"; public static final String CELLBASE_VERSION = "v5.1"; public static final String CELLBASE_DATA_RELEASE = "2"; - public static final String CELLBASE_TOKEN = ""; + public static final String CELLBASE_APIKEY = ""; public static final String POP_FREQ_1000G_CB_V4 = "1kG_phase3"; public static final String POP_FREQ_1000G_CB_V5 = "1000G"; diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/cellbase/CellBaseValidator.java b/opencga-core/src/main/java/org/opencb/opencga/core/cellbase/CellBaseValidator.java index 467dabf7b75..edf5e3e50bc 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/cellbase/CellBaseValidator.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/cellbase/CellBaseValidator.java @@ -4,14 +4,13 @@ import org.apache.commons.lang3.StringUtils; import org.opencb.biodata.models.variant.avro.VariantAnnotation; import org.opencb.cellbase.client.rest.CellBaseClient; +import org.opencb.cellbase.core.api.key.ApiKeyManager; import org.opencb.cellbase.core.config.SpeciesConfiguration; import org.opencb.cellbase.core.config.SpeciesProperties; import org.opencb.cellbase.core.models.DataRelease; import org.opencb.cellbase.core.result.CellBaseDataResponse; -import org.opencb.cellbase.core.token.DataAccessTokenManager; -import org.opencb.cellbase.core.token.DataAccessTokenSources; import org.opencb.commons.datastore.core.QueryOptions; -import org.opencb.opencga.core.common.VersionUtils; +import org.opencb.commons.utils.VersionUtils; import org.opencb.opencga.core.config.storage.CellBaseConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,7 +49,7 @@ private CellBaseClient newCellBaseClient(CellBaseConfiguration cellBaseConfigura toCellBaseSpeciesName(species), assembly, cellBaseConfiguration.getDataRelease(), - cellBaseConfiguration.getToken(), + cellBaseConfiguration.getApiKey(), cellBaseConfiguration.toClientConfiguration()); } @@ -74,13 +73,13 @@ public String getDataRelease() { return cellBaseClient.getDataRelease(); } - public String getToken() { - return cellBaseClient.getToken(); + public String getApiKey() { + return cellBaseClient.getApiKey(); } - public DataAccessTokenSources getTokenSources() { - DataAccessTokenManager tokenManager = new DataAccessTokenManager(); - return tokenManager.decode(cellBaseClient.getToken()); + public List getApiKeyDataSources() { + ApiKeyManager apiKeyManager = new ApiKeyManager(); + return new ArrayList<>(apiKeyManager.getValidSources(cellBaseClient.getApiKey())); } public String getURL() { @@ -96,7 +95,7 @@ public CellBaseClient getCellBaseClient() { } public CellBaseConfiguration getCellBaseConfiguration() { - return new CellBaseConfiguration(getURL(), getVersion(), getDataRelease(), getToken()); + return new CellBaseConfiguration(getURL(), getVersion(), getDataRelease(), getApiKey()); } public String getDefaultDataRelease() throws IOException { @@ -194,34 +193,34 @@ private CellBaseConfiguration validate(boolean autoComplete) throws IOException } } } - String token = getToken(); - if (StringUtils.isEmpty(token)) { - cellBaseConfiguration.setToken(null); + String apiKey = getApiKey(); + if (StringUtils.isEmpty(apiKey)) { + cellBaseConfiguration.setApiKey(null); } else { // Check it's supported - if (!supportsToken(serverVersion)) { - throw new IllegalArgumentException("Token not supported for cellbase " + if (!supportsApiKey(serverVersion)) { + throw new IllegalArgumentException("API key not supported for cellbase " + "url: '" + getURL() + "'" + ", version: '" + inputVersion + "'"); } - // Check it's an actual token - DataAccessTokenManager tokenManager = new DataAccessTokenManager(); + // Check it's an actual API key + ApiKeyManager apiKeyManager = new ApiKeyManager(); try { - tokenManager.decode(token); + apiKeyManager.decode(apiKey); } catch (JwtException e) { - throw new IllegalArgumentException("Malformed token for cellbase " + throw new IllegalArgumentException("Malformed API key for cellbase " + "url: '" + getURL() + "'" + ", version: '" + inputVersion + "', species: '" + getSpecies() + "', assembly: '" + getAssembly() + "'"); } - // Check it's a valid token + // Check it's a valid API key CellBaseDataResponse response = cellBaseClient.getVariantClient() .getAnnotationByVariantIds(Collections.singletonList("1:1:N:C"), new QueryOptions(), true); if (response.firstResult() == null) { - throw new IllegalArgumentException("Invalid token for cellbase " + throw new IllegalArgumentException("Invalid API key for cellbase " + "url: '" + getURL() + "'" + ", version: '" + inputVersion + "', species: '" + getSpecies() @@ -271,8 +270,8 @@ public static boolean supportsDataReleaseActiveByDefaultIn(String serverVersion) return VersionUtils.isMinVersion("5.5.0", serverVersion, true); } - public static boolean supportsToken(String serverVersion) { - // Tokens support starts at version 5.4.0 + public static boolean supportsApiKey(String serverVersion) { + // API keys support starts at version 5.4.0 return VersionUtils.isMinVersion("5.4.0", serverVersion); } @@ -326,7 +325,7 @@ public String toString() { + "species '" + getSpecies() + "', " + "assembly '" + getAssembly() + "', " + "dataRelease '" + getDataRelease() + "', " - + "token '" + getToken() + "'"; + + "apiKey '" + getApiKey() + "'"; } } diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/common/VersionUtils.java b/opencga-core/src/main/java/org/opencb/opencga/core/common/VersionUtils.java deleted file mode 100644 index 4e32c6ada32..00000000000 --- a/opencga-core/src/main/java/org/opencb/opencga/core/common/VersionUtils.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.opencb.opencga.core.common; - -import org.apache.commons.lang3.StringUtils; - -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -public class VersionUtils { - - public static List order(List versions) { - return versions.stream().map(Version::new).sorted().map(Version::toString).collect(Collectors.toList()); - } - - public static boolean isMinVersion(String minVersion, String version) { - return isMinVersion(minVersion, version, false); - } - - public static boolean isMinVersion(String minVersion, String version, boolean ignorePreReleaseVersioning) { - return new Version(minVersion).compareTo(new Version(version), ignorePreReleaseVersioning) <= 0; - } - - public static class Version implements Comparable { - - private final int major; - private final int minor; - private final int patch; - private final int repatch; - private final String other; - - public static final Comparator COMPARATOR = Comparator - .comparingInt(Version::getMajor) - .thenComparingInt(Version::getMinor) - .thenComparingInt(Version::getPatch) - .thenComparingInt(Version::getRepatch) - .thenComparing((o1, o2) -> { - if (o1.other.equals(o2.other)) { - return 0; - } - if (o1.other.isEmpty()) { - return +1; - } - if (o2.other.isEmpty()) { - return -1; - } - if (o1.other.equals("-SNAPSHOT")) { - return -1; - } - if (o2.other.equals("-SNAPSHOT")) { - return +1; - } - return o1.other.compareTo(o2.other); - }); - - public static final Comparator COMPARATOR_NO_PR = Comparator - .comparingInt(Version::getMajor) - .thenComparingInt(Version::getMinor) - .thenComparingInt(Version::getPatch) - .thenComparingInt(Version::getRepatch); - - public Version(String version) { - String[] split = StringUtils.split(version, ".", 4); - major = Integer.parseInt(split[0]); - minor = Integer.parseInt(split[1]); - if (split.length == 4) { - patch = Integer.parseInt(split[2]); - String last = split[3]; - String[] split2 = StringUtils.split(last, "-+", 3); - repatch = Integer.parseInt(split2[0]); - other = last.substring(split2[0].length()); - } else { - String last = split[2]; - String[] split2 = StringUtils.split(last, "-+", 2); - patch = Integer.parseInt(split2[0]); - repatch = 0; - other = last.substring(split2[0].length()); - } - } - - @Override - public String toString() { - if (repatch > 0) { - return major + "." + minor + "." + patch + "." + repatch + other; - } else { - return major + "." + minor + "." + patch + other; - } - } - - @Override - public int compareTo(Version o) { - return COMPARATOR.compare(this, o); - } - - public int compareTo(Version o, boolean ignorePreReleaseVersioning) { - if (ignorePreReleaseVersioning) { - return COMPARATOR_NO_PR.compare(this, o); - } else { - return COMPARATOR.compare(this, o); - } - } - - public int getMajor() { - return major; - } - - public int getMinor() { - return minor; - } - - public int getPatch() { - return patch; - } - - public int getRepatch() { - return repatch; - } - - public String getOther() { - return other; - } - } - -} diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/config/storage/CellBaseConfiguration.java b/opencga-core/src/main/java/org/opencb/opencga/core/config/storage/CellBaseConfiguration.java index 9a392c88168..2ef6a77cca4 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/config/storage/CellBaseConfiguration.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/config/storage/CellBaseConfiguration.java @@ -42,8 +42,8 @@ public class CellBaseConfiguration { @DataField(id = "dataRelease", description = "CellBase data release version to be used. If empty, will use the active one") private String dataRelease; - @DataField(id = "token", description = "CellBase token to access to the licensed/restricted data sources such as COSMIC, HGMD,...") - private String token; + @DataField(id = "apiKey", description = "API key to access to the licensed/restricted data sources (COSMIC, HGMD,...) and to manage quota.") + private String apiKey; public CellBaseConfiguration() { this(ParamConstants.CELLBASE_URL, ParamConstants.CELLBASE_VERSION); @@ -54,11 +54,11 @@ public CellBaseConfiguration(String url, String version) { this.version = version; } - public CellBaseConfiguration(String url, String version, String dataRelease, String token) { + public CellBaseConfiguration(String url, String version, String dataRelease, String apiKey) { this.url = url; this.version = version; this.dataRelease = dataRelease; - this.token = token; + this.apiKey = apiKey; } @Override @@ -67,7 +67,7 @@ public String toString() { sb.append("url='").append(url).append('\''); sb.append(", version='").append(version).append('\''); sb.append(", dataRelease='").append(dataRelease).append('\''); - sb.append(", token='").append(token).append('\''); + sb.append(", apiKey='").append(apiKey).append('\''); sb.append('}'); return sb.toString(); } @@ -99,12 +99,12 @@ public CellBaseConfiguration setDataRelease(String dataRelease) { return this; } - public String getToken() { - return token; + public String getApiKey() { + return apiKey; } - public CellBaseConfiguration setToken(String token) { - this.token = token; + public CellBaseConfiguration setApiKey(String apiKey) { + this.apiKey = apiKey; return this; } diff --git a/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java b/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java index 36026700237..ada81158f44 100644 --- a/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java +++ b/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java @@ -74,43 +74,42 @@ public void testNoActiveReleases() throws IOException { } @Test - public void testToken() throws IOException { - String token = System.getenv("CELLBASE_HGMD_TOKEN"); - Assume.assumeTrue(StringUtils.isNotEmpty(token)); - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, token), "hsapiens", "grch38", true); - Assert.assertNotNull(validated.getToken()); + public void testApiKey() throws IOException { + String apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + Assert.assertNotNull(validated.getApiKey()); } @Test - public void testTokenNotSupported() throws IOException { - String token = System.getenv("CELLBASE_HGMD_TOKEN"); - Assume.assumeTrue(StringUtils.isNotEmpty(token)); - thrown.expectMessage("Token not supported"); - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, token), "hsapiens", "grch38", true); - Assert.assertNotNull(validated.getToken()); + public void testApiKeyNotSupported() throws IOException { + String apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); + thrown.expectMessage("API key not supported"); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, apiKey), "hsapiens", "grch38", true); + Assert.assertNotNull(validated.getApiKey()); } @Test - public void testTokenEmpty() throws IOException { - String token = ""; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, token), "hsapiens", "grch38", true); - Assert.assertNull(validated.getToken()); + public void testApiKeyEmpty() throws IOException { + String apiKey = ""; + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, apiKey), "hsapiens", "grch38", true); + Assert.assertNull(validated.getApiKey()); } @Test - public void testMalformedToken() throws IOException { - thrown.expectMessage("Malformed token for cellbase"); - String token = "MALFORMED_TOKEN"; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, token), "hsapiens", "grch38", true); - Assert.assertNotNull(validated.getToken()); + public void testMalformedApiKey() throws IOException { + thrown.expectMessage("Malformed API key for cellbase"); + String apiKey = "MALFORMED_API_KEY"; + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + Assert.assertNotNull(validated.getApiKey()); } @Test - public void testUnsignedToken() throws IOException { - thrown.expectMessage("Invalid token for cellbase"); - String token = "eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImhnbWQiOjkyMjMzNzIwMzY4NTQ3NzU4MDd9LCJ2ZXJzaW9uIjoiMS4wIiwic3ViIjoiWkVUVEEiLCJpYXQiOjE2OTMyMTY5MDd9.invalidsignature"; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, token), "hsapiens", "grch38", true); - Assert.assertNotNull(validated.getToken()); + public void testUnsignedApiKey() throws IOException { + thrown.expectMessage("Invalid API key for cellbase"); + String apiKey = "eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImhnbWQiOjkyMjMzNzIwMzY4NTQ3NzU4MDd9LCJ2ZXJzaW9uIjoiMS4wIiwic3ViIjoiWkVUVEEiLCJpYXQiOjE2OTMyMTY5MDd9.invalidsignature"; + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + Assert.assertNotNull(validated.getApiKey()); } - } \ No newline at end of file diff --git a/opencga-core/src/test/java/org/opencb/opencga/core/common/VersionUtilsTest.java b/opencga-core/src/test/java/org/opencb/opencga/core/common/VersionUtilsTest.java deleted file mode 100644 index a6b0dce858f..00000000000 --- a/opencga-core/src/test/java/org/opencb/opencga/core/common/VersionUtilsTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.opencb.opencga.core.common; - -import org.junit.Assert; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.opencb.opencga.core.testclassification.duration.ShortTests; - -@Category(ShortTests.class) -public class VersionUtilsTest { - public static String getComparation(String minVersion, String version) { - int c = new VersionUtils.Version(minVersion).compareTo(new VersionUtils.Version(version)); - String comp; - if (c == 0) { - comp = "="; - } else if (c < 0) { - comp = "<"; - } else { - comp = ">"; - } - System.out.println(minVersion + "\t" + comp + "\t" + version); - return comp; - } - - @Test - public void testOrder() { - Assert.assertEquals("<", getComparation("5.2.7", "5.2.8")); - Assert.assertEquals("=", getComparation("5.2.7", "5.2.7")); - Assert.assertEquals(">", getComparation("5.2.7.1", "5.2.7.1-alpha")); - Assert.assertEquals(">", getComparation("5.2.7", "5.2.7-SNAPSHOT")); - Assert.assertEquals("<", getComparation("5.2.7-alpha", "5.2.7")); - Assert.assertEquals("<", getComparation("5.2.7-alpha", "5.2.7-beta")); - Assert.assertEquals(">", getComparation("5.2.7", "5.2.6")); - Assert.assertEquals("=", getComparation("5.2.7", "5.2.7.0")); - } -} \ No newline at end of file diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/VariantStorageEngine.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/VariantStorageEngine.java index c3c27c26c35..a4f560e49f2 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/VariantStorageEngine.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/VariantStorageEngine.java @@ -1117,7 +1117,7 @@ public CellBaseUtils getCellBaseUtils() throws StorageEngineException { } species = toCellBaseSpeciesName(species); cellBaseUtils = new CellBaseUtils(new CellBaseClient(species, assembly, configuration.getCellbase().getDataRelease(), - configuration.getCellbase().getToken(), clientConfiguration)); + configuration.getCellbase().getApiKey(), clientConfiguration)); } return cellBaseUtils; } diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/AbstractCellBaseVariantAnnotator.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/AbstractCellBaseVariantAnnotator.java index 320c909c33a..da8d44b05b5 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/AbstractCellBaseVariantAnnotator.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/AbstractCellBaseVariantAnnotator.java @@ -56,7 +56,7 @@ public abstract class AbstractCellBaseVariantAnnotator extends VariantAnnotator protected final String assembly; protected final String cellbaseVersion; protected final String cellbaseDataRelease; - protected final String cellbaseToken; + protected final String cellbaseApiKey; protected final QueryOptions queryOptions; protected final boolean supportImpreciseVariants; protected final boolean supportStarAlternate; @@ -72,7 +72,7 @@ public AbstractCellBaseVariantAnnotator(StorageConfiguration storageConfiguratio assembly = projectMetadata.getAssembly(); cellbaseVersion = storageConfiguration.getCellbase().getVersion(); cellbaseDataRelease = storageConfiguration.getCellbase().getDataRelease(); - cellbaseToken = storageConfiguration.getCellbase().getToken(); + cellbaseApiKey = storageConfiguration.getCellbase().getApiKey(); queryOptions = new QueryOptions(); if (StringUtils.isNotEmpty(params.getString(VariantStorageOptions.ANNOTATOR_CELLBASE_INCLUDE.key()))) { diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/CellBaseRestVariantAnnotator.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/CellBaseRestVariantAnnotator.java index 889cba2f42a..a589a21e1a4 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/CellBaseRestVariantAnnotator.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/annotators/CellBaseRestVariantAnnotator.java @@ -67,7 +67,7 @@ public CellBaseRestVariantAnnotator(StorageConfiguration storageConfiguration, P VariantStorageOptions.ANNOTATION_TIMEOUT.defaultValue()); clientConfiguration.getRest().setTimeout(timeoutMillis); - cellBaseClient = new CellBaseClient(species, assembly, cellbaseDataRelease, cellbaseToken, clientConfiguration); + cellBaseClient = new CellBaseClient(species, assembly, cellbaseDataRelease, cellbaseApiKey, clientConfiguration); cellBaseUtils = new CellBaseUtils(cellBaseClient); logger.info("Annotating with Cellbase REST. {}", cellBaseUtils); @@ -113,8 +113,8 @@ public ProjectMetadata.VariantAnnotationMetadata getVariantAnnotationMetadata() + getDebugInfo("/meta/" + species + "/dataReleases") + ". "); } List privateSources; - if (StringUtils.isNotEmpty(cellBaseUtils.getToken())) { - privateSources = new ArrayList<>(cellBaseUtils.getTokenSources().getSources().keySet()); + if (StringUtils.isNotEmpty(cellBaseUtils.getApiKey())) { + privateSources = cellBaseUtils.getApiKeyDataSources(); } else { privateSources = new ArrayList<>(); } diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java index 1f679ace47e..93cb92e8899 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java @@ -21,7 +21,7 @@ import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.Query; import org.opencb.commons.datastore.core.QueryOptions; -import org.opencb.opencga.core.common.VersionUtils; +import org.opencb.commons.utils.VersionUtils; import org.opencb.opencga.core.testclassification.duration.MediumTests; import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException; import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam; @@ -255,10 +255,10 @@ public void testGetTranscriptFlags() throws IOException { } @Test - public void testAnnotationWithHGMDToken() throws IOException { - Assume.assumeTrue(cellBaseUtils.isMinVersion("5.3.0")); - Assume.assumeThat(assembly, CoreMatchers.equalTo("grch37")); - String hgmdToken = System.getenv("CELLBASE_HGMD_TOKEN"); + public void testAnnotationWithHGMDApiKey() throws IOException { + Assume.assumeTrue(cellBaseUtils.isMinVersion("5.4.0")); + Assume.assumeThat(assembly, CoreMatchers.equalTo("grch38")); + String hgmdToken = System.getenv("CELLBASE_HGMD_APIKEY"); Assume.assumeTrue(StringUtils.isNotEmpty(hgmdToken)); cellBaseClient = new CellBaseClient("hsapiens", assembly, dataRelease, hgmdToken, @@ -271,14 +271,14 @@ public void testAnnotationWithHGMDToken() throws IOException { .getAnnotationByVariantIds(Collections.singletonList("10:113588287:G:A"), queryOptions); VariantAnnotation variantAnnotation = v.firstResult(); assertEquals(2, variantAnnotation.getTraitAssociation().size()); - assertEquals("clinvar", variantAnnotation.getTraitAssociation().get(0).getSource().getName()); - assertEquals("hgmd", variantAnnotation.getTraitAssociation().get(1).getSource().getName()); + assertTrue(variantAnnotation.getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); + assertTrue(variantAnnotation.getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); } @Test - public void testAnnotationWithoutHGMDToken() throws IOException { - Assume.assumeTrue(cellBaseUtils.isMinVersion("5.3.0")); - Assume.assumeThat(assembly, CoreMatchers.equalTo("grch37")); + public void testAnnotationWithoutHGMDAPiKey() throws IOException { + Assume.assumeTrue(cellBaseUtils.isMinVersion("5.4.0")); + Assume.assumeThat(assembly, CoreMatchers.equalTo("grch38")); cellBaseClient = new CellBaseClient("hsapiens", assembly, dataRelease, "", new ClientConfiguration().setVersion(version) diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByTokenTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java similarity index 77% rename from opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByTokenTest.java rename to opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java index 0faf42d6cb7..02ae9aded18 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByTokenTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java @@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals; import static org.opencb.opencga.storage.core.variant.VariantStorageOptions.ANNOTATOR_CELLBASE_INCLUDE; -public class VariantAnnotatorByTokenTest { +public class VariantAnnotatorByApiKeyTest { private StorageConfiguration storageConfiguration; @@ -34,21 +34,18 @@ public void setUp() throws Exception { storageConfiguration = StorageConfiguration.load(StorageEngine.class.getClassLoader().getResourceAsStream("storage-configuration.yml"), "yml"); String url = "https://uk.ws.zettagenomics.com/cellbase/"; storageConfiguration.getCellbase().setUrl(url); - storageConfiguration.getCellbase().setDataRelease("1"); - storageConfiguration.getCellbase().setVersion("v5.3"); - storageConfiguration.getCellbase().setToken(null); + storageConfiguration.getCellbase().setDataRelease("3"); + storageConfiguration.getCellbase().setVersion("v5.4"); + storageConfiguration.getCellbase().setApiKey(null); CellBaseUtils cellBaseUtils = new CellBaseUtils(new CellBaseClient(storageConfiguration.getCellbase().toClientConfiguration())); - try { - Assume.assumeTrue(cellBaseUtils.isMinVersion("5.3.0")); - } catch (RuntimeException e) { - Assume.assumeNoException("Cellbase '" + url + "' not available", e); - } + Assume.assumeTrue(cellBaseUtils.isMinVersion("v5.4")); + + projectMetadata = new ProjectMetadata("hsapiens", "grch38", "3", 1, null, null, null); } @Test - public void testNoToken() throws Exception { - projectMetadata = new ProjectMetadata("hsapiens", "grch37", "1", 1, null, null, null); + public void testNoApiKey() throws Exception { ObjectMap options = new ObjectMap(VariantStorageOptions.ANNOTATOR.key(), "cellbase"); CellBaseRestVariantAnnotator annotator = new CellBaseRestVariantAnnotator(storageConfiguration, projectMetadata, options); @@ -61,12 +58,12 @@ public void testNoToken() throws Exception { } @Test - public void testCOSMICToken() throws Exception { - String cosmicToken = System.getenv("CELLBASE_COSMIC_TOKEN"); - Assume.assumeTrue(StringUtils.isNotEmpty(cosmicToken)); + public void testCOSMICApiKey() throws Exception { + String apiKey = System.getenv("CELLBASE_COSMIC_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); + + storageConfiguration.getCellbase().setApiKey(apiKey); - storageConfiguration.getCellbase().setToken(cosmicToken); - projectMetadata = new ProjectMetadata("hsapiens", "grch37", "1", 1, null, null, null); ObjectMap options = new ObjectMap(VariantStorageOptions.ANNOTATOR.key(), "cellbase"); CellBaseRestVariantAnnotator annotator = new CellBaseRestVariantAnnotator(storageConfiguration, projectMetadata, options); assertEquals(Collections.singletonList("cosmic"), annotator.getVariantAnnotationMetadata().getPrivateSources()); @@ -80,12 +77,12 @@ public void testCOSMICToken() throws Exception { } @Test - public void testHGMDToken() throws Exception { - String hgmdToken = System.getenv("CELLBASE_HGMD_TOKEN"); - Assume.assumeTrue(StringUtils.isNotEmpty(hgmdToken)); + public void testHGMDApiKey() throws Exception { + String apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); + + storageConfiguration.getCellbase().setApiKey(apiKey); - storageConfiguration.getCellbase().setToken(hgmdToken); - projectMetadata = new ProjectMetadata("hsapiens", "grch37", "1", 1, null, null, null); ObjectMap options = new ObjectMap(VariantStorageOptions.ANNOTATOR.key(), "cellbase"); CellBaseRestVariantAnnotator annotator = new CellBaseRestVariantAnnotator(storageConfiguration, projectMetadata, options); assertEquals(Collections.singletonList("hgmd"), annotator.getVariantAnnotationMetadata().getPrivateSources()); @@ -99,13 +96,12 @@ public void testHGMDToken() throws Exception { } @Test - public void testCOSMICandHGMDToken() throws Exception { - String token = System.getenv("CELLBASE_TOKEN"); - Assume.assumeTrue(StringUtils.isNotEmpty(token)); + public void testCOSMICandHGMDApiKey() throws Exception { + String apiKey = System.getenv("CELLBASE_COSMIC_HGMD_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); - storageConfiguration.getCellbase().setToken(token); + storageConfiguration.getCellbase().setApiKey(apiKey); - projectMetadata = new ProjectMetadata("hsapiens", "grch37", "1", 1, null, null, null); ObjectMap options = new ObjectMap(VariantStorageOptions.ANNOTATOR.key(), "cellbase"); options.put(ANNOTATOR_CELLBASE_INCLUDE.key(), "clinical"); CellBaseRestVariantAnnotator annotator = new CellBaseRestVariantAnnotator(storageConfiguration, projectMetadata, options); diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java index cf2b4201b5f..02b84fc38a9 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java @@ -1,6 +1,7 @@ package org.opencb.opencga.storage.core.variant.annotation.annotators; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -9,20 +10,15 @@ import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.avro.EvidenceEntry; import org.opencb.biodata.models.variant.avro.VariantAnnotation; -import org.opencb.cellbase.client.config.ClientConfiguration; -import org.opencb.cellbase.client.config.RestConfig; -import org.opencb.cellbase.client.rest.CellBaseClient; import org.opencb.cellbase.core.result.CellBaseDataResult; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.core.testclassification.duration.ShortTests; import org.opencb.opencga.storage.core.StorageEngine; import org.opencb.opencga.core.config.storage.StorageConfiguration; import org.opencb.opencga.storage.core.metadata.models.ProjectMetadata; -import org.opencb.opencga.storage.core.utils.CellBaseUtils; import org.opencb.opencga.storage.core.variant.VariantStorageOptions; import org.opencb.opencga.storage.core.variant.annotation.VariantAnnotatorException; -import java.io.IOException; import java.util.*; import static org.hamcrest.CoreMatchers.instanceOf; @@ -116,9 +112,9 @@ public void testErrorVariant() throws VariantAnnotatorException { } @Test - public void useCellBaseTokens() throws VariantAnnotatorException { + public void useCellBaseApiKeys() throws VariantAnnotatorException { storageConfiguration.getCellbase().setUrl("https://uk.ws.zettagenomics.com/cellbase/"); - storageConfiguration.getCellbase().setVersion("task-3808"); + storageConfiguration.getCellbase().setVersion("v5.4"); storageConfiguration.getCellbase().setDataRelease("3"); VariantAnnotator variantAnnotator = null; @@ -131,6 +127,8 @@ public void useCellBaseTokens() throws VariantAnnotatorException { } assumeTrue(variantAnnotator != null); + String apiKey; + // No token List results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); assertEquals(1, results.size()); @@ -139,41 +137,40 @@ public void useCellBaseTokens() throws VariantAnnotatorException { assertFalse(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); // Using COSMIC token - storageConfiguration.getCellbase().setToken("eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImNvc21pYyI6OTIyMzM3MjAzNjg1NDc3NTgwN30sInZlcnNpb24iOiIxLjAiLCJzdWIiOiJaRVRUQSIsImlhdCI6MTY3NTg3MjQ2Nn0.ByfPJn8Lkh5Sow4suRZcOqVxvWZRmTBBNLDzHEIZQ5U"); - variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); - results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); - assertEquals(1, results.size()); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); - assertFalse(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); + apiKey = System.getenv("CELLBASE_COSMIC_APIKEY"); + if (StringUtils.isNotEmpty(apiKey)) { + storageConfiguration.getCellbase().setApiKey(apiKey); + variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); + results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); + assertEquals(1, results.size()); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); + assertFalse(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); + } // Using HGMD token - storageConfiguration.getCellbase().setToken("eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImhnbWQiOjkyMjMzNzIwMzY4NTQ3NzU4MDd9LCJ2ZXJzaW9uIjoiMS4wIiwic3ViIjoiWkVUVEEiLCJpYXQiOjE2NzU4NzI1MDd9.f3JgVRt7_VrifNWTaRMW3aQfrKbtDbIxlzoenJRYJo0"); - variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); - results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); - assertEquals(1, results.size()); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); - assertFalse(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); - - // Using COSMIC = HGMD token - storageConfiguration.getCellbase().setToken("eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImNvc21pYyI6OTIyMzM3MjAzNjg1NDc3NTgwNywiaGdtZCI6OTIyMzM3MjAzNjg1NDc3NTgwN30sInZlcnNpb24iOiIxLjAiLCJzdWIiOiJaRVRUQSIsImlhdCI6MTY3NTg3MjUyN30.NCCFc4SAhjUsN5UU0wXGY6nCZx8jLglvaO1cNZYI0u4"); - variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); - results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); - assertEquals(1, results.size()); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); - assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); - } + apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); + if (StringUtils.isNotEmpty(apiKey)) { + storageConfiguration.getCellbase().setApiKey(apiKey); + variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); + results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); + assertEquals(1, results.size()); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); + assertFalse(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); + } - private Set getSources(VariantAnnotation variantAnnotation) { - Set sources = new HashSet<>(); - if (variantAnnotation != null && CollectionUtils.isNotEmpty(variantAnnotation.getTraitAssociation())) { - for (EvidenceEntry entry : variantAnnotation.getTraitAssociation()) { - sources.add(entry.getSource().getName()); - } + // Using COSMIC + HGMD token + apiKey = System.getenv("CELLBASE_COSMIC_HGMD_APIKEY"); + if (StringUtils.isNotEmpty(apiKey)) { + storageConfiguration.getCellbase().setApiKey(apiKey); + variantAnnotator = VariantAnnotatorFactory.buildVariantAnnotator(storageConfiguration, projectMetadata, options); + results = variantAnnotator.annotate(Collections.singletonList(new Variant("10:113588287:G:A"))); + assertEquals(1, results.size()); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("clinvar"))); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("cosmic"))); + assertTrue(results.get(0).getTraitAssociation().stream().anyMatch(e -> e.getSource().getName().equals("hgmd"))); } - return sources; } public static class TestCellBaseRestVariantAnnotator extends CellBaseRestVariantAnnotator {