diff --git a/.github/workflows/manual-deploy-docker.yml b/.github/workflows/manual-deploy-docker.yml
index 3c9660bbb2c..9a276c7d9b0 100644
--- a/.github/workflows/manual-deploy-docker.yml
+++ b/.github/workflows/manual-deploy-docker.yml
@@ -35,7 +35,7 @@ jobs:
./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
fi
- name: Maven Build (skip tests)
- run: mvn -T 2 clean install -DskipTests
+ run: mvn -T 2 clean install -DskipTests -P storage-hadoop,hdp3.1,RClient,opencga-storage-hadoop-deps -Dopencga.war.name=opencga -Dcheckstyle.skip -pl '!:opencga-storage-hadoop-deps-emr6.1,!:opencga-storage-hadoop-deps-hdp2.6'
- uses: actions/upload-artifact@v3
with:
name: build-folder
diff --git a/opencga-analysis/pom.xml b/opencga-analysis/pom.xml
index 625ffd2fe21..d2910773818 100644
--- a/opencga-analysis/pom.xml
+++ b/opencga-analysis/pom.xml
@@ -72,8 +72,8 @@
org.opencb.opencga
${opencga-storage-hadoop-deps.artifactId}
+ ${project.parent.version}
shaded
- test
org.opencb.opencga
@@ -274,6 +274,7 @@
com.google.code.findbugs:jsr305:jar:3.0.2
+ *
*
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalInterpretationManager.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalInterpretationManager.java
index 50e6d32da75..3ca18fe0eb9 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalInterpretationManager.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalInterpretationManager.java
@@ -824,7 +824,7 @@ public ClinicalAnalyst getAnalyst(String token) throws ToolException {
OpenCGAResult userQueryResult = catalogManager.getUserManager().get(userId, new QueryOptions(QueryOptions.INCLUDE,
Arrays.asList(UserDBAdaptor.QueryParams.EMAIL.key(), UserDBAdaptor.QueryParams.ORGANIZATION.key())), token);
User user = userQueryResult.first();
- return new ClinicalAnalyst(userId, user.getName(), user.getEmail(), "", "");
+ return new ClinicalAnalyst(userId, user.getName(), user.getEmail(), "", Collections.emptyMap());
} catch (CatalogException e) {
throw new ToolException(e);
}
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalTsvAnnotationLoader.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalTsvAnnotationLoader.java
new file mode 100644
index 00000000000..1d2be95e82e
--- /dev/null
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/clinical/ClinicalTsvAnnotationLoader.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2015-2020 OpenCB
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.opencb.opencga.analysis.clinical;
+
+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.analysis.annotations.TsvAnnotationLoader;
+import org.opencb.opencga.catalog.exceptions.CatalogException;
+import org.opencb.opencga.catalog.managers.AnnotationSetManager;
+import org.opencb.opencga.catalog.utils.Constants;
+import org.opencb.opencga.catalog.utils.ParamUtils;
+import org.opencb.opencga.core.models.clinical.ClinicalAnalysisUpdateParams;
+import org.opencb.opencga.core.models.common.AnnotationSet;
+import org.opencb.opencga.core.models.common.Enums;
+import org.opencb.opencga.core.tools.annotations.Tool;
+
+import java.util.Collections;
+
+@Tool(id = ClinicalTsvAnnotationLoader.ID, resource = Enums.Resource.CLINICAL_ANALYSIS, type = Tool.Type.OPERATION,
+ description = "Load annotations from TSV file.")
+public class ClinicalTsvAnnotationLoader extends TsvAnnotationLoader {
+ public final static String ID = "clinical-tsv-load";
+
+ @Override
+ public int count(Query query) throws CatalogException {
+ return catalogManager.getClinicalAnalysisManager().count(study, query, token).getNumResults();
+ }
+
+ @Override
+ public void addAnnotationSet(String entryId, AnnotationSet annotationSet, QueryOptions options) throws CatalogException {
+ ClinicalAnalysisUpdateParams updateParams = new ClinicalAnalysisUpdateParams()
+ .setAnnotationSets(Collections.singletonList(annotationSet));
+ QueryOptions queryOptions = options != null ? new QueryOptions(options) : new QueryOptions();
+ queryOptions.put(Constants.ACTIONS, new ObjectMap(AnnotationSetManager.ANNOTATION_SETS, ParamUtils.BasicUpdateAction.ADD));
+
+ catalogManager.getClinicalAnalysisManager().update(study, entryId, updateParams, queryOptions, token);
+ }
+}
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosAnalysis.java
index 2ed3cf65913..96bf18034c0 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosAnalysis.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosAnalysis.java
@@ -16,6 +16,7 @@
package org.opencb.opencga.analysis.variant.circos;
+import org.opencb.opencga.analysis.ResourceUtils;
import org.opencb.opencga.analysis.tools.OpenCgaTool;
import org.opencb.opencga.core.exceptions.ToolException;
import org.opencb.opencga.core.models.common.Enums;
@@ -34,6 +35,8 @@ public class CircosAnalysis extends OpenCgaTool {
private String study;
private CircosAnalysisParams circosParams;
+ private String assembly;
+
@Override
protected void check() throws Exception {
super.check();
@@ -58,6 +61,8 @@ protected void check() throws Exception {
// }
//
// addAttribute("sampleName", sampleName);
+
+ assembly = ResourceUtils.getAssembly(catalogManager, study, token);
}
@Override
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosLocalAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosLocalAnalysisExecutor.java
index 40f829ecd6c..356d53d1d84 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosLocalAnalysisExecutor.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/circos/CircosLocalAnalysisExecutor.java
@@ -28,8 +28,10 @@
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.utils.DockerUtils;
+import org.opencb.opencga.analysis.ResourceUtils;
import org.opencb.opencga.analysis.StorageToolExecutor;
import org.opencb.opencga.analysis.variant.manager.VariantStorageManager;
+import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.core.common.TimeUtils;
import org.opencb.opencga.core.exceptions.ToolException;
@@ -93,7 +95,7 @@ public VariantStorageManager getVariantStorageManager() throws ToolExecutorExcep
}
@Override
- public void run() throws ToolException, IOException {
+ public void run() throws ToolException, IOException, CatalogException {
// Create query
Query query = new Query();
@@ -128,7 +130,6 @@ public void run() throws ToolException, IOException {
throw new ToolException("Error launching threads when executing the Circos analysis", e);
}
-
if (MapUtils.isEmpty(errors)) {
// Execute R script
// circos.R ./snvs.tsv ./indels.tsv ./cnvs.tsv ./rearrs.tsv SampleId
@@ -138,10 +139,19 @@ public void run() throws ToolException, IOException {
AbstractMap.SimpleEntry outputBinding = new AbstractMap.SimpleEntry<>(getOutDir()
.toAbsolutePath().toString(),
DOCKER_OUTPUT_PATH);
+
+ // Get genome version
+ String genomeVersion = "hg38";
+ String assembly = ResourceUtils.getAssembly(storageManager.getCatalogManager(), getStudy(), getToken());
+ if (StringUtils.isNotEmpty(assembly) && assembly.toUpperCase(Locale.ROOT).equals("GRCH37")) {
+ genomeVersion = "hg19";
+ }
+
String scriptParams = "R CMD Rscript --vanilla " + DOCKER_INPUT_PATH + "/circos.R"
+ (plotCopynumber ? "" : " --no_copynumber")
+ (plotIndels ? "" : " --no_indels")
+ (plotRearrangements ? "" : " --no_rearrangements")
+ + " --genome_version " + genomeVersion
+ " --out_path " + DOCKER_OUTPUT_PATH
+ " " + DOCKER_OUTPUT_PATH + "/" + snvsFile.getName()
+ " " + DOCKER_OUTPUT_PATH + "/" + indelsFile.getName()
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotAnalysis.java
index f7f63f37706..04a5241623f 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotAnalysis.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotAnalysis.java
@@ -21,6 +21,7 @@
import org.opencb.biodata.models.clinical.qc.GenomePlotConfig;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.analysis.AnalysisUtils;
+import org.opencb.opencga.analysis.ResourceUtils;
import org.opencb.opencga.analysis.tools.OpenCgaToolScopeStudy;
import org.opencb.opencga.core.common.JacksonUtils;
import org.opencb.opencga.core.exceptions.ToolException;
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotLocalAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotLocalAnalysisExecutor.java
index 4246e142d55..a86cc797287 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotLocalAnalysisExecutor.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/genomePlot/GenomePlotLocalAnalysisExecutor.java
@@ -30,8 +30,10 @@
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.utils.DockerUtils;
+import org.opencb.opencga.analysis.ResourceUtils;
import org.opencb.opencga.analysis.StorageToolExecutor;
import org.opencb.opencga.analysis.variant.manager.VariantStorageManager;
+import org.opencb.opencga.catalog.exceptions.CatalogException;
import org.opencb.opencga.core.common.GitRepositoryState;
import org.opencb.opencga.core.common.JacksonUtils;
import org.opencb.opencga.core.common.TimeUtils;
@@ -46,10 +48,7 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.concurrent.*;
import static org.opencb.opencga.analysis.wrappers.executors.DockerWrapperAnalysisExecutor.DOCKER_INPUT_PATH;
@@ -79,7 +78,7 @@ public class GenomePlotLocalAnalysisExecutor extends GenomePlotAnalysisExecutor
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
- public void run() throws ToolException, IOException {
+ public void run() throws ToolException, IOException, CatalogException {
plotConfig = JacksonUtils.getDefaultObjectMapper().readerFor(GenomePlotConfig.class).readValue(getConfigFile());
@@ -125,10 +124,19 @@ public void run() throws ToolException, IOException {
inputBindings.add(new AbstractMap.SimpleEntry<>(rScriptPath, DOCKER_INPUT_PATH));
AbstractMap.SimpleEntry outputBinding = new AbstractMap.SimpleEntry<>(getOutDir()
.toAbsolutePath().toString(), DOCKER_OUTPUT_PATH);
+
+ // Get genome version
+ String genomeVersion = "hg38";
+ String assembly = ResourceUtils.getAssembly(storageManager.getCatalogManager(), getStudy(), getToken());
+ if (StringUtils.isNotEmpty(assembly) && assembly.toUpperCase(Locale.ROOT).equals("GRCH37")) {
+ genomeVersion = "hg19";
+ }
+
String scriptParams = "R CMD Rscript --vanilla " + DOCKER_INPUT_PATH + "/circos.R"
+ (plotCopynumber ? "" : " --no_copynumber")
+ (plotIndels ? "" : " --no_indels")
+ (plotRearrangements ? "" : " --no_rearrangements")
+ + " --genome_version " + genomeVersion
+ " --out_path " + DOCKER_OUTPUT_PATH
+ " " + DOCKER_OUTPUT_PATH + "/" + snvsFile.getName()
+ " " + DOCKER_OUTPUT_PATH + "/" + indelsFile.getName()
diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/exomiser/ExomiserWrapperAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/exomiser/ExomiserWrapperAnalysisExecutor.java
index 099d3c6c7db..86bb3760b3c 100644
--- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/exomiser/ExomiserWrapperAnalysisExecutor.java
+++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/exomiser/ExomiserWrapperAnalysisExecutor.java
@@ -147,7 +147,15 @@ public void run() throws ToolException {
Path openCgaHome = getOpencgaHomePath();
Path exomiserDataPath = getAnalysisDataPath(ExomiserWrapperAnalysis.ID);
- // And copy the application.properties
+ // Copy the analysis
+ try {
+ FileUtils.copyFile(openCgaHome.resolve("analysis/exomiser/" + EXOMISER_ANALYSIS_TEMPLATE_FILENAME).toFile(),
+ getOutDir().resolve(EXOMISER_ANALYSIS_TEMPLATE_FILENAME).toFile());
+ } catch (IOException e) {
+ throw new ToolException("Error copying Exomiser analysis file", e);
+ }
+
+ // Copy the application.properties
try {
FileUtils.copyFile(openCgaHome.resolve("analysis/exomiser/" + EXOMISER_PROPERTIES_TEMPLATE_FILENAME).toFile(),
getOutDir().resolve(EXOMISER_PROPERTIES_TEMPLATE_FILENAME).toFile());
@@ -155,7 +163,7 @@ public void run() throws ToolException {
throw new ToolException("Error copying Exomiser properties file", e);
}
- // And copy the output options
+ // Copy the output options
try {
FileUtils.copyFile(openCgaHome.resolve("analysis/exomiser/" + EXOMISER_OUTPUT_OPTIONS_FILENAME).toFile(),
getOutDir().resolve(EXOMISER_OUTPUT_OPTIONS_FILENAME).toFile());
@@ -174,7 +182,7 @@ public void run() throws ToolException {
appendCommand("", sb);
// Append input file params
-// sb.append(" --analysis /jobdir/").append(EXOMISER_ANALYSIS_TEMPLATE_FILENAME)
+ sb.append(" --analysis /jobdir/").append(EXOMISER_ANALYSIS_TEMPLATE_FILENAME);
sb.append(" --sample /jobdir/").append(sampleFile.getName());
if (pedigreeFile != null && pedigreeFile.exists()) {
sb.append(" --ped /jobdir/").append(pedigreeFile.getName());
diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
index 9889af6e563..001e44792cf 100644
--- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
+++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
@@ -31,6 +31,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeThat;
@Category(MediumTests.class)
@@ -93,7 +94,7 @@ public void singleExomiserAnalysis() throws IOException, CatalogException, ToolE
clinicalAnalysis = clinicalTest.catalogManager.getClinicalAnalysisManager()
.get(clinicalTest.studyFqn, clinicalTest.CA_ID2, QueryOptions.empty(), clinicalTest.token).first();
assertEquals(1, clinicalAnalysis.getSecondaryInterpretations().size());
- assertEquals(22, clinicalAnalysis.getSecondaryInterpretations().get(0).getPrimaryFindings().size());
+ assertTrue(clinicalAnalysis.getSecondaryInterpretations().get(0).getPrimaryFindings().size() > 0);
}
@Test
@@ -119,7 +120,7 @@ public void familyExomiserAnalysis() throws IOException, CatalogException, ToolE
clinicalAnalysis = clinicalTest.catalogManager.getClinicalAnalysisManager()
.get(clinicalTest.studyFqn, clinicalTest.CA_ID3, QueryOptions.empty(), clinicalTest.token).first();
assertEquals(1, clinicalAnalysis.getSecondaryInterpretations().size());
- assertEquals(2, clinicalAnalysis.getSecondaryInterpretations().get(0).getPrimaryFindings().size());
+ assertTrue(clinicalAnalysis.getSecondaryInterpretations().get(0).getPrimaryFindings().size() > 0);
System.out.println("results at out dir = " + outDir.toAbsolutePath());
}
diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
index 95f0ef297d5..38782aef1f0 100644
--- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
+++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
@@ -49,7 +49,9 @@
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
import java.util.Date;
+import java.util.List;
import java.util.Map;
/**
@@ -260,6 +262,14 @@ public Path isolateOpenCGA() throws IOException {
inputStream = new FileInputStream("../opencga-app/app/analysis/pedigree-graph/ped.R");
Files.copy(inputStream, analysisPath.resolve("ped.R"), StandardCopyOption.REPLACE_EXISTING);
+ // Exomiser analysis files
+ analysisPath = Files.createDirectories(opencgaHome.resolve("analysis/exomiser")).toAbsolutePath();
+ List exomiserFiles = Arrays.asList("application.properties", "exomiser-analysis.yml", "output.yml");
+ for (String exomiserFile : exomiserFiles) {
+ inputStream = new FileInputStream("../opencga-app/app/analysis/exomiser/" + exomiserFile);
+ Files.copy(inputStream, analysisPath.resolve(exomiserFile), StandardCopyOption.REPLACE_EXISTING);
+ }
+
return opencgaHome;
}
diff --git a/opencga-app/app/analysis/exomiser/exomiser-analysis.yml b/opencga-app/app/analysis/exomiser/exomiser-analysis.yml
new file mode 100644
index 00000000000..5ec7d93d508
--- /dev/null
+++ b/opencga-app/app/analysis/exomiser/exomiser-analysis.yml
@@ -0,0 +1,70 @@
+---
+analysisMode: PASS_ONLY
+inheritanceModes: {
+ AUTOSOMAL_DOMINANT: 0.1,
+ AUTOSOMAL_RECESSIVE_HOM_ALT: 0.1,
+ AUTOSOMAL_RECESSIVE_COMP_HET: 2.0,
+ X_DOMINANT: 0.1,
+ X_RECESSIVE_HOM_ALT: 0.1,
+ X_RECESSIVE_COMP_HET: 2.0,
+ MITOCHONDRIAL: 0.2
+}
+frequencySources: [
+ THOUSAND_GENOMES,
+ TOPMED,
+ UK10K,
+
+ ESP_AFRICAN_AMERICAN, ESP_EUROPEAN_AMERICAN, ESP_ALL,
+
+ EXAC_AFRICAN_INC_AFRICAN_AMERICAN, EXAC_AMERICAN,
+ EXAC_SOUTH_ASIAN, EXAC_EAST_ASIAN,
+ EXAC_FINNISH, EXAC_NON_FINNISH_EUROPEAN,
+ EXAC_OTHER,
+
+ GNOMAD_E_AFR,
+ GNOMAD_E_AMR,
+ # GNOMAD_E_ASJ,
+ GNOMAD_E_EAS,
+ GNOMAD_E_FIN,
+ GNOMAD_E_NFE,
+ GNOMAD_E_OTH,
+ GNOMAD_E_SAS,
+
+ GNOMAD_G_AFR,
+ GNOMAD_G_AMR,
+ # GNOMAD_G_ASJ,
+ GNOMAD_G_EAS,
+ GNOMAD_G_FIN,
+ GNOMAD_G_NFE,
+ GNOMAD_G_OTH,
+ GNOMAD_G_SAS
+]
+# Possible pathogenicitySources: (POLYPHEN, MUTATION_TASTER, SIFT), (REVEL, MVP), CADD, REMM
+# REMM is trained on non-coding regulatory regions
+# *WARNING* if you enable CADD or REMM ensure that you have downloaded and installed the CADD/REMM tabix files
+# and updated their location in the application.properties. Exomiser will not run without this.
+pathogenicitySources: [ REVEL, MVP ]
+#this is the standard exomiser order.
+steps: [
+ failedVariantFilter: { },
+ variantEffectFilter: {
+ remove: [
+ FIVE_PRIME_UTR_EXON_VARIANT,
+ FIVE_PRIME_UTR_INTRON_VARIANT,
+ THREE_PRIME_UTR_EXON_VARIANT,
+ THREE_PRIME_UTR_INTRON_VARIANT,
+ NON_CODING_TRANSCRIPT_EXON_VARIANT,
+ NON_CODING_TRANSCRIPT_INTRON_VARIANT,
+ CODING_TRANSCRIPT_INTRON_VARIANT,
+ UPSTREAM_GENE_VARIANT,
+ DOWNSTREAM_GENE_VARIANT,
+ INTERGENIC_VARIANT,
+ REGULATORY_REGION_VARIANT
+ ]
+ },
+ frequencyFilter: { maxFrequency: 2.0 },
+ pathogenicityFilter: { keepNonPathogenic: true },
+ inheritanceFilter: { },
+ omimPrioritiser: { },
+ hiPhivePrioritiser: { }
+]
diff --git a/opencga-app/app/cloud/docker/opencga-base/Dockerfile b/opencga-app/app/cloud/docker/opencga-base/Dockerfile
index d3eee2266d2..b6f334f9d8a 100644
--- a/opencga-app/app/cloud/docker/opencga-base/Dockerfile
+++ b/opencga-app/app/cloud/docker/opencga-base/Dockerfile
@@ -7,7 +7,7 @@ ARG BUILD_PATH="."
ENV OPENCGA_HOME=/opt/opencga
ENV OPENCGA_CONFIG_DIR=${OPENCGA_HOME}/conf
-RUN apt-get update && apt-get -y upgrade && apt-get install -y lsb-release sshpass ca-certificates curl gnupg jq ncurses-bin && \
+RUN apt-get update && apt-get -y upgrade && apt-get install -y lsb-release sshpass ca-certificates curl gnupg jq ncurses-bin unzip vim && \
## Install Docker repository
install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/InternalCliOptionsParser.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/InternalCliOptionsParser.java
index 132ad854c82..0079461d25a 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/InternalCliOptionsParser.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/InternalCliOptionsParser.java
@@ -226,6 +226,7 @@ public InternalCliOptionsParser() {
clinicalSubCommands.addCommand(RGA_INDEX_RUN_COMMAND, clinicalCommandOptions.rgaSecondaryIndexCommandOptions);
clinicalSubCommands.addCommand(RGA_AUX_INDEX_RUN_COMMAND, clinicalCommandOptions.rgaAuxiliarSecondaryIndexCommandOptions);
clinicalSubCommands.addCommand(EXOMISER_INTERPRETATION_RUN_COMMAND, clinicalCommandOptions.exomiserInterpretationCommandOptions);
+ clinicalSubCommands.addCommand("tsv-load", clinicalCommandOptions.tsvLoad);
fileCommandOptions = new FileCommandOptions(commonCommandOptions, jCommander);
jCommander.addCommand("files", fileCommandOptions);
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/ClinicalCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/ClinicalCommandExecutor.java
index e0785c79fee..14256ac1652 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/ClinicalCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/ClinicalCommandExecutor.java
@@ -24,6 +24,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.analysis.clinical.ClinicalTsvAnnotationLoader;
import org.opencb.opencga.analysis.clinical.exomiser.ExomiserInterpretationAnalysis;
import org.opencb.opencga.analysis.clinical.rga.AuxiliarRgaAnalysis;
import org.opencb.opencga.analysis.clinical.rga.RgaAnalysis;
@@ -96,6 +97,9 @@ public void execute() throws Exception {
case EXOMISER_INTERPRETATION_RUN_COMMAND:
exomiserInterpretation();
break;
+ case "tsv-load":
+ tsvLoad();
+ break;
default:
logger.error("Subcommand not valid");
break;
@@ -314,4 +318,19 @@ private void exomiserInterpretation() throws Exception {
// exomiserInterpretationAnalysis.setPrimary(cliOptions.primary);
exomiserInterpretationAnalysis.start();
}
+
+ private void tsvLoad() throws ToolException {
+ ClinicalCommandOptions.TsvLoad options = clinicalCommandOptions.tsvLoad;
+
+ Path outDir = Paths.get(options.outDir);
+
+ ClinicalTsvAnnotationLoader annotationLoader = new ClinicalTsvAnnotationLoader();
+ annotationLoader.setAnnotationSetId(options.annotationSetId);
+ annotationLoader.setVariableSetId(options.variableSetId);
+ annotationLoader.setPath(options.filePath);
+ annotationLoader.setStudy(options.study);
+
+ annotationLoader.setUp(opencgaHome.toString(), new ObjectMap(), outDir, options.commonOptions.token);
+ annotationLoader.start();
+ }
}
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/ClinicalCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/ClinicalCommandOptions.java
index 2663f3c7c5e..9c7f8806fc7 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/ClinicalCommandOptions.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/ClinicalCommandOptions.java
@@ -5,6 +5,7 @@
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
import org.opencb.biodata.models.clinical.ClinicalProperty;
+import org.opencb.opencga.analysis.clinical.ClinicalTsvAnnotationLoader;
import org.opencb.opencga.analysis.clinical.exomiser.ExomiserInterpretationAnalysis;
import org.opencb.opencga.analysis.clinical.rga.AuxiliarRgaAnalysis;
import org.opencb.opencga.analysis.clinical.rga.RgaAnalysis;
@@ -14,6 +15,7 @@
import org.opencb.opencga.analysis.clinical.zetta.ZettaInterpretationAnalysis;
import org.opencb.opencga.app.cli.GeneralCliOptions;
import org.opencb.opencga.app.cli.internal.InternalCliOptionsParser;
+import org.opencb.opencga.core.api.ParamConstants;
import org.opencb.opencga.core.models.clinical.RgaAnalysisParams;
import org.opencb.opencga.storage.app.cli.client.options.StorageVariantCommandOptions.BasicVariantQueryOptions;
@@ -33,6 +35,7 @@ public class ClinicalCommandOptions {
public final RgaSecondaryIndexCommandOptions rgaSecondaryIndexCommandOptions;
public final RgaAuxiliarSecondaryIndexCommandOptions rgaAuxiliarSecondaryIndexCommandOptions;
public final ExomiserInterpretationCommandOptions exomiserInterpretationCommandOptions;
+ public final TsvLoad tsvLoad;
public JCommander jCommander;
public GeneralCliOptions.CommonCommandOptions commonCommandOptions;
@@ -53,6 +56,7 @@ public ClinicalCommandOptions(GeneralCliOptions.CommonCommandOptions commonComma
this.rgaSecondaryIndexCommandOptions = new RgaSecondaryIndexCommandOptions();
this.rgaAuxiliarSecondaryIndexCommandOptions = new RgaAuxiliarSecondaryIndexCommandOptions();
this.exomiserInterpretationCommandOptions = new ExomiserInterpretationCommandOptions();
+ this.tsvLoad = new TsvLoad();
}
@Parameters(commandNames = {TieringCommandOptions.TIERING_INTERPRETATION_RUN_COMMAND}, commandDescription =
@@ -335,4 +339,29 @@ public class ExomiserInterpretationCommandOptions extends GeneralCliOptions.Stud
@Parameter(names = {"-o", "--outdir"}, description = "Directory where output files will be saved", arity = 1)
public String outdir;
}
+
+ @Parameters(commandNames = {"tsv-load"}, commandDescription = "Load annotations from a TSV file")
+ public class TsvLoad extends GeneralCliOptions.StudyOption {
+
+ public static final String TSV_LOAD_COMMAND = ClinicalTsvAnnotationLoader.ID;
+
+ @ParametersDelegate
+ public GeneralCliOptions.CommonCommandOptions commonOptions = commonCommandOptions;
+
+ @ParametersDelegate
+ public InternalCliOptionsParser.JobOptions jobOptions = internalJobOptions;
+
+ @Parameter(names = {"--file"}, description = "Path to the TSV file.", required = true, arity = 1)
+ public String filePath;
+
+ @Parameter(names = {"--variable-set-id"}, description = ParamConstants.VARIABLE_SET_DESCRIPTION, required = true, arity = 1)
+ public String variableSetId;
+
+ @Parameter(names = {"--annotation-set-id"}, description = "AnnotationSet id that will be given to the new annotations.",
+ required = true, arity = 1)
+ public String annotationSetId;
+
+ @Parameter(names = {"-o", "--outdir"}, description = "Directory where output files will be saved", required = true, arity = 1)
+ public String outDir;
+ }
}
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 2a2d4a8adf0..154dd0010dd 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-11-13 OpenCB
+* Copyright 2015-2023-12-15 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public abstract class OpenCgaCompleter implements Completer {
.map(Candidate::new)
.collect(toList());
- private List clinicalList = asList( "acl-update","clinical-configuration-update","create","distinct","interpretation-distinct","interpretation-search","interpretation-info","interpreter-cancer-tiering-run","interpreter-exomiser-run","interpreter-team-run","interpreter-tiering-run","interpreter-zetta-run","rga-aggregation-stats","rga-gene-query","rga-gene-summary","rga-index-run","rga-individual-query","rga-individual-summary","rga-variant-query","rga-variant-summary","search","variant-query","acl","delete","update","info","interpretation-create","interpretation-clear","interpretation-delete","interpretation-revert","interpretation-update")
+ private List clinicalList = asList( "acl-update","annotation-sets-load","clinical-configuration-update","create","distinct","interpretation-distinct","interpretation-search","interpretation-info","interpreter-cancer-tiering-run","interpreter-exomiser-run","interpreter-team-run","interpreter-tiering-run","interpreter-zetta-run","rga-aggregation-stats","rga-gene-query","rga-gene-summary","rga-index-run","rga-individual-query","rga-individual-summary","rga-variant-query","rga-variant-summary","search","variant-query","acl","delete","update","annotation-sets-annotations-update","info","interpretation-create","interpretation-clear","interpretation-delete","interpretation-revert","interpretation-update")
.stream()
.map(Candidate::new)
.collect(toList());
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 8746d0cc58e..a88d83dac78 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-11-13 OpenCB
+* Copyright 2015-2023-12-15 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,6 +128,7 @@ public OpencgaCliOptionsParser() {
jCommander.addCommand("clinical", analysisClinicalCommandOptions);
JCommander analysisClinicalSubCommands = jCommander.getCommands().get("clinical");
analysisClinicalSubCommands.addCommand("acl-update", analysisClinicalCommandOptions.updateAclCommandOptions);
+ analysisClinicalSubCommands.addCommand("annotation-sets-load", analysisClinicalCommandOptions.loadAnnotationSetsCommandOptions);
analysisClinicalSubCommands.addCommand("clinical-configuration-update", analysisClinicalCommandOptions.updateClinicalConfigurationCommandOptions);
analysisClinicalSubCommands.addCommand("create", analysisClinicalCommandOptions.createCommandOptions);
analysisClinicalSubCommands.addCommand("distinct", analysisClinicalCommandOptions.distinctCommandOptions);
@@ -152,6 +153,7 @@ public OpencgaCliOptionsParser() {
analysisClinicalSubCommands.addCommand("acl", analysisClinicalCommandOptions.aclCommandOptions);
analysisClinicalSubCommands.addCommand("delete", analysisClinicalCommandOptions.deleteCommandOptions);
analysisClinicalSubCommands.addCommand("update", analysisClinicalCommandOptions.updateCommandOptions);
+ analysisClinicalSubCommands.addCommand("annotation-sets-annotations-update", analysisClinicalCommandOptions.updateAnnotationSetsAnnotationsCommandOptions);
analysisClinicalSubCommands.addCommand("info", analysisClinicalCommandOptions.infoCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-create", analysisClinicalCommandOptions.createInterpretationCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-clear", analysisClinicalCommandOptions.clearInterpretationCommandOptions);
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java
index 19efed930b2..9126d2a3a7b 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AdminCommandExecutor.java
@@ -44,6 +44,7 @@
*/
public class AdminCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "admin";
public AdminCommandOptions adminCommandOptions;
public AdminCommandExecutor(AdminCommandOptions adminCommandOptions) throws CatalogAuthenticationException {
@@ -131,10 +132,9 @@ private RestResponse installCatalog() throws Exception {
InstallationParams installationParams = null;
if (commandOptions.jsonDataModel) {
- installationParams = new InstallationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(installationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/catalog/install"));
return res;
} else if (commandOptions.jsonFile != null) {
installationParams = JacksonUtils.getDefaultObjectMapper()
@@ -160,10 +160,9 @@ private RestResponse jwtCatalog() throws Exception {
JWTParams jWTParams = null;
if (commandOptions.jsonDataModel) {
- jWTParams = new JWTParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(jWTParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/catalog/jwt"));
return res;
} else if (commandOptions.jsonFile != null) {
jWTParams = JacksonUtils.getDefaultObjectMapper()
@@ -186,10 +185,9 @@ private RestResponse createUsers() throws Exception {
UserCreateParams userCreateParams = null;
if (commandOptions.jsonDataModel) {
- userCreateParams = new UserCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(userCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/create"));
return res;
} else if (commandOptions.jsonFile != null) {
userCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -217,10 +215,9 @@ private RestResponse importUsers() throws Exception {
UserImportParams userImportParams = null;
if (commandOptions.jsonDataModel) {
- userImportParams = new UserImportParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(userImportParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/import"));
return res;
} else if (commandOptions.jsonFile != null) {
userImportParams = JacksonUtils.getDefaultObjectMapper()
@@ -265,10 +262,9 @@ private RestResponse syncUsers() throws Exception {
GroupSyncParams groupSyncParams = null;
if (commandOptions.jsonDataModel) {
- groupSyncParams = new GroupSyncParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(groupSyncParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/sync"));
return res;
} else if (commandOptions.jsonFile != null) {
groupSyncParams = JacksonUtils.getDefaultObjectMapper()
@@ -301,10 +297,9 @@ private RestResponse usersUpdateGroups() throws Exception {
UserUpdateGroup userUpdateGroup = null;
if (commandOptions.jsonDataModel) {
- userUpdateGroup = new UserUpdateGroup();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(userUpdateGroup));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/admin/users/{user}/groups/update"));
return res;
} else if (commandOptions.jsonFile != null) {
userUpdateGroup = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisAlignmentCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisAlignmentCommandExecutor.java
index c1e5a5e0b7c..fcbbfdfc789 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisAlignmentCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisAlignmentCommandExecutor.java
@@ -44,6 +44,7 @@
*/
public class AnalysisAlignmentCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "alignment";
public AnalysisAlignmentCommandOptions analysisAlignmentCommandOptions;
public AnalysisAlignmentCommandExecutor(AnalysisAlignmentCommandOptions analysisAlignmentCommandOptions) throws CatalogAuthenticationException {
@@ -127,10 +128,9 @@ private RestResponse runBwa() throws Exception {
BwaWrapperParams bwaWrapperParams = null;
if (commandOptions.jsonDataModel) {
- bwaWrapperParams = new BwaWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(bwaWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/bwa/run"));
return res;
} else if (commandOptions.jsonFile != null) {
bwaWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -169,10 +169,9 @@ private RestResponse runCoverageIndex() throws Exception {
CoverageIndexParams coverageIndexParams = null;
if (commandOptions.jsonDataModel) {
- coverageIndexParams = new CoverageIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(coverageIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/coverage/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
coverageIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -208,10 +207,9 @@ private RestResponse coverageQcGeneCoverageStatsRun() throws Exception {
AlignmentGeneCoverageStatsParams alignmentGeneCoverageStatsParams = null;
if (commandOptions.jsonDataModel) {
- alignmentGeneCoverageStatsParams = new AlignmentGeneCoverageStatsParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(alignmentGeneCoverageStatsParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/coverage/qc/geneCoverageStats/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentGeneCoverageStatsParams = JacksonUtils.getDefaultObjectMapper()
@@ -304,10 +302,9 @@ private RestResponse runDeeptools() throws Exception {
DeeptoolsWrapperParams deeptoolsWrapperParams = null;
if (commandOptions.jsonDataModel) {
- deeptoolsWrapperParams = new DeeptoolsWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(deeptoolsWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/deeptools/run"));
return res;
} else if (commandOptions.jsonFile != null) {
deeptoolsWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -343,10 +340,9 @@ private RestResponse runFastqc() throws Exception {
FastqcWrapperParams fastqcWrapperParams = null;
if (commandOptions.jsonDataModel) {
- fastqcWrapperParams = new FastqcWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fastqcWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/fastqc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
fastqcWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -382,10 +378,9 @@ private RestResponse runIndex() throws Exception {
AlignmentIndexParams alignmentIndexParams = null;
if (commandOptions.jsonDataModel) {
- alignmentIndexParams = new AlignmentIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(alignmentIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -420,10 +415,9 @@ private RestResponse runPicard() throws Exception {
PicardWrapperParams picardWrapperParams = null;
if (commandOptions.jsonDataModel) {
- picardWrapperParams = new PicardWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(picardWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/picard/run"));
return res;
} else if (commandOptions.jsonFile != null) {
picardWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -459,10 +453,9 @@ private RestResponse runQc() throws Exception {
AlignmentQcParams alignmentQcParams = null;
if (commandOptions.jsonDataModel) {
- alignmentQcParams = new AlignmentQcParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(alignmentQcParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/qc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
alignmentQcParams = JacksonUtils.getDefaultObjectMapper()
@@ -531,10 +524,9 @@ private RestResponse runSamtools() throws Exception {
SamtoolsWrapperParams samtoolsWrapperParams = null;
if (commandOptions.jsonDataModel) {
- samtoolsWrapperParams = new SamtoolsWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(samtoolsWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/alignment/samtools/run"));
return res;
} else if (commandOptions.jsonFile != null) {
samtoolsWrapperParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java
index ff9f4431ca4..490e6ca3166 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java
@@ -4,6 +4,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.opencb.biodata.models.clinical.ClinicalDiscussion;
import org.opencb.biodata.models.clinical.ClinicalProperty;
import org.opencb.biodata.models.clinical.interpretation.ClinicalVariant;
@@ -18,6 +19,7 @@
import org.opencb.opencga.catalog.utils.ParamUtils.AclAction;
import org.opencb.opencga.catalog.utils.ParamUtils.AddRemoveReplaceAction;
import org.opencb.opencga.catalog.utils.ParamUtils.BasicUpdateAction;
+import org.opencb.opencga.catalog.utils.ParamUtils.CompleteUpdateAction;
import org.opencb.opencga.catalog.utils.ParamUtils.SaveInterpretationAs;
import org.opencb.opencga.catalog.utils.ParamUtils.UpdateAction;
import org.opencb.opencga.client.exceptions.ClientException;
@@ -38,6 +40,8 @@
import org.opencb.opencga.core.models.clinical.ClinicalAnalysisUpdateParams;
import org.opencb.opencga.core.models.clinical.ClinicalAnalystParam;
import org.opencb.opencga.core.models.clinical.ClinicalReport;
+import org.opencb.opencga.core.models.clinical.ClinicalRequest;
+import org.opencb.opencga.core.models.clinical.ClinicalResponsible;
import org.opencb.opencga.core.models.clinical.DisorderReferenceParam;
import org.opencb.opencga.core.models.clinical.ExomiserInterpretationAnalysisParams;
import org.opencb.opencga.core.models.clinical.FamilyParam;
@@ -51,7 +55,9 @@
import org.opencb.opencga.core.models.clinical.TieringInterpretationAnalysisParams;
import org.opencb.opencga.core.models.clinical.ZettaInterpretationAnalysisParams;
import org.opencb.opencga.core.models.common.StatusParam;
+import org.opencb.opencga.core.models.common.TsvAnnotationParams;
import org.opencb.opencga.core.models.job.Job;
+import org.opencb.opencga.core.models.sample.Sample;
import org.opencb.opencga.core.models.study.configuration.ClinicalAnalysisStudyConfiguration;
import org.opencb.opencga.core.models.study.configuration.ClinicalConsentAnnotationParam;
import org.opencb.opencga.core.models.study.configuration.ClinicalConsentConfiguration;
@@ -75,6 +81,7 @@
*/
public class AnalysisClinicalCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "clinical";
public AnalysisClinicalCommandOptions analysisClinicalCommandOptions;
public AnalysisClinicalCommandExecutor(AnalysisClinicalCommandOptions analysisClinicalCommandOptions) throws CatalogAuthenticationException {
@@ -95,6 +102,9 @@ public void execute() throws Exception {
case "acl-update":
queryResponse = updateAcl();
break;
+ case "annotation-sets-load":
+ queryResponse = loadAnnotationSets();
+ break;
case "clinical-configuration-update":
queryResponse = updateClinicalConfiguration();
break;
@@ -167,6 +177,9 @@ public void execute() throws Exception {
case "update":
queryResponse = update();
break;
+ case "annotation-sets-annotations-update":
+ queryResponse = updateAnnotationSetsAnnotations();
+ break;
case "info":
queryResponse = info();
break;
@@ -209,10 +222,9 @@ private RestResponse updateAcl() throws Exception
ClinicalAnalysisAclUpdateParams clinicalAnalysisAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- clinicalAnalysisAclUpdateParams = new ClinicalAnalysisAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(clinicalAnalysisAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -229,6 +241,40 @@ private RestResponse updateAcl() throws Exception
return openCGAClient.getClinicalAnalysisClient().updateAcl(commandOptions.members, commandOptions.action, clinicalAnalysisAclUpdateParams, queryParams);
}
+ private RestResponse loadAnnotationSets() throws Exception {
+ logger.debug("Executing loadAnnotationSets in Analysis - Clinical command line");
+
+ AnalysisClinicalCommandOptions.LoadAnnotationSetsCommandOptions commandOptions = analysisClinicalCommandOptions.loadAnnotationSetsCommandOptions;
+
+ ObjectMap queryParams = new ObjectMap();
+ queryParams.putIfNotEmpty("study", commandOptions.study);
+ queryParams.putIfNotNull("parents", commandOptions.parents);
+ queryParams.putIfNotEmpty("annotationSetId", commandOptions.annotationSetId);
+ if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
+ queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
+ }
+
+
+ TsvAnnotationParams tsvAnnotationParams = null;
+ if (commandOptions.jsonDataModel) {
+ RestResponse res = new RestResponse<>();
+ res.setType(QueryType.VOID);
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/annotationSets/load"));
+ return res;
+ } else if (commandOptions.jsonFile != null) {
+ tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
+ .readValue(new java.io.File(commandOptions.jsonFile), TsvAnnotationParams.class);
+ } else {
+ ObjectMap beanParams = new ObjectMap();
+ putNestedIfNotEmpty(beanParams, "content",commandOptions.content, true);
+
+ tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper().copy()
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
+ .readValue(beanParams.toJson(), TsvAnnotationParams.class);
+ }
+ return openCGAClient.getClinicalAnalysisClient().loadAnnotationSets(commandOptions.variableSetId, commandOptions.path, tsvAnnotationParams, queryParams);
+ }
+
private RestResponse updateClinicalConfiguration() throws Exception {
logger.debug("Executing updateClinicalConfiguration in Analysis - Clinical command line");
@@ -243,10 +289,9 @@ private RestResponse updateClinicalConfiguration() throws Exception {
ClinicalAnalysisStudyConfiguration clinicalAnalysisStudyConfiguration = null;
if (commandOptions.jsonDataModel) {
- clinicalAnalysisStudyConfiguration = new ClinicalAnalysisStudyConfiguration();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(clinicalAnalysisStudyConfiguration));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/clinical/configuration/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisStudyConfiguration = JacksonUtils.getDefaultObjectMapper()
@@ -280,10 +325,9 @@ private RestResponse create() throws Exception {
ClinicalAnalysisCreateParams clinicalAnalysisCreateParams = null;
if (commandOptions.jsonDataModel) {
- clinicalAnalysisCreateParams = new ClinicalAnalysisCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(clinicalAnalysisCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/create"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -304,6 +348,18 @@ private RestResponse create() throws Exception {
putNestedIfNotEmpty(beanParams, "report.signedBy",commandOptions.reportSignedBy, true);
putNestedIfNotEmpty(beanParams, "report.signature",commandOptions.reportSignature, true);
putNestedIfNotEmpty(beanParams, "report.date",commandOptions.reportDate, true);
+ putNestedIfNotEmpty(beanParams, "request.id",commandOptions.requestId, true);
+ putNestedIfNotEmpty(beanParams, "request.justification",commandOptions.requestJustification, true);
+ putNestedIfNotEmpty(beanParams, "request.date",commandOptions.requestDate, true);
+ putNestedIfNotNull(beanParams, "request.attributes",commandOptions.requestAttributes, true);
+ putNestedIfNotEmpty(beanParams, "responsible.id",commandOptions.responsibleId, true);
+ putNestedIfNotEmpty(beanParams, "responsible.name",commandOptions.responsibleName, true);
+ putNestedIfNotEmpty(beanParams, "responsible.email",commandOptions.responsibleEmail, true);
+ putNestedIfNotEmpty(beanParams, "responsible.organization",commandOptions.responsibleOrganization, true);
+ putNestedIfNotEmpty(beanParams, "responsible.department",commandOptions.responsibleDepartment, true);
+ putNestedIfNotEmpty(beanParams, "responsible.address",commandOptions.responsibleAddress, true);
+ putNestedIfNotEmpty(beanParams, "responsible.city",commandOptions.responsibleCity, true);
+ putNestedIfNotEmpty(beanParams, "responsible.postcode",commandOptions.responsiblePostcode, true);
putNestedIfNotEmpty(beanParams, "interpretation.description",commandOptions.interpretationDescription, true);
putNestedIfNotEmpty(beanParams, "interpretation.clinicalAnalysisId",commandOptions.interpretationClinicalAnalysisId, true);
putNestedIfNotEmpty(beanParams, "interpretation.creationDate",commandOptions.interpretationCreationDate, true);
@@ -311,6 +367,8 @@ private RestResponse create() throws Exception {
putNestedIfNotNull(beanParams, "interpretation.locked",commandOptions.interpretationLocked, true);
putNestedIfNotNull(beanParams, "interpretation.attributes",commandOptions.interpretationAttributes, true);
putNestedIfNotNull(beanParams, "qualityControl.summary",commandOptions.qualityControlSummary, true);
+ putNestedIfNotNull(beanParams, "qualityControl.comments",commandOptions.qualityControlComments, true);
+ putNestedIfNotNull(beanParams, "qualityControl.files",commandOptions.qualityControlFiles, true);
putNestedIfNotEmpty(beanParams, "creationDate",commandOptions.creationDate, true);
putNestedIfNotEmpty(beanParams, "modificationDate",commandOptions.modificationDate, true);
putNestedIfNotEmpty(beanParams, "dueDate",commandOptions.dueDate, true);
@@ -356,6 +414,7 @@ private RestResponse distinct() throws Exception {
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
+ queryParams.putIfNotEmpty("annotation", commandOptions.annotation);
queryParams.putIfNotNull("deleted", commandOptions.deleted);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
@@ -459,10 +518,9 @@ private RestResponse runInterpreterCancerTiering() throws Exception {
CancerTieringInterpretationAnalysisParams cancerTieringInterpretationAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- cancerTieringInterpretationAnalysisParams = new CancerTieringInterpretationAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cancerTieringInterpretationAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/cancerTiering/run"));
return res;
} else if (commandOptions.jsonFile != null) {
cancerTieringInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -498,10 +556,9 @@ private RestResponse runInterpreterExomiser() throws Exception {
ExomiserInterpretationAnalysisParams exomiserInterpretationAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- exomiserInterpretationAnalysisParams = new ExomiserInterpretationAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(exomiserInterpretationAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/exomiser/run"));
return res;
} else if (commandOptions.jsonFile != null) {
exomiserInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -535,10 +592,9 @@ private RestResponse runInterpreterTeam() throws Exception {
TeamInterpretationAnalysisParams teamInterpretationAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- teamInterpretationAnalysisParams = new TeamInterpretationAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(teamInterpretationAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/team/run"));
return res;
} else if (commandOptions.jsonFile != null) {
teamInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -575,10 +631,9 @@ private RestResponse runInterpreterTiering() throws Exception {
TieringInterpretationAnalysisParams tieringInterpretationAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- tieringInterpretationAnalysisParams = new TieringInterpretationAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tieringInterpretationAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/tiering/run"));
return res;
} else if (commandOptions.jsonFile != null) {
tieringInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -615,10 +670,9 @@ private RestResponse runInterpreterZetta() throws Exception {
ZettaInterpretationAnalysisParams zettaInterpretationAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- zettaInterpretationAnalysisParams = new ZettaInterpretationAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(zettaInterpretationAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/interpreter/zetta/run"));
return res;
} else if (commandOptions.jsonFile != null) {
zettaInterpretationAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -818,10 +872,9 @@ private RestResponse runRgaIndex() throws Exception {
RgaAnalysisParams rgaAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- rgaAnalysisParams = new RgaAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(rgaAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/rga/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
rgaAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1003,6 +1056,7 @@ private RestResponse search() throws Exception {
queryParams.putIfNotNull("limit", commandOptions.limit);
queryParams.putIfNotNull("skip", commandOptions.skip);
queryParams.putIfNotNull("count", commandOptions.count);
+ queryParams.putIfNotNull("flattenAnnotations", commandOptions.flattenAnnotations);
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("id", commandOptions.id);
queryParams.putIfNotEmpty("uuid", commandOptions.uuid);
@@ -1028,6 +1082,7 @@ private RestResponse search() throws Exception {
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
+ queryParams.putIfNotEmpty("annotation", commandOptions.annotation);
queryParams.putIfNotNull("deleted", commandOptions.deleted);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
@@ -1150,6 +1205,8 @@ private RestResponse update() throws Exception {
queryParams.putIfNotEmpty("include", commandOptions.include);
queryParams.putIfNotEmpty("exclude", commandOptions.exclude);
queryParams.putIfNotEmpty("study", commandOptions.study);
+ queryParams.putIfNotNull("analystsAction", commandOptions.analystsAction);
+ queryParams.putIfNotNull("annotationSetsAction", commandOptions.annotationSetsAction);
queryParams.putIfNotNull("includeResult", commandOptions.includeResult);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
@@ -1158,10 +1215,9 @@ private RestResponse update() throws Exception {
ClinicalAnalysisUpdateParams clinicalAnalysisUpdateParams = null;
if (commandOptions.jsonDataModel) {
- clinicalAnalysisUpdateParams = new ClinicalAnalysisUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(clinicalAnalysisUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalyses}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
clinicalAnalysisUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -1183,7 +1239,21 @@ private RestResponse update() throws Exception {
putNestedIfNotEmpty(beanParams, "report.signedBy",commandOptions.reportSignedBy, true);
putNestedIfNotEmpty(beanParams, "report.signature",commandOptions.reportSignature, true);
putNestedIfNotEmpty(beanParams, "report.date",commandOptions.reportDate, true);
+ putNestedIfNotEmpty(beanParams, "request.id",commandOptions.requestId, true);
+ putNestedIfNotEmpty(beanParams, "request.justification",commandOptions.requestJustification, true);
+ putNestedIfNotEmpty(beanParams, "request.date",commandOptions.requestDate, true);
+ putNestedIfNotNull(beanParams, "request.attributes",commandOptions.requestAttributes, true);
+ putNestedIfNotEmpty(beanParams, "responsible.id",commandOptions.responsibleId, true);
+ putNestedIfNotEmpty(beanParams, "responsible.name",commandOptions.responsibleName, true);
+ putNestedIfNotEmpty(beanParams, "responsible.email",commandOptions.responsibleEmail, true);
+ putNestedIfNotEmpty(beanParams, "responsible.organization",commandOptions.responsibleOrganization, true);
+ putNestedIfNotEmpty(beanParams, "responsible.department",commandOptions.responsibleDepartment, true);
+ putNestedIfNotEmpty(beanParams, "responsible.address",commandOptions.responsibleAddress, true);
+ putNestedIfNotEmpty(beanParams, "responsible.city",commandOptions.responsibleCity, true);
+ putNestedIfNotEmpty(beanParams, "responsible.postcode",commandOptions.responsiblePostcode, true);
putNestedIfNotNull(beanParams, "qualityControl.summary",commandOptions.qualityControlSummary, true);
+ putNestedIfNotNull(beanParams, "qualityControl.comments",commandOptions.qualityControlComments, true);
+ putNestedIfNotNull(beanParams, "qualityControl.files",commandOptions.qualityControlFiles, true);
putNestedIfNotEmpty(beanParams, "creationDate",commandOptions.creationDate, true);
putNestedIfNotEmpty(beanParams, "modificationDate",commandOptions.modificationDate, true);
putNestedIfNotEmpty(beanParams, "dueDate",commandOptions.dueDate, true);
@@ -1198,6 +1268,32 @@ private RestResponse update() throws Exception {
return openCGAClient.getClinicalAnalysisClient().update(commandOptions.clinicalAnalyses, clinicalAnalysisUpdateParams, queryParams);
}
+ private RestResponse updateAnnotationSetsAnnotations() throws Exception {
+ logger.debug("Executing updateAnnotationSetsAnnotations in Analysis - Clinical command line");
+
+ AnalysisClinicalCommandOptions.UpdateAnnotationSetsAnnotationsCommandOptions commandOptions = analysisClinicalCommandOptions.updateAnnotationSetsAnnotationsCommandOptions;
+
+ ObjectMap queryParams = new ObjectMap();
+ queryParams.putIfNotEmpty("study", commandOptions.study);
+ queryParams.putIfNotNull("action", commandOptions.action);
+ if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
+ queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
+ }
+
+
+ ObjectMap objectMap = null;
+ if (commandOptions.jsonDataModel) {
+ RestResponse res = new RestResponse<>();
+ res.setType(QueryType.VOID);
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/annotationSets/{annotationSet}/annotations/update"));
+ return res;
+ } else if (commandOptions.jsonFile != null) {
+ objectMap = JacksonUtils.getDefaultObjectMapper()
+ .readValue(new java.io.File(commandOptions.jsonFile), ObjectMap.class);
+ }
+ return openCGAClient.getClinicalAnalysisClient().updateAnnotationSetsAnnotations(commandOptions.clinicalAnalysis, commandOptions.annotationSet, objectMap, queryParams);
+ }
+
private RestResponse info() throws Exception {
logger.debug("Executing info in Analysis - Clinical command line");
@@ -1206,6 +1302,7 @@ private RestResponse info() throws Exception {
ObjectMap queryParams = new ObjectMap();
queryParams.putIfNotEmpty("include", commandOptions.include);
queryParams.putIfNotEmpty("exclude", commandOptions.exclude);
+ queryParams.putIfNotNull("flattenAnnotations", commandOptions.flattenAnnotations);
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotNull("deleted", commandOptions.deleted);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
@@ -1233,10 +1330,9 @@ private RestResponse createInterpretation() throws Exception {
InterpretationCreateParams interpretationCreateParams = null;
if (commandOptions.jsonDataModel) {
- interpretationCreateParams = new InterpretationCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(interpretationCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/create"));
return res;
} else if (commandOptions.jsonFile != null) {
interpretationCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -1323,10 +1419,9 @@ private RestResponse updateInterpretation() throws Exception {
InterpretationUpdateParams interpretationUpdateParams = null;
if (commandOptions.jsonDataModel) {
- interpretationUpdateParams = new InterpretationUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(interpretationUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/{interpretation}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
interpretationUpdateParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java
index 2f670f539e8..33dfbc54a41 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java
@@ -72,6 +72,7 @@
*/
public class AnalysisVariantCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "variant";
public AnalysisVariantCommandOptions analysisVariantCommandOptions;
public AnalysisVariantCommandExecutor(AnalysisVariantCommandOptions analysisVariantCommandOptions) throws CatalogAuthenticationException {
@@ -308,10 +309,9 @@ private RestResponse runCircos() throws Exception {
CircosAnalysisParams circosAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- circosAnalysisParams = new CircosAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(circosAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/circos/run"));
return res;
} else if (commandOptions.jsonFile != null) {
circosAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -377,10 +377,9 @@ private RestResponse runCohortStats() throws Exception {
CohortVariantStatsAnalysisParams cohortVariantStatsAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- cohortVariantStatsAnalysisParams = new CohortVariantStatsAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cohortVariantStatsAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/cohort/stats/run"));
return res;
} else if (commandOptions.jsonFile != null) {
cohortVariantStatsAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -418,10 +417,9 @@ private RestResponse runExomiser() throws Exception {
ExomiserWrapperParams exomiserWrapperParams = null;
if (commandOptions.jsonDataModel) {
- exomiserWrapperParams = new ExomiserWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(exomiserWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/exomiser/run"));
return res;
} else if (commandOptions.jsonFile != null) {
exomiserWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -459,10 +457,9 @@ private RestResponse runExport() throws Exception {
VariantExportParams variantExportParams = null;
if (commandOptions.jsonDataModel) {
- variantExportParams = new VariantExportParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantExportParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/export/run"));
return res;
} else if (commandOptions.jsonFile != null) {
variantExportParams = JacksonUtils.getDefaultObjectMapper()
@@ -600,10 +597,9 @@ private RestResponse runFamilyQc() throws Exception {
FamilyQcAnalysisParams familyQcAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- familyQcAnalysisParams = new FamilyQcAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(familyQcAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/family/qc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
familyQcAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -660,10 +656,9 @@ private RestResponse runGatk() throws Exception {
GatkWrapperParams gatkWrapperParams = null;
if (commandOptions.jsonDataModel) {
- gatkWrapperParams = new GatkWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(gatkWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/gatk/run"));
return res;
} else if (commandOptions.jsonFile != null) {
gatkWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -699,10 +694,9 @@ private RestResponse runGenomePlot() throws Exception {
GenomePlotAnalysisParams genomePlotAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- genomePlotAnalysisParams = new GenomePlotAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(genomePlotAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/genomePlot/run"));
return res;
} else if (commandOptions.jsonFile != null) {
genomePlotAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -740,10 +734,9 @@ private RestResponse runGwas() throws Exception {
GwasAnalysisParams gwasAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- gwasAnalysisParams = new GwasAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(gwasAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/gwas/run"));
return res;
} else if (commandOptions.jsonFile != null) {
gwasAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -788,10 +781,9 @@ private RestResponse runHrDetect() throws Exception {
HRDetectAnalysisParams hRDetectAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- hRDetectAnalysisParams = new HRDetectAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(hRDetectAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/hrDetect/run"));
return res;
} else if (commandOptions.jsonFile != null) {
hRDetectAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -837,10 +829,9 @@ private RestResponse runIndex() throws Exception {
VariantIndexParams variantIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantIndexParams = new VariantIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/index/run"));
return res;
} else if (commandOptions.jsonFile != null) {
variantIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -903,10 +894,9 @@ private RestResponse runIndividualQc() throws Exception {
IndividualQcAnalysisParams individualQcAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- individualQcAnalysisParams = new IndividualQcAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(individualQcAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/individual/qc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
individualQcAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -943,10 +933,9 @@ private RestResponse runInferredSex() throws Exception {
InferredSexAnalysisParams inferredSexAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- inferredSexAnalysisParams = new InferredSexAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(inferredSexAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/inferredSex/run"));
return res;
} else if (commandOptions.jsonFile != null) {
inferredSexAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1016,10 +1005,9 @@ private RestResponse runKnockout() throws Exception {
KnockoutAnalysisParams knockoutAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- knockoutAnalysisParams = new KnockoutAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(knockoutAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/knockout/run"));
return res;
} else if (commandOptions.jsonFile != null) {
knockoutAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1062,10 +1050,9 @@ private RestResponse runMendelianError() throws Exception {
MendelianErrorAnalysisParams mendelianErrorAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- mendelianErrorAnalysisParams = new MendelianErrorAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(mendelianErrorAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/mendelianError/run"));
return res;
} else if (commandOptions.jsonFile != null) {
mendelianErrorAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1155,10 +1142,9 @@ private RestResponse runMutationalSignature() throws Exception {
MutationalSignatureAnalysisParams mutationalSignatureAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- mutationalSignatureAnalysisParams = new MutationalSignatureAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(mutationalSignatureAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/mutationalSignature/run"));
return res;
} else if (commandOptions.jsonFile != null) {
mutationalSignatureAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1207,10 +1193,9 @@ private RestResponse runPlink() throws Exception {
PlinkWrapperParams plinkWrapperParams = null;
if (commandOptions.jsonDataModel) {
- plinkWrapperParams = new PlinkWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(plinkWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/plink/run"));
return res;
} else if (commandOptions.jsonFile != null) {
plinkWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -1335,10 +1320,9 @@ private RestResponse runRelatedness() throws Exception {
RelatednessAnalysisParams relatednessAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- relatednessAnalysisParams = new RelatednessAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(relatednessAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/relatedness/run"));
return res;
} else if (commandOptions.jsonFile != null) {
relatednessAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1376,10 +1360,9 @@ private RestResponse runRvtests() throws Exception {
RvtestsWrapperParams rvtestsWrapperParams = null;
if (commandOptions.jsonDataModel) {
- rvtestsWrapperParams = new RvtestsWrapperParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(rvtestsWrapperParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/rvtests/run"));
return res;
} else if (commandOptions.jsonFile != null) {
rvtestsWrapperParams = JacksonUtils.getDefaultObjectMapper()
@@ -1450,10 +1433,9 @@ private RestResponse runSampleEligibility() throws Exception {
SampleEligibilityAnalysisParams sampleEligibilityAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- sampleEligibilityAnalysisParams = new SampleEligibilityAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleEligibilityAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/sample/eligibility/run"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleEligibilityAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1489,10 +1471,9 @@ private RestResponse runSampleQc() throws Exception {
SampleQcAnalysisParams sampleQcAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- sampleQcAnalysisParams = new SampleQcAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleQcAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/sample/qc/run"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleQcAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1590,10 +1571,9 @@ private RestResponse runSample() throws Exception {
SampleVariantFilterParams sampleVariantFilterParams = null;
if (commandOptions.jsonDataModel) {
- sampleVariantFilterParams = new SampleVariantFilterParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleVariantFilterParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/sample/run"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleVariantFilterParams = JacksonUtils.getDefaultObjectMapper()
@@ -1684,10 +1664,9 @@ private RestResponse runSampleStats() throws Exception {
SampleVariantStatsAnalysisParams sampleVariantStatsAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- sampleVariantStatsAnalysisParams = new SampleVariantStatsAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleVariantStatsAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/sample/stats/run"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleVariantStatsAnalysisParams = JacksonUtils.getDefaultObjectMapper()
@@ -1757,10 +1736,9 @@ private RestResponse runStatsExport() throws Exception {
VariantStatsExportParams variantStatsExportParams = null;
if (commandOptions.jsonDataModel) {
- variantStatsExportParams = new VariantStatsExportParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStatsExportParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/stats/export/run"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStatsExportParams = JacksonUtils.getDefaultObjectMapper()
@@ -1798,10 +1776,9 @@ private RestResponse runStats() throws Exception {
VariantStatsAnalysisParams variantStatsAnalysisParams = null;
if (commandOptions.jsonDataModel) {
- variantStatsAnalysisParams = new VariantStatsAnalysisParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStatsAnalysisParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/variant/stats/run"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStatsAnalysisParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java
index 54d3c8c3704..f2988c96834 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java
@@ -46,6 +46,7 @@
*/
public class CohortsCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "cohorts";
public CohortsCommandOptions cohortsCommandOptions;
public CohortsCommandExecutor(CohortsCommandOptions cohortsCommandOptions) throws CatalogAuthenticationException {
@@ -122,10 +123,9 @@ private RestResponse updateAcl() throws Exception {
CohortAclUpdateParams cohortAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- cohortAclUpdateParams = new CohortAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cohortAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
cohortAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -183,10 +183,9 @@ private RestResponse loadAnnotationSets() throws Exception {
TsvAnnotationParams tsvAnnotationParams = null;
if (commandOptions.jsonDataModel) {
- tsvAnnotationParams = new TsvAnnotationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tsvAnnotationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/annotationSets/load"));
return res;
} else if (commandOptions.jsonFile != null) {
tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
@@ -221,10 +220,9 @@ private RestResponse create() throws Exception {
CohortCreateParams cohortCreateParams = null;
if (commandOptions.jsonDataModel) {
- cohortCreateParams = new CohortCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cohortCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/create"));
return res;
} else if (commandOptions.jsonFile != null) {
cohortCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -307,10 +305,9 @@ private RestResponse generate() throws Exception {
CohortGenerateParams cohortGenerateParams = null;
if (commandOptions.jsonDataModel) {
- cohortGenerateParams = new CohortGenerateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cohortGenerateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/generate"));
return res;
} else if (commandOptions.jsonFile != null) {
cohortGenerateParams = JacksonUtils.getDefaultObjectMapper()
@@ -434,10 +431,9 @@ private RestResponse update() throws Exception {
CohortUpdateParams cohortUpdateParams = null;
if (commandOptions.jsonDataModel) {
- cohortUpdateParams = new CohortUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cohortUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/{cohorts}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
cohortUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -477,10 +473,9 @@ private RestResponse updateAnnotationSetsAnnotations() throws Exception
ObjectMap objectMap = null;
if (commandOptions.jsonDataModel) {
- objectMap = new ObjectMap();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(objectMap));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/cohorts/{cohort}/annotationSets/{annotationSet}/annotations/update"));
return res;
} else if (commandOptions.jsonFile != null) {
objectMap = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java
index fcac8b23c88..033aff423b5 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java
@@ -40,6 +40,7 @@
*/
public class DiseasePanelsCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "panels";
public DiseasePanelsCommandOptions diseasePanelsCommandOptions;
public DiseasePanelsCommandExecutor(DiseasePanelsCommandOptions diseasePanelsCommandOptions) throws CatalogAuthenticationException {
@@ -107,10 +108,9 @@ private RestResponse updateAcl() throws Exception {
PanelAclUpdateParams panelAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- panelAclUpdateParams = new PanelAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(panelAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/panels/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
panelAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -144,10 +144,9 @@ private RestResponse create() throws Exception {
PanelCreateParams panelCreateParams = null;
if (commandOptions.jsonDataModel) {
- panelCreateParams = new PanelCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(panelCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/panels/create"));
return res;
} else if (commandOptions.jsonFile != null) {
panelCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -223,10 +222,9 @@ private RestResponse importPanels() throws Exception {
PanelImportParams panelImportParams = null;
if (commandOptions.jsonDataModel) {
- panelImportParams = new PanelImportParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(panelImportParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/panels/import"));
return res;
} else if (commandOptions.jsonFile != null) {
panelImportParams = JacksonUtils.getDefaultObjectMapper()
@@ -345,10 +343,9 @@ private RestResponse update() throws Exception {
PanelUpdateParams panelUpdateParams = null;
if (commandOptions.jsonDataModel) {
- panelUpdateParams = new PanelUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(panelUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/panels/{panels}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
panelUpdateParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java
index b7521c2c790..c069ca9c896 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java
@@ -46,6 +46,7 @@
*/
public class FamiliesCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "families";
public FamiliesCommandOptions familiesCommandOptions;
public FamiliesCommandExecutor(FamiliesCommandOptions familiesCommandOptions) throws CatalogAuthenticationException {
@@ -120,10 +121,9 @@ private RestResponse updateAcl() throws Exception {
FamilyAclUpdateParams familyAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- familyAclUpdateParams = new FamilyAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(familyAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/families/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
familyAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -185,10 +185,9 @@ private RestResponse loadAnnotationSets() throws Exception {
TsvAnnotationParams tsvAnnotationParams = null;
if (commandOptions.jsonDataModel) {
- tsvAnnotationParams = new TsvAnnotationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tsvAnnotationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/families/annotationSets/load"));
return res;
} else if (commandOptions.jsonFile != null) {
tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
@@ -222,10 +221,9 @@ private RestResponse create() throws Exception {
FamilyCreateParams familyCreateParams = null;
if (commandOptions.jsonDataModel) {
- familyCreateParams = new FamilyCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(familyCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/families/create"));
return res;
} else if (commandOptions.jsonFile != null) {
familyCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -386,10 +384,9 @@ private RestResponse update() throws Exception {
FamilyUpdateParams familyUpdateParams = null;
if (commandOptions.jsonDataModel) {
- familyUpdateParams = new FamilyUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(familyUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/families/{families}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
familyUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -430,10 +427,9 @@ private RestResponse updateAnnotationSetsAnnotations() throws Exception
ObjectMap objectMap = null;
if (commandOptions.jsonDataModel) {
- objectMap = new ObjectMap();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(objectMap));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/families/{family}/annotationSets/{annotationSet}/annotations/update"));
return res;
} else if (commandOptions.jsonFile != null) {
objectMap = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java
index 62796417c62..350c7491ccc 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java
@@ -66,6 +66,7 @@
*/
public class FilesCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "files";
public FilesCommandOptions filesCommandOptions;
public FilesCommandExecutor(FilesCommandOptions filesCommandOptions) throws CatalogAuthenticationException {
@@ -187,10 +188,9 @@ private RestResponse updateAcl() throws Exception {
FileAclUpdateParams fileAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- fileAclUpdateParams = new FileAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
fileAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -257,10 +257,9 @@ private RestResponse loadAnnotationSets() throws Exception {
TsvAnnotationParams tsvAnnotationParams = null;
if (commandOptions.jsonDataModel) {
- tsvAnnotationParams = new TsvAnnotationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tsvAnnotationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/annotationSets/load"));
return res;
} else if (commandOptions.jsonFile != null) {
tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
@@ -298,10 +297,9 @@ private RestResponse create() throws Exception {
FileCreateParams fileCreateParams = null;
if (commandOptions.jsonDataModel) {
- fileCreateParams = new FileCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/create"));
return res;
} else if (commandOptions.jsonFile != null) {
fileCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -394,10 +392,9 @@ private RestResponse fetch() throws Exception {
FileFetch fileFetch = null;
if (commandOptions.jsonDataModel) {
- fileFetch = new FileFetch();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileFetch));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/fetch"));
return res;
} else if (commandOptions.jsonFile != null) {
fileFetch = JacksonUtils.getDefaultObjectMapper()
@@ -436,10 +433,9 @@ private RestResponse link() throws Exception {
FileLinkParams fileLinkParams = null;
if (commandOptions.jsonDataModel) {
- fileLinkParams = new FileLinkParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileLinkParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/link"));
return res;
} else if (commandOptions.jsonFile != null) {
fileLinkParams = JacksonUtils.getDefaultObjectMapper()
@@ -482,10 +478,9 @@ private RestResponse runLink() throws Exception {
FileLinkToolParams fileLinkToolParams = null;
if (commandOptions.jsonDataModel) {
- fileLinkToolParams = new FileLinkToolParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileLinkToolParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/link/run"));
return res;
} else if (commandOptions.jsonFile != null) {
fileLinkToolParams = JacksonUtils.getDefaultObjectMapper()
@@ -524,10 +519,9 @@ private RestResponse runPostlink() throws Exception {
PostLinkToolParams postLinkToolParams = null;
if (commandOptions.jsonDataModel) {
- postLinkToolParams = new PostLinkToolParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(postLinkToolParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/postlink/run"));
return res;
} else if (commandOptions.jsonFile != null) {
postLinkToolParams = JacksonUtils.getDefaultObjectMapper()
@@ -690,10 +684,9 @@ private RestResponse update() throws Exception {
FileUpdateParams fileUpdateParams = null;
if (commandOptions.jsonDataModel) {
- fileUpdateParams = new FileUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(fileUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/{files}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
fileUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -757,10 +750,9 @@ private RestResponse updateAnnotationSetsAnnotations() throws Exception {
ObjectMap objectMap = null;
if (commandOptions.jsonDataModel) {
- objectMap = new ObjectMap();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(objectMap));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/files/{file}/annotationSets/{annotationSet}/annotations/update"));
return res;
} else if (commandOptions.jsonFile != null) {
objectMap = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java
index 1516be90a6c..504ff0043b9 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java
@@ -52,6 +52,7 @@
*/
public class IndividualsCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "individuals";
public IndividualsCommandOptions individualsCommandOptions;
public IndividualsCommandExecutor(IndividualsCommandOptions individualsCommandOptions) throws CatalogAuthenticationException {
@@ -129,10 +130,9 @@ private RestResponse updateAcl() throws Exception {
IndividualAclUpdateParams individualAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- individualAclUpdateParams = new IndividualAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(individualAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/individuals/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
individualAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -200,10 +200,9 @@ private RestResponse loadAnnotationSets() throws Exception {
TsvAnnotationParams tsvAnnotationParams = null;
if (commandOptions.jsonDataModel) {
- tsvAnnotationParams = new TsvAnnotationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tsvAnnotationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/individuals/annotationSets/load"));
return res;
} else if (commandOptions.jsonFile != null) {
tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
@@ -237,10 +236,9 @@ private RestResponse create() throws Exception {
IndividualCreateParams individualCreateParams = null;
if (commandOptions.jsonDataModel) {
- individualCreateParams = new IndividualCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(individualCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/individuals/create"));
return res;
} else if (commandOptions.jsonFile != null) {
individualCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -442,10 +440,9 @@ private RestResponse update() throws Exception {
IndividualUpdateParams individualUpdateParams = null;
if (commandOptions.jsonDataModel) {
- individualUpdateParams = new IndividualUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(individualUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/individuals/{individuals}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
individualUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -512,10 +509,9 @@ private RestResponse updateAnnotationSetsAnnotations() throws Except
ObjectMap objectMap = null;
if (commandOptions.jsonDataModel) {
- objectMap = new ObjectMap();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(objectMap));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/individuals/{individual}/annotationSets/{annotationSet}/annotations/update"));
return res;
} else if (commandOptions.jsonFile != null) {
objectMap = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java
index 17b78b206b7..586f631b19d 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java
@@ -50,6 +50,7 @@
*/
public class JobsCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "jobs";
public JobsCommandOptions jobsCommandOptions;
public JobsCommandExecutor(JobsCommandOptions jobsCommandOptions) throws CatalogAuthenticationException {
@@ -128,10 +129,9 @@ private RestResponse updateAcl() throws Exception {
JobAclUpdateParams jobAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- jobAclUpdateParams = new JobAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(jobAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/jobs/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
jobAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -193,10 +193,9 @@ private RestResponse create() throws Exception {
JobCreateParams jobCreateParams = null;
if (commandOptions.jsonDataModel) {
- jobCreateParams = new JobCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(jobCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/jobs/create"));
return res;
} else if (commandOptions.jsonFile != null) {
jobCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -280,10 +279,9 @@ private RestResponse retry() throws Exception {
JobRetryParams jobRetryParams = null;
if (commandOptions.jsonDataModel) {
- jobRetryParams = new JobRetryParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(jobRetryParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/jobs/retry"));
return res;
} else if (commandOptions.jsonFile != null) {
jobRetryParams = JacksonUtils.getDefaultObjectMapper()
@@ -416,10 +414,9 @@ private RestResponse update() throws Exception {
JobUpdateParams jobUpdateParams = null;
if (commandOptions.jsonDataModel) {
- jobUpdateParams = new JobUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(jobUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/jobs/{jobs}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
jobUpdateParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/MetaCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/MetaCommandExecutor.java
index e1d64ae2d4a..0d8987f61d6 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/MetaCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/MetaCommandExecutor.java
@@ -32,6 +32,7 @@
*/
public class MetaCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "meta";
public MetaCommandOptions metaCommandOptions;
public MetaCommandExecutor(MetaCommandOptions metaCommandOptions) throws CatalogAuthenticationException {
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OpencgaCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OpencgaCommandExecutor.java
index 8360af46f00..8f935c36ff8 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OpencgaCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/OpencgaCommandExecutor.java
@@ -17,11 +17,11 @@
package org.opencb.opencga.app.cli.main.executors;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.opencb.commons.datastore.core.ObjectMap;
-import org.opencb.commons.utils.DataModelsUtils;
import org.opencb.opencga.app.cli.CommandExecutor;
import org.opencb.opencga.app.cli.GeneralCliOptions;
import org.opencb.opencga.app.cli.main.io.*;
@@ -36,6 +36,9 @@
import org.opencb.opencga.core.models.user.AuthenticationResponse;
import org.opencb.opencga.core.response.QueryType;
import org.opencb.opencga.core.response.RestResponse;
+import org.opencb.opencga.server.generator.models.RestCategory;
+import org.opencb.opencga.server.generator.models.RestEndpoint;
+import org.opencb.opencga.server.generator.models.RestParameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -221,14 +224,96 @@ public OpencgaCommandExecutor setOpenCGAClient(OpenCGAClient openCGAClient) {
return this;
}
- public String getObjectAsJSON(Object o) throws Exception {
- String jsonInString = "Data model not found.";
+ public String getObjectAsJSON(String objectCategory, String objectPath) throws Exception {
+ StringBuilder jsonInString = new StringBuilder("\n");
try {
- jsonInString = DataModelsUtils.dataModelToJsonString(o.getClass());
+ ObjectMap queryParams = new ObjectMap();
+ queryParams.putIfNotEmpty("category", objectCategory);
+ RestResponse response = openCGAClient.getMetaClient().api(queryParams);
+ ObjectMapper jsonObjectMapper = new ObjectMapper();
+ for (List list : response.getResponses().get(0).getResults()) {
+ List categories = jsonObjectMapper.convertValue(list, new TypeReference>() {});
+ for (RestCategory category : categories) {
+ for (RestEndpoint endpoint : category.getEndpoints()) {
+ if (objectPath.equals(endpoint.getPath())) {
+ boolean enc = false;
+ for (RestParameter parameter : endpoint.getParameters()) {
+ //jsonInString += parameter.getName()+":"+parameter.getAllowedValues()+"\n";
+ if (parameter.getData() != null) {
+ enc = true;
+ jsonInString.append(printBody(parameter.getData(), ""));
+ }
+ }
+ if (!enc) {
+ jsonInString.append("No model available");
+ }
+ //
+ }
+ }
+ }
+ }
} catch (Exception e) {
+ jsonInString = new StringBuilder("Data model not found.");
CommandLineUtils.error(e);
}
- return jsonInString;
+ return jsonInString.toString();
+ }
+
+ private String printBody(List data, String tabs) {
+ String res = "";
+ res += "{\n";
+ String tab = " " + tabs;
+ for (RestParameter parameter : data) {
+ if (parameter.getData() == null) {
+ res += printParameter(parameter, tab);
+ } else {
+ res += tab + parameter.getName() + "\"" + ": [" + printBody(parameter.getData(), tab) + "],\n";
+ }
+ }
+ res += tabs + "}";
+ return res;
+
+ }
+
+ private String printParameter(RestParameter parameter, String tab) {
+
+ return tab + "\"" + parameter.getName() + "\"" + ":" + printParameterValue(parameter) + ",\n";
+ }
+
+ private String printParameterValue(RestParameter parameter) {
+
+ if(!StringUtils.isEmpty(parameter.getAllowedValues())){
+ return parameter.getAllowedValues().replace(" ", "|");
+ }
+ switch (parameter.getType()) {
+ case "Boolean":
+ case "java.lang.Boolean":
+ return "false";
+ case "Long":
+ case "Float":
+ case "Double":
+ case "Integer":
+ case "int":
+ case "double":
+ case "float":
+ case "long":
+ return "0";
+ case "List":
+ return "[\"\"]";
+ case "Date":
+ return "\"dd/mm/yyyy\"";
+ case "Map":
+ return "{\"key\": \"value\"}";
+ case "String":
+ return "\"\"";
+ default:
+ return "\"-\"";
+ }
+ }
+
+ private boolean isNumeric(String type) {
+
+ return "int".equals(type) || "Long".equals(type) || "Float".equals(type) || "double".equals(type);
}
public RestResponse saveSession(String user, AuthenticationResponse response) throws ClientException, IOException {
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 494067498b1..068b4a3792a 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
@@ -56,6 +56,7 @@
*/
public class OperationsVariantStorageCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "operation";
public OperationsVariantStorageCommandOptions operationsVariantStorageCommandOptions;
public OperationsVariantStorageCommandExecutor(OperationsVariantStorageCommandOptions operationsVariantStorageCommandOptions) throws CatalogAuthenticationException {
@@ -179,10 +180,9 @@ private RestResponse configureCellbase() throws Exception {
CellBaseConfiguration cellBaseConfiguration = null;
if (commandOptions.jsonDataModel) {
- cellBaseConfiguration = new CellBaseConfiguration();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(cellBaseConfiguration));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/cellbase/configure"));
return res;
} else if (commandOptions.jsonFile != null) {
cellBaseConfiguration = JacksonUtils.getDefaultObjectMapper()
@@ -219,10 +219,9 @@ private RestResponse aggregateVariant() throws Exception {
VariantAggregateParams variantAggregateParams = null;
if (commandOptions.jsonDataModel) {
- variantAggregateParams = new VariantAggregateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantAggregateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/aggregate"));
return res;
} else if (commandOptions.jsonFile != null) {
variantAggregateParams = JacksonUtils.getDefaultObjectMapper()
@@ -274,10 +273,9 @@ private RestResponse indexVariantAnnotation() throws Exception {
VariantAnnotationIndexParams variantAnnotationIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantAnnotationIndexParams = new VariantAnnotationIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantAnnotationIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/annotation/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantAnnotationIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -316,10 +314,9 @@ private RestResponse saveVariantAnnotation() throws Exception {
VariantAnnotationSaveParams variantAnnotationSaveParams = null;
if (commandOptions.jsonDataModel) {
- variantAnnotationSaveParams = new VariantAnnotationSaveParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantAnnotationSaveParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/annotation/save"));
return res;
} else if (commandOptions.jsonFile != null) {
variantAnnotationSaveParams = JacksonUtils.getDefaultObjectMapper()
@@ -350,10 +347,9 @@ private RestResponse configureVariant() throws Exception {
VariantConfigureParams variantConfigureParams = null;
if (commandOptions.jsonDataModel) {
- variantConfigureParams = new VariantConfigureParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantConfigureParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/configure"));
return res;
} else if (commandOptions.jsonFile != null) {
variantConfigureParams = JacksonUtils.getDefaultObjectMapper()
@@ -387,10 +383,9 @@ private RestResponse deleteVariant() throws Exception {
VariantFileDeleteParams variantFileDeleteParams = null;
if (commandOptions.jsonDataModel) {
- variantFileDeleteParams = new VariantFileDeleteParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantFileDeleteParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/delete"));
return res;
} else if (commandOptions.jsonFile != null) {
variantFileDeleteParams = JacksonUtils.getDefaultObjectMapper()
@@ -425,10 +420,9 @@ private RestResponse aggregateVariantFamily() throws Exception {
VariantAggregateFamilyParams variantAggregateFamilyParams = null;
if (commandOptions.jsonDataModel) {
- variantAggregateFamilyParams = new VariantAggregateFamilyParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantAggregateFamilyParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/family/aggregate"));
return res;
} else if (commandOptions.jsonFile != null) {
variantAggregateFamilyParams = JacksonUtils.getDefaultObjectMapper()
@@ -464,10 +458,9 @@ private RestResponse indexVariantFamily() throws Exception {
VariantFamilyIndexParams variantFamilyIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantFamilyIndexParams = new VariantFamilyIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantFamilyIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/family/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantFamilyIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -504,10 +497,9 @@ private RestResponse indexVariant() throws Exception {
VariantIndexParams variantIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantIndexParams = new VariantIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -570,10 +562,9 @@ private RestResponse launcherVariantIndex() throws Exception {
VariantFileIndexJobLauncherParams variantFileIndexJobLauncherParams = null;
if (commandOptions.jsonDataModel) {
- variantFileIndexJobLauncherParams = new VariantFileIndexJobLauncherParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantFileIndexJobLauncherParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/index/launcher"));
return res;
} else if (commandOptions.jsonFile != null) {
variantFileIndexJobLauncherParams = JacksonUtils.getDefaultObjectMapper()
@@ -638,10 +629,9 @@ private RestResponse runVariantJulie() throws Exception {
JulieParams julieParams = null;
if (commandOptions.jsonDataModel) {
- julieParams = new JulieParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(julieParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/julie/run"));
return res;
} else if (commandOptions.jsonFile != null) {
julieParams = JacksonUtils.getDefaultObjectMapper()
@@ -673,10 +663,9 @@ private RestResponse repairVariantMetadata() throws Exception {
VariantStorageMetadataRepairToolParams variantStorageMetadataRepairToolParams = null;
if (commandOptions.jsonDataModel) {
- variantStorageMetadataRepairToolParams = new VariantStorageMetadataRepairToolParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStorageMetadataRepairToolParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/metadata/repair"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStorageMetadataRepairToolParams = JacksonUtils.getDefaultObjectMapper()
@@ -711,10 +700,9 @@ private RestResponse synchronizeVariantMetadata() throws Exception {
VariantStorageMetadataSynchronizeParams variantStorageMetadataSynchronizeParams = null;
if (commandOptions.jsonDataModel) {
- variantStorageMetadataSynchronizeParams = new VariantStorageMetadataSynchronizeParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStorageMetadataSynchronizeParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/metadata/synchronize"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStorageMetadataSynchronizeParams = JacksonUtils.getDefaultObjectMapper()
@@ -745,10 +733,9 @@ private RestResponse pruneVariant() throws Exception {
VariantPruneParams variantPruneParams = null;
if (commandOptions.jsonDataModel) {
- variantPruneParams = new VariantPruneParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantPruneParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/prune"));
return res;
} else if (commandOptions.jsonFile != null) {
variantPruneParams = JacksonUtils.getDefaultObjectMapper()
@@ -784,10 +771,9 @@ private RestResponse deleteVariantSample() throws Exception {
VariantSampleDeleteParams variantSampleDeleteParams = null;
if (commandOptions.jsonDataModel) {
- variantSampleDeleteParams = new VariantSampleDeleteParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantSampleDeleteParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/sample/delete"));
return res;
} else if (commandOptions.jsonFile != null) {
variantSampleDeleteParams = JacksonUtils.getDefaultObjectMapper()
@@ -823,10 +809,9 @@ private RestResponse indexVariantSample() throws Exception {
VariantSecondarySampleIndexParams variantSecondarySampleIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantSecondarySampleIndexParams = new VariantSecondarySampleIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantSecondarySampleIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/sample/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantSecondarySampleIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -861,10 +846,9 @@ private RestResponse variantSampleIndexConfigure() throws Exception {
SampleIndexConfiguration sampleIndexConfiguration = null;
if (commandOptions.jsonDataModel) {
- sampleIndexConfiguration = new SampleIndexConfiguration();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleIndexConfiguration));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/sample/index/configure"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleIndexConfiguration = JacksonUtils.getDefaultObjectMapper()
@@ -912,10 +896,9 @@ private RestResponse indexVariantScore() throws Exception {
VariantScoreIndexParams variantScoreIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantScoreIndexParams = new VariantScoreIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantScoreIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/score/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantScoreIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -955,10 +938,9 @@ private RestResponse variantSecondaryAnnotationIndex() throws Exception {
VariantSecondaryAnnotationIndexParams variantSecondaryAnnotationIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantSecondaryAnnotationIndexParams = new VariantSecondaryAnnotationIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantSecondaryAnnotationIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/secondary/annotation/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantSecondaryAnnotationIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -994,10 +976,9 @@ private RestResponse variantSecondarySampleIndex() throws Exception {
VariantSecondarySampleIndexParams variantSecondarySampleIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantSecondarySampleIndexParams = new VariantSecondarySampleIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantSecondarySampleIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/secondary/sample/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantSecondarySampleIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -1032,10 +1013,9 @@ private RestResponse configureVariantSecondarySampleIndex() throws Exceptio
SampleIndexConfiguration sampleIndexConfiguration = null;
if (commandOptions.jsonDataModel) {
- sampleIndexConfiguration = new SampleIndexConfiguration();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleIndexConfiguration));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/secondary/sample/index/configure"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleIndexConfiguration = JacksonUtils.getDefaultObjectMapper()
@@ -1063,10 +1043,9 @@ private RestResponse secondaryIndexVariant() throws Exception {
VariantSecondaryAnnotationIndexParams variantSecondaryAnnotationIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantSecondaryAnnotationIndexParams = new VariantSecondaryAnnotationIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantSecondaryAnnotationIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/secondaryIndex"));
return res;
} else if (commandOptions.jsonFile != null) {
variantSecondaryAnnotationIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -1121,10 +1100,9 @@ private RestResponse deleteVariantStats() throws Exception {
VariantStatsDeleteParams variantStatsDeleteParams = null;
if (commandOptions.jsonDataModel) {
- variantStatsDeleteParams = new VariantStatsDeleteParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStatsDeleteParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/stats/delete"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStatsDeleteParams = JacksonUtils.getDefaultObjectMapper()
@@ -1159,10 +1137,9 @@ private RestResponse indexVariantStats() throws Exception {
VariantStatsIndexParams variantStatsIndexParams = null;
if (commandOptions.jsonDataModel) {
- variantStatsIndexParams = new VariantStatsIndexParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStatsIndexParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/stats/index"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStatsIndexParams = JacksonUtils.getDefaultObjectMapper()
@@ -1201,10 +1178,9 @@ private RestResponse deleteVariantStudy() throws Exception {
VariantStudyDeleteParams variantStudyDeleteParams = null;
if (commandOptions.jsonDataModel) {
- variantStudyDeleteParams = new VariantStudyDeleteParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(variantStudyDeleteParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/operation/variant/study/delete"));
return res;
} else if (commandOptions.jsonFile != null) {
variantStudyDeleteParams = JacksonUtils.getDefaultObjectMapper()
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 e1757e59f09..b7c06afd6f6 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
@@ -38,6 +38,7 @@
*/
public class ProjectsCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "projects";
public ProjectsCommandOptions projectsCommandOptions;
public ProjectsCommandExecutor(ProjectsCommandOptions projectsCommandOptions) throws CatalogAuthenticationException {
@@ -98,10 +99,9 @@ private RestResponse create() throws Exception {
ProjectCreateParams projectCreateParams = null;
if (commandOptions.jsonDataModel) {
- projectCreateParams = new ProjectCreateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(projectCreateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/projects/create"));
return res;
} else if (commandOptions.jsonFile != null) {
projectCreateParams = JacksonUtils.getDefaultObjectMapper()
@@ -220,10 +220,9 @@ private RestResponse update() throws Exception {
ProjectUpdateParams projectUpdateParams = null;
if (commandOptions.jsonDataModel) {
- projectUpdateParams = new ProjectUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(projectUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/projects/{project}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
projectUpdateParams = JacksonUtils.getDefaultObjectMapper()
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java
index e3bd0666741..328cc9eb556 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java
@@ -51,6 +51,7 @@
*/
public class SamplesCommandExecutor extends OpencgaCommandExecutor {
+ public String categoryName = "samples";
public SamplesCommandOptions samplesCommandOptions;
public SamplesCommandExecutor(SamplesCommandOptions samplesCommandOptions) throws CatalogAuthenticationException {
@@ -127,10 +128,9 @@ private RestResponse updateAcl() throws Exception {
SampleAclUpdateParams sampleAclUpdateParams = null;
if (commandOptions.jsonDataModel) {
- sampleAclUpdateParams = new SampleAclUpdateParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(sampleAclUpdateParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/samples/acl/{members}/update"));
return res;
} else if (commandOptions.jsonFile != null) {
sampleAclUpdateParams = JacksonUtils.getDefaultObjectMapper()
@@ -195,10 +195,9 @@ private RestResponse loadAnnotationSets() throws Exception {
TsvAnnotationParams tsvAnnotationParams = null;
if (commandOptions.jsonDataModel) {
- tsvAnnotationParams = new TsvAnnotationParams();
RestResponse res = new RestResponse<>();
res.setType(QueryType.VOID);
- PrintUtils.println(getObjectAsJSON(tsvAnnotationParams));
+ PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/samples/annotationSets/load"));
return res;
} else if (commandOptions.jsonFile != null) {
tsvAnnotationParams = JacksonUtils.getDefaultObjectMapper()
@@ -231,10 +230,9 @@ private RestResponse