diff --git a/.github/workflows/manual-deploy-docker.yml b/.github/workflows/manual-deploy-docker.yml index 06cf9d51dcd..7f940c5800d 100644 --- a/.github/workflows/manual-deploy-docker.yml +++ b/.github/workflows/manual-deploy-docker.yml @@ -23,12 +23,12 @@ jobs: outputs: version: ${{ steps.get_project_version.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: '10' ref: "${{ inputs.branch }}" - name: Set up JDK 8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '8' @@ -41,7 +41,7 @@ jobs: fi - name: Maven Build (skip tests) run: mvn -T 2 clean install -DskipTests -P${{ inputs.hadoop }},RClient -Dopencga.war.name=opencga -Dcheckstyle.skip - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: build-folder path: build diff --git a/.github/workflows/manual-deploy-ext-tools.yml b/.github/workflows/manual-deploy-ext-tools.yml index 1fec5a627df..63e61914ea0 100644 --- a/.github/workflows/manual-deploy-ext-tools.yml +++ b/.github/workflows/manual-deploy-ext-tools.yml @@ -23,12 +23,12 @@ jobs: outputs: version: ${{ steps.get_project_version.outputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: '10' ref: "${{ inputs.branch }}" - name: Set up JDK 8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '8' @@ -41,7 +41,7 @@ jobs: fi - name: Maven Build (skip tests) run: mvn -T 2 clean install -DskipTests - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: build-folder path: build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93b011f556f..86bcb471976 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: uses: opencb/java-common-libs/.github/workflows/deploy-docker-hub-workflow.yml@develop needs: build with: - cli: python3 ./build/cloud/docker/docker-build.py push --images base,init + cli: python3 ./build/cloud/docker/docker-build.py push --images base,init --tag ${{ needs.build.outputs.version }} secrets: inherit deploy-python: diff --git a/opencga-analysis/pom.xml b/opencga-analysis/pom.xml index 896632402e1..a82fde15ccc 100644 --- a/opencga-analysis/pom.xml +++ b/opencga-analysis/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml @@ -287,6 +287,12 @@ ${jetty-for-hadoop-test.version} test + + org.eclipse.jetty.http2 + http2-hpack + ${jetty-for-hadoop-test.version} + test + org.eclipse.jetty jetty-io diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/AnalysisUtils.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/AnalysisUtils.java index 5db2a91f0a7..ec0206e8695 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/AnalysisUtils.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/AnalysisUtils.java @@ -12,7 +12,9 @@ import org.opencb.opencga.core.models.job.Job; import org.opencb.opencga.core.response.OpenCGAResult; -import java.io.*; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; import java.nio.file.Path; import java.util.*; @@ -46,6 +48,26 @@ public static File getBamFileBySampleId(String sampleId, String studyId, FileMan return (fileQueryResult.getNumResults() == 0) ? null : fileQueryResult.first(); } + public static File getBwFileBySampleId(String sampleId, String studyId, FileManager fileManager, String token) throws ToolException { + // Look for the bam file for each sample + OpenCGAResult fileQueryResult; + + Query query = new Query(FileDBAdaptor.QueryParams.FORMAT.key(), File.Format.BIGWIG) + .append(FileDBAdaptor.QueryParams.SAMPLE_IDS.key(), sampleId); + try { + fileQueryResult = fileManager.search(studyId, query, QueryOptions.empty(), token); + } catch (CatalogException e) { + throw new ToolException(e); + } + + // Sanity check + if (fileQueryResult.getNumResults() > 1) { + throw new ToolException("Found more than one BIGWIG files (" + fileQueryResult.getNumResults() + ") for sample " + sampleId); + } + + return (fileQueryResult.getNumResults() == 0) ? null : fileQueryResult.first(); + } + public static File getBamFile(String filename, String sampleId, String studyId, FileManager fileManager, String token) throws ToolException { // Look for the bam file for each sample OpenCGAResult fileQueryResult; diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentAnalysisUtils.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentAnalysisUtils.java new file mode 100644 index 00000000000..c1933c0e65d --- /dev/null +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentAnalysisUtils.java @@ -0,0 +1,63 @@ +/* + * 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.alignment; + +import org.opencb.opencga.catalog.exceptions.CatalogException; +import org.opencb.opencga.catalog.managers.CatalogManager; +import org.opencb.opencga.core.exceptions.ToolException; +import org.opencb.opencga.core.models.file.*; +import org.opencb.opencga.core.response.OpenCGAResult; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; + +public class AlignmentAnalysisUtils { + + public static File linkAndUpdate(File bamCatalogFile, Path outPath, String jobId, String study, CatalogManager catalogManager, String token) + throws CatalogException, ToolException { + // Link BW file and update sample info + FileLinkParams fileLinkParams = new FileLinkParams() + .setUri(outPath.toString()) + .setPath(Paths.get(jobId).resolve(outPath.getFileName()).toString()); + OpenCGAResult fileResult = catalogManager.getFileManager().link(study, fileLinkParams, true, token); + if (fileResult.getNumResults() != 1) { + throw new ToolException("It could not link OpenCGA file catalog file for '" + outPath + "'"); + } + File outCatalogFile = fileResult.first(); + + // Updating file: samples, related file + FileUpdateParams updateParams = new FileUpdateParams() + .setSampleIds(bamCatalogFile.getSampleIds()) + .setRelatedFiles(Collections.singletonList(new SmallRelatedFileParams() + .setFile(bamCatalogFile.getId()) + .setRelation(FileRelatedFile.Relation.ALIGNMENT))); + try { + OpenCGAResult updateResult = catalogManager.getFileManager().update(study, outCatalogFile.getId(), updateParams, null, + token); + if (updateResult.getNumUpdated() != 1) { + catalogManager.getFileManager().unlink(study, outCatalogFile.getId(), token); + throw new ToolException("It could not update OpenCGA file catalog (" + outCatalogFile.getId() + + ") from alignment file ID '" + bamCatalogFile.getId() + "'"); + } + } catch (CatalogException e) { + catalogManager.getFileManager().unlink(study, outCatalogFile.getId(), token); + throw e; + } + return outCatalogFile; + } +} diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentConstants.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentConstants.java new file mode 100644 index 00000000000..5b14d140a3b --- /dev/null +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentConstants.java @@ -0,0 +1,26 @@ +/* + * 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.alignment; + +public class AlignmentConstants { + + public static final String BAM_EXTENSION = ".bam"; + public static final String BAI_EXTENSION = ".bai"; + public static final String CRAM_EXTENSION = ".cram"; + public static final String CRAI_EXTENSION = ".crai"; + public static final String BIGWIG_EXTENSION = ".bw"; +} diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentCoverageAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentCoverageAnalysis.java index fca5b6a8b16..2712d22b8f3 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentCoverageAnalysis.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentCoverageAnalysis.java @@ -16,21 +16,18 @@ package org.opencb.opencga.analysis.alignment; -import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; -import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.tools.OpenCgaToolScopeStudy; import org.opencb.opencga.analysis.wrappers.deeptools.DeeptoolsWrapperAnalysisExecutor; -import org.opencb.opencga.catalog.exceptions.CatalogException; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.alignment.CoverageIndexParams; import org.opencb.opencga.core.models.common.Enums; import org.opencb.opencga.core.models.file.File; -import org.opencb.opencga.core.response.OpenCGAResult; import org.opencb.opencga.core.tools.annotations.Tool; import org.opencb.opencga.core.tools.annotations.ToolParams; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; @@ -42,18 +39,17 @@ @Tool(id = AlignmentCoverageAnalysis.ID, resource = Enums.Resource.ALIGNMENT, description = "Alignment coverage analysis.") public class AlignmentCoverageAnalysis extends OpenCgaToolScopeStudy { - public final static String ID = "coverage-index-run"; - public final static String DESCRIPTION = "Compute the coverage from a given alignment file, e.g., create a .bw file from a .bam file"; + public static final String ID = "coverage-index-run"; + public static final String DESCRIPTION = "Compute the coverage from a given alignment file, e.g., create a " + + AlignmentConstants.BIGWIG_EXTENSION + " file from a " + AlignmentConstants.BAM_EXTENSION + " file"; @ToolParams protected final CoverageIndexParams coverageParams = new CoverageIndexParams(); private File bamCatalogFile; - private Path inputPath; - - private Path bwCatalogPath; - private Path outputPath; + private File baiCatalogFile; + @Override protected void check() throws Exception { super.check(); @@ -62,42 +58,58 @@ protected void check() throws Exception { throw new ToolException("Missing study when computing alignment coverage"); } - OpenCGAResult fileResult; + // Checking BAM file ID try { - logger.info("{}: checking file {}", ID, coverageParams.getFile()); - fileResult = catalogManager.getFileManager().get(getStudy(), coverageParams.getFile(), QueryOptions.empty(), getToken()); - } catch (CatalogException e) { - throw new ToolException("Error accessing file '" + coverageParams.getFile() + "' of the study " + getStudy() + "'", e); + bamCatalogFile = catalogManager.getFileManager().get(getStudy(), coverageParams.getBamFileId(), QueryOptions.empty(), + getToken()).first(); + if (bamCatalogFile == null) { + throw new ToolException("Could not find BAM file from ID '" + coverageParams.getBamFileId() + "'"); + } + } catch (Exception e) { + throw new ToolException("Could not get BAM file from ID " + coverageParams.getBamFileId()); } - if (fileResult.getNumResults() <= 0) { - throw new ToolException("File '" + coverageParams.getFile() + "' not found in study '" + getStudy() + "'"); + + // Check if the input file is .bam + if (!bamCatalogFile.getName().endsWith(AlignmentConstants.BAM_EXTENSION)) { + throw new ToolException("Invalid input alignment file '" + coverageParams.getBamFileId() + "' (" + bamCatalogFile.getName() + + "): it must be in BAM format"); } - bamCatalogFile = fileResult.getResults().get(0); - inputPath = Paths.get(bamCatalogFile.getUri()); - String filename = inputPath.getFileName().toString(); + // Getting BAI file + String baiFileId = coverageParams.getBaiFileId(); + if (StringUtils.isEmpty(baiFileId)) { + // BAI file ID was not provided, looking for it + logger.info("BAI file ID was not provided, getting it from the internal alignment index of the BAM file ID {}", + bamCatalogFile.getId()); + try { + baiFileId = bamCatalogFile.getInternal().getAlignment().getIndex().getFileId(); + } catch (Exception e) { + throw new ToolException("Could not get internal alignment index file Id from BAM file ID '" + bamCatalogFile.getId()); + } + } + try { + baiCatalogFile = catalogManager.getFileManager().get(getStudy(), baiFileId, QueryOptions.empty(), getToken()).first(); + if (baiCatalogFile == null) { + throw new ToolException("Could not find BAI file from ID '" + coverageParams.getBaiFileId() + "'"); + } + } catch (Exception e) { + throw new ToolException("Could not get BAI file from file ID " + baiFileId); + } - // Check if the input file is .bam - if (!filename.endsWith(".bam")) { - throw new ToolException("Invalid input alignment file '" + coverageParams.getFile() + "': it must be in BAM format"); + logger.info("BAI file ID = {}; path = {}", baiCatalogFile.getId(), Paths.get(baiCatalogFile.getUri())); + + // Checking filenames + if (!baiCatalogFile.getName().equals(bamCatalogFile.getName() + AlignmentConstants.BAI_EXTENSION)) { + throw new ToolException("Filenames mismatch, BAI file name must consist of BAM file name plus the extension " + + AlignmentConstants.BAI_EXTENSION + "; BAM filename = " + bamCatalogFile.getName() + ", BAI filename = " + + baiCatalogFile.getName()); } // Sanity check: window size - logger.info("{}: checking window size {}", ID, coverageParams.getWindowSize()); + logger.info("Checking window size {}", coverageParams.getWindowSize()); if (coverageParams.getWindowSize() <= 0) { coverageParams.setWindowSize(Integer.parseInt(COVERAGE_WINDOW_SIZE_DEFAULT)); - logger.info("{}: window size is set to {}", ID, coverageParams.getWindowSize()); - } - - // Path where the BW file will be created - outputPath = getOutDir().resolve(filename + ".bw"); - - // Check if BW exists already, and then check the flag 'overwrite' - bwCatalogPath = Paths.get(inputPath.toFile().getParent()).resolve(outputPath.getFileName()); - if (bwCatalogPath.toFile().exists() && !coverageParams.isOverwrite()) { - // Nothing to do - throw new ToolException("Nothing to do: coverage file (" + bwCatalogPath + ") already exists and you set the flag 'overwrite'" - + " to false"); + logger.info("Window size is set to {}", coverageParams.getWindowSize()); } } @@ -105,12 +117,30 @@ protected void check() throws Exception { protected void run() throws Exception { setUpStorageEngineExecutor(study); - logger.info("{}: running with parameters {}", ID, coverageParams); + logger.info("Running with parameters {}", coverageParams); step(() -> { + + // Path where the BW file will be created + Path bwPath = getOutDir().resolve(bamCatalogFile.getName() + AlignmentConstants.BIGWIG_EXTENSION); + + // In order to run "deeptools bamCoverage", both BAM and BAI files must be located in the same folder + // Check if both BAM and BAI files are located in the same folder otherwise these files will symbolic-link temporarily + // in the job dir to compute the BW file; then BAM and BAI symbolic links will be deleted from the job dir + Path bamPath = Paths.get(bamCatalogFile.getUri()).toAbsolutePath(); + Path baiPath = Paths.get(baiCatalogFile.getUri()).toAbsolutePath(); + if (!bamPath.getParent().toString().equals(baiPath.getParent().toString())) { + logger.info("BAM and BAI files must be symbolic-linked in the job dir since they are in different directories: {} and {}", + bamPath, baiPath); + bamPath = getOutDir().resolve(bamCatalogFile.getName()).toAbsolutePath(); + baiPath = getOutDir().resolve(baiCatalogFile.getName()).toAbsolutePath(); + Files.createSymbolicLink(bamPath, Paths.get(bamCatalogFile.getUri()).toAbsolutePath()); + Files.createSymbolicLink(baiPath, Paths.get(baiCatalogFile.getUri()).toAbsolutePath()); + } + Map bamCoverageParams = new HashMap<>(); - bamCoverageParams.put("b", inputPath.toAbsolutePath().toString()); - bamCoverageParams.put("o", outputPath.toAbsolutePath().toString()); + bamCoverageParams.put("b", bamPath.toString()); + bamCoverageParams.put("o", bwPath.toAbsolutePath().toString()); bamCoverageParams.put("binSize", String.valueOf(coverageParams.getWindowSize())); bamCoverageParams.put("outFileFormat", "bigwig"); bamCoverageParams.put("minMappingQuality", "20"); @@ -124,38 +154,39 @@ protected void run() throws Exception { .setCommand("bamCoverage") .execute(); - // Check execution result - if (!outputPath.toFile().exists()) { - new ToolException("Something wrong happened running a coverage: BigWig file (" + outputPath.toFile().getName() - + ") was not create, please, check log files."); + // Remove symbolic links if necessary + if (getOutDir().resolve(bamCatalogFile.getName()).toFile().exists()) { + Files.delete(getOutDir().resolve(bamCatalogFile.getName())); + } + if (getOutDir().resolve(baiCatalogFile.getName()).toFile().exists()) { + Files.delete(getOutDir().resolve(baiCatalogFile.getName())); } - // Move the BW file to the same directory where the BAM file is located - logger.info("{}: moving coverage file {} to the same directory where the BAM file is located", ID, - bwCatalogPath.toFile().getName()); - if (bwCatalogPath.toFile().exists()) { - bwCatalogPath.toFile().delete(); + // Check execution result + if (!bwPath.toFile().exists()) { + throw new ToolException("Something wrong happened running a coverage: BigWig file (" + bwPath.toFile().getName() + + ") was not create, please, check log files."); } - FileUtils.moveFile(outputPath.toFile(), bwCatalogPath.toFile()); - // And finally, link the BW file is necessary - boolean isLinked = true; - Path outputCatalogPath = Paths.get(bamCatalogFile.getPath()).getParent().resolve(outputPath.getFileName()); - OpenCGAResult fileResult; + // Try to copy the BW file into the BAM file directory + Path targetPath = Paths.get(bamCatalogFile.getUri()).getParent().resolve(bwPath.getFileName()); try { - fileResult = catalogManager.getFileManager().get(getStudy(), outputCatalogPath.toString(), QueryOptions.empty(), - getToken()); - if (fileResult.getNumResults() <= 0) { - isLinked = false; - } - } catch (CatalogException e) { - isLinked = false; + Files.move(bwPath, targetPath); + } catch (Exception e) { + // Do nothing + logger.info("Moving from {} to {}: {}", bwPath, targetPath, e.getMessage()); } - if (!isLinked) { - logger.info("{}: linking file {} in catalog", ID, bwCatalogPath.toFile().getName()); - catalogManager.getFileManager().link(getStudy(), bwCatalogPath.toUri(), outputCatalogPath.getParent().toString(), - new ObjectMap("parents", true), getToken()); + + if (targetPath.toFile().exists()) { + bwPath = targetPath; + logger.info("Coverage file was copied into the BAM folder: {}", bwPath); + } else { + logger.info("Couldn't copy the coverage file into the BAM folder. The coverage file is in the job folder instead: {}", + bwPath); } + + // Link generated BIGWIG file and update samples info + AlignmentAnalysisUtils.linkAndUpdate(bamCatalogFile, bwPath, getJobId(), study, catalogManager, token); }); } } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentIndexOperation.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentIndexOperation.java index 723ca02e16e..f21986c2174 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentIndexOperation.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentIndexOperation.java @@ -16,35 +16,35 @@ package org.opencb.opencga.analysis.alignment; -import org.apache.commons.io.FileUtils; import org.opencb.biodata.tools.alignment.BamManager; -import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.tools.OpenCgaTool; import org.opencb.opencga.catalog.exceptions.CatalogException; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.common.Enums; -import org.opencb.opencga.core.models.file.File; +import org.opencb.opencga.core.models.common.InternalStatus; +import org.opencb.opencga.core.models.file.*; import org.opencb.opencga.core.response.OpenCGAResult; import org.opencb.opencga.core.tools.annotations.Tool; +import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @Tool(id = AlignmentIndexOperation.ID, resource = Enums.Resource.ALIGNMENT, description = "Index alignment.") public class AlignmentIndexOperation extends OpenCgaTool { - public final static String ID = "alignment-index-run"; - public final static String DESCRIPTION = "Index a given alignment file, e.g., create a .bai file from a .bam file"; + public static final String ID = "alignment-index-run"; + public static final String DESCRIPTION = "Index a given alignment file, e.g., create a .bai file from a .bam file"; private String study; private String inputFile; - private boolean overwrite; private File inputCatalogFile; private Path inputPath; private Path outputPath; + @Override protected void check() throws Exception { super.check(); @@ -63,50 +63,52 @@ protected void check() throws Exception { String filename = inputPath.getFileName().toString(); // Check if the input file is .bam or .cram - if (!filename.endsWith(".bam") && !filename.endsWith(".cram")) { + if (!filename.endsWith(AlignmentConstants.BAM_EXTENSION) && !filename.endsWith(AlignmentConstants.CRAM_EXTENSION)) { throw new ToolException("Invalid input alignment file '" + inputFile + "': it must be in BAM or CRAM format"); } - outputPath = getOutDir().resolve(filename + (filename.endsWith(".bam") ? ".bai" : ".crai")); + outputPath = getOutDir().resolve(filename + (filename.endsWith(AlignmentConstants.BAM_EXTENSION) + ? AlignmentConstants.BAI_EXTENSION : AlignmentConstants.CRAI_EXTENSION)); } @Override protected void run() throws Exception { step(ID, () -> { - - Path indexPath = Paths.get(inputPath.toFile().getParent()).resolve(outputPath.getFileName()); - if (overwrite || !indexPath.toFile().exists()) { - // Compute index if necessary - BamManager bamManager = new BamManager(inputPath); - bamManager.createIndex(outputPath); - bamManager.close(); - - if (!outputPath.toFile().exists()) { - throw new ToolException("Something wrong happened when computing index file for '" + inputFile + "'"); - } - - if (indexPath.toFile().exists()) { - indexPath.toFile().delete(); - } - FileUtils.moveFile(outputPath.toFile(), indexPath.toFile()); + // Compute index if necessary + logger.info("Computing alignment index for {}", inputPath); + BamManager bamManager = new BamManager(inputPath); + bamManager.createIndex(outputPath); + bamManager.close(); + + if (!outputPath.toFile().exists()) { + throw new ToolException("Something wrong happened when computing index file for '" + inputFile + "'"); } - boolean isLinked = true; - Path outputCatalogPath = Paths.get(inputCatalogFile.getPath()).getParent().resolve(outputPath.getFileName()); - OpenCGAResult fileResult; + // Try to copy the BAI file into the BAM file directory + Path targetPath = inputPath.getParent().resolve(outputPath.getFileName()); try { - fileResult = catalogManager.getFileManager().get(getStudy(), outputCatalogPath.toString(), QueryOptions.empty(), token); - if (fileResult.getNumResults() <= 0) { - isLinked = false; - } - } catch (CatalogException e) { - isLinked = false; + Files.move(outputPath, targetPath); + } catch (Exception e) { + // Do nothing + logger.info("Moving from {} to {}: {}", outputPath, targetPath, e.getMessage()); } - if (!isLinked) { - catalogManager.getFileManager().link(getStudy(), indexPath.toUri(), outputCatalogPath.getParent().toString(), - new ObjectMap("parents", true), token); + + if (targetPath.toFile().exists()) { + outputPath = targetPath; + logger.info("Alignment index file was copied into the BAM folder: {}", outputPath); + } else { + logger.info("Couldn't copy the alignment index file into the BAM folder. The index file is in the job folder instead: {}", + outputPath); } + + // Link generated BAI file and update samples info, related file + File baiCatalogFile = AlignmentAnalysisUtils.linkAndUpdate(inputCatalogFile, outputPath, getJobId(), study, catalogManager, token); + + // Update BAM file internal in order to set the alignment index (BAI) + FileInternalAlignmentIndex fileAlignmentIndex = new FileInternalAlignmentIndex(new InternalStatus(InternalStatus.READY), + baiCatalogFile.getId(), "HTSJDK library"); + catalogManager.getFileManager().updateFileInternalAlignmentIndex(study, inputCatalogFile, fileAlignmentIndex, token); }); } @@ -127,13 +129,4 @@ public AlignmentIndexOperation setInputFile(String inputFile) { this.inputFile = inputFile; return this; } - - public boolean isOverwrite() { - return overwrite; - } - - public AlignmentIndexOperation setOverwrite(boolean overwrite) { - this.overwrite = overwrite; - return this; - } } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java index 3f75b28abbb..7c3396cb48e 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/alignment/AlignmentStorageManager.java @@ -92,7 +92,7 @@ public AlignmentStorageManager(CatalogManager catalogManager, StorageEngineFacto // INDEX //------------------------------------------------------------------------- - public void index(String study, String inputFile, boolean overwrite, String outdir, String token) throws ToolException { + public void index(String study, String inputFile, String outdir, String token) throws ToolException { ObjectMap params = new ObjectMap(); AlignmentIndexOperation indexOperation = new AlignmentIndexOperation(); @@ -100,7 +100,6 @@ public void index(String study, String inputFile, boolean overwrite, String outd indexOperation.setStudy(study); indexOperation.setInputFile(inputFile); - indexOperation.setOverwrite(overwrite); indexOperation.start(); } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/family/qc/FamilyQcAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/family/qc/FamilyQcAnalysis.java index 1fc2f5bfb5e..febc214e9e7 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/family/qc/FamilyQcAnalysis.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/family/qc/FamilyQcAnalysis.java @@ -24,6 +24,7 @@ import org.opencb.opencga.analysis.variant.relatedness.RelatednessAnalysis; import org.opencb.opencga.catalog.exceptions.CatalogException; import org.opencb.opencga.catalog.utils.CatalogFqn; + import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.JwtPayload; import org.opencb.opencga.core.models.common.Enums; diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcAnalysis.java index e6c20fba373..b8eb489031d 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcAnalysis.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcAnalysis.java @@ -20,15 +20,18 @@ import org.apache.commons.lang3.StringUtils; import org.opencb.biodata.models.clinical.qc.InferredSexReport; import org.opencb.commons.datastore.core.QueryOptions; -import org.opencb.opencga.analysis.AnalysisUtils; import org.opencb.opencga.analysis.tools.OpenCgaTool; +import org.opencb.opencga.analysis.variant.inferredSex.InferredSexAnalysis; import org.opencb.opencga.catalog.exceptions.CatalogException; + +import org.opencb.opencga.catalog.managers.CatalogManager; + import org.opencb.opencga.catalog.utils.CatalogFqn; + import org.opencb.opencga.core.common.JacksonUtils; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.JwtPayload; import org.opencb.opencga.core.models.common.Enums; -import org.opencb.opencga.core.models.file.File; import org.opencb.opencga.core.models.individual.Individual; import org.opencb.opencga.core.models.individual.IndividualQualityControl; import org.opencb.opencga.core.models.individual.IndividualUpdateParams; @@ -66,11 +69,11 @@ public class IndividualQcAnalysis extends OpenCgaTool { private Sample sample; private String motherSampleId; private String fatherSampleId; - private Map karyotypicSexThresholds; private IndividualQualityControl qualityControl; private IndividualQcAnalysisExecutor executor; public IndividualQcAnalysis() { + super(); } @Override @@ -82,6 +85,11 @@ protected void check() throws Exception { throw new ToolException("Missing study ID."); } + // Set default inferred sex method, if empty + if (StringUtils.isEmpty(inferredSexMethod)) { + inferredSexMethod = COVERAGE_RATIO_INFERRED_SEX_METHOD; + } + // Check permissions try { Study study = catalogManager.getStudyManager().get(studyId, QueryOptions.empty(), token).first(); @@ -95,10 +103,10 @@ protected void check() throws Exception { throw new ToolException(e); } + // Main check (this function is shared with the endpoint individual/qc/run) + checkParameters(individualId, sampleId, inferredSexMethod, studyId, catalogManager, token); + // Get individual - if (StringUtils.isEmpty(individualId)) { - throw new ToolException("Missing individual ID."); - } individual = IndividualQcUtils.getIndividualById(studyId, individualId, catalogManager, token); // Get samples of that individual, but only germline samples @@ -109,22 +117,18 @@ protected void check() throws Exception { throw new ToolException("Germline sample not found for individual '" + individualId + "'"); } - if (childGermlineSamples.size() > 1) { - if (StringUtils.isNotEmpty(sampleId)) { - for (Sample germlineSample : childGermlineSamples) { - if (sampleId.equals(germlineSample.getId())) { - sample = germlineSample; - break; - } - } - if (sample == null) { - throw new ToolException("The provided sample '" + sampleId + "' not found in the individual '" + individualId + "'"); + if (StringUtils.isNotEmpty(sampleId)) { + for (Sample germlineSample : childGermlineSamples) { + if (sampleId.equals(germlineSample.getId())) { + sample = germlineSample; + break; } - } else { - // If multiple germline samples, we take the first one - sample = childGermlineSamples.get(0); + } + if (sample == null) { + throw new ToolException("The provided sample '" + sampleId + "' not found in the individual '" + individualId + "'"); } } else { + // If multiple germline samples, we take the first one sample = childGermlineSamples.get(0); } @@ -143,10 +147,6 @@ protected void check() throws Exception { fatherSampleId = fatherGermlineSamples.get(0).getId(); } } - - if (StringUtils.isEmpty(inferredSexMethod)) { - inferredSexMethod = COVERAGE_RATIO_INFERRED_SEX_METHOD; - } } @Override @@ -181,8 +181,8 @@ protected void run() throws ToolException { .setInferredSexMethod(inferredSexMethod) .setQualityControl(qualityControl); - step(INFERRED_SEX_STEP, () -> runInferredSex()); - step(MENDELIAN_ERRORS_STEP, () -> runMendelianError()); + step(INFERRED_SEX_STEP, this::runInferredSex); + step(MENDELIAN_ERRORS_STEP, this::runMendelianError); // Finally, update individual quality control try { @@ -201,38 +201,23 @@ private void runInferredSex() throws ToolException { if (CollectionUtils.isNotEmpty(qualityControl.getInferredSexReports())) { for (InferredSexReport inferredSexReport : qualityControl.getInferredSexReports()) { if (inferredSexReport.getMethod().equals(inferredSexMethod)) { - addWarning("Skipping inferred sex: it was already computed using method '" + inferredSexMethod + "'"); + String msg = "Skipping inferred sex: it was already computed using method '" + inferredSexMethod + "'"; + logger.warn(msg); + addWarning(msg); return; } } } - if (!COVERAGE_RATIO_INFERRED_SEX_METHOD.equals(inferredSexMethod)) { - addWarning("Skipping inferred sex: unknown inferred sex method '" + inferredSexMethod + "'. Please, use '" - + COVERAGE_RATIO_INFERRED_SEX_METHOD + "'"); - return; - } - - File inferredSexBamFile; - try { - inferredSexBamFile = AnalysisUtils.getBamFileBySampleId(sample.getId(), studyId, - getVariantStorageManager().getCatalogManager().getFileManager(), getToken()); - } catch (ToolException e) { - throw new ToolException(e); - } - - if (inferredSexBamFile == null) { - addWarning("Skipping inferred sex: BAM file not found for sample '" + sample.getId() + "' of individual '" + - individual.getId() + "'"); - return; - } - + Map karyotypicSexThresholds; + Path thresholdsPath = getOpencgaHome().resolve("analysis").resolve(ID).resolve("karyotypic_sex_thresholds.json"); try { - Path thresholdsPath = getOpencgaHome().resolve("analysis").resolve(ID).resolve("karyotypic_sex_thresholds.json"); karyotypicSexThresholds = JacksonUtils.getDefaultNonNullObjectMapper().readerFor(Map.class).readValue(thresholdsPath.toFile()); } catch (IOException e) { - addWarning("Skipping inferred sex: something wrong happened when loading the karyotypic sex thresholds file" - + " (karyotypic_sex_thresholds.json)"); + String msg = "Skipping inferred sex: something wrong happened when loading the karyotypic sex thresholds file: " + + thresholdsPath.toAbsolutePath(); + logger.warn(msg); + addWarning(msg); return; } executor.setQcType(IndividualQcAnalysisExecutor.QcType.INFERRED_SEX) @@ -242,25 +227,54 @@ private void runInferredSex() throws ToolException { private void runMendelianError() throws ToolException { if (CollectionUtils.isNotEmpty(qualityControl.getMendelianErrorReports())) { - addWarning("Skipping mendelian error: it was already computed"); + String msg = "Skipping mendelian error: it was already computed"; + logger.warn(msg); + addWarning(msg); return; } // Sanity check if (sample == null || StringUtils.isEmpty(sample.getId())) { - addWarning("Skipping mendelian error: missing child sample ID."); + String msg = "Skipping mendelian error: missing child sample ID"; + logger.warn(msg); + addWarning(msg); return; } if (StringUtils.isEmpty(motherSampleId) && StringUtils.isEmpty(fatherSampleId)) { - addWarning("Skipping mendelian error: both mother and father sample IDs are empty but in order to compute mendelian" - + " errors at least one of them has to be not empty."); + String msg = "Skipping mendelian error: both mother and father sample IDs are empty but in order to compute mendelian" + + " errors at least one of them has to be not empty"; + logger.warn(msg); + addWarning(msg); return; } executor.setQcType(IndividualQcAnalysisExecutor.QcType.MENDELIAN_ERRORS).execute(); } + public static void checkParameters(String individualId, String sampleId, String inferredSexMethod, String studyId, + CatalogManager catalogManager, String token) throws ToolException, CatalogException { + // Check permissions + try { + Study study = catalogManager.getStudyManager().get(studyId, QueryOptions.empty(), token).first(); + JwtPayload jwtPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyId, jwtPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = jwtPayload.getUserId(organizationId); + catalogManager.getAuthorizationManager().checkStudyPermission(organizationId, study.getUid(), userId, WRITE_INDIVIDUALS); + } catch (CatalogException e) { + throw new ToolException(e); + } + + if (StringUtils.isNotEmpty(inferredSexMethod) && !inferredSexMethod.equals(COVERAGE_RATIO_INFERRED_SEX_METHOD)) { + throw new ToolException("Unknown inferred sex method: '" + inferredSexMethod + "'. Valid values: " + + COVERAGE_RATIO_INFERRED_SEX_METHOD); + } + + // Check inferred sex analysis parameters + InferredSexAnalysis.checkParameters(individualId, sampleId, studyId, catalogManager, token); + } + public String getStudyId() { return studyId; } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcLocalAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcLocalAnalysisExecutor.java index 26540fc5e05..362d5a25a89 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcLocalAnalysisExecutor.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/IndividualQcLocalAnalysisExecutor.java @@ -16,8 +16,6 @@ package org.opencb.opencga.analysis.individual.qc; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; import org.apache.commons.collections4.MapUtils; import org.opencb.biodata.models.clinical.qc.InferredSexReport; import org.opencb.biodata.models.clinical.qc.MendelianErrorReport; @@ -54,26 +52,28 @@ public void run() throws ToolException { runInferredSex(); break; } - case MENDELIAN_ERRORS: { runMendelianErrors(); break; } + default: { + throw new ToolException("Unknown individual QC: '" + qcType + "'"); + } } } private void runInferredSex() throws ToolException { - File inferredSexBamFile; + File bwFile; try { - inferredSexBamFile = AnalysisUtils.getBamFileBySampleId(sampleId, studyId, - getVariantStorageManager().getCatalogManager().getFileManager(), getToken()); + bwFile = AnalysisUtils.getBwFileBySampleId(sampleId, studyId, getVariantStorageManager().getCatalogManager().getFileManager(), + getToken()); } catch (ToolException e) { addWarning("Skipping inferred sex: " + e.getMessage()); return; } - if (inferredSexBamFile == null) { - addWarning("Skipping inferred sex: BAM file not found for sample '" + sampleId + "' of individual '" + + if (bwFile == null) { + addWarning("Skipping inferred sex: BIGWIG file not found for sample '" + sampleId + "' of individual '" + individual.getId() + "'"); return; } @@ -91,7 +91,7 @@ private void runInferredSex() throws ToolException { // Infer the sex for that sample // Compute ratios: X-chrom / autosomic-chroms and Y-chrom / autosomic-chroms - double[] ratios = InferredSexComputation.computeRatios(studyId, inferredSexBamFile, assembly, alignmentStorageManager, getToken()); + double[] ratios = InferredSexComputation.computeRatios(studyId, bwFile, assembly, alignmentStorageManager, getToken()); // Infer sex from ratios double xAuto = ratios[0]; @@ -109,8 +109,8 @@ private void runInferredSex() throws ToolException { values.put("ratioY", yAuto); // Set inferred sex report (individual fields will be set later) - qualityControl.getInferredSexReports().add(new InferredSexReport(sampleId, "CoverageRatio", inferredKaryotypicSex, values, - Collections.emptyList())); + qualityControl.getInferredSexReports().add(new InferredSexReport(sampleId, COVERAGE_RATIO_INFERRED_SEX_METHOD, + inferredKaryotypicSex, values, Collections.singletonList(bwFile.getId()))); } private void runMendelianErrors() throws ToolException { @@ -129,7 +129,6 @@ private void runMendelianErrors() throws ToolException { qualityControl.setMendelianErrorReports(Collections.singletonList(mendelianErrorReport)); } catch (ToolException | IOException e) { addWarning("Skipping mendelian errors: " + e.getMessage()); - return; } } } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/InferredSexComputation.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/InferredSexComputation.java index e643ddda871..770b75e9c68 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/InferredSexComputation.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/individual/qc/InferredSexComputation.java @@ -18,46 +18,42 @@ import org.opencb.biodata.models.alignment.RegionCoverage; import org.opencb.biodata.models.core.Region; -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.alignment.AlignmentStorageManager; import org.opencb.opencga.analysis.variant.mutationalSignature.MutationalSignatureLocalAnalysisExecutor; -import org.opencb.opencga.catalog.db.api.FileDBAdaptor; -import org.opencb.opencga.catalog.exceptions.CatalogException; -import org.opencb.opencga.catalog.managers.FileManager; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.file.File; -import org.opencb.opencga.core.response.OpenCGAResult; import java.io.IOException; import java.nio.file.Path; -import java.util.*; +import java.util.AbstractMap; +import java.util.List; +import java.util.Map; import static org.opencb.opencga.core.tools.variant.InferredSexAnalysisExecutor.GRCH37_CHROMOSOMES; import static org.opencb.opencga.core.tools.variant.InferredSexAnalysisExecutor.GRCH38_CHROMOSOMES; public class InferredSexComputation { - public static double[] computeRatios(String study, File bamFile, String assembly, AlignmentStorageManager alignmentStorageManager, + public static double[] computeRatios(String study, File bwFile, String assembly, AlignmentStorageManager alignmentStorageManager, String token) throws ToolException { // Compute coverage for each chromosome for each BAM file - // TODO get chromosomes from cellbase Map chromosomes; - if (assembly.toLowerCase().equals("grch37")) { + if (assembly.equalsIgnoreCase("grch37")) { chromosomes = GRCH37_CHROMOSOMES; } else { chromosomes = GRCH38_CHROMOSOMES; } double[] means = new double[]{0d, 0d, 0d}; - for (String chrom : chromosomes.keySet()) { - int chromSize = chromosomes.get(chrom); + for (Map.Entry entry : chromosomes.entrySet()) { + String chrom = entry.getKey(); + int chromSize = entry.getValue(); Region region = new Region(chrom, 1, chromSize); try { - List regionCoverages = alignmentStorageManager.coverageQuery(study, bamFile.getUuid(), region, 0, + List regionCoverages = alignmentStorageManager.coverageQuery(study, bwFile.getId(), region, 0, Integer.MAX_VALUE, chromSize, token).getResults(); double meanCoverage = 0d; @@ -98,8 +94,7 @@ public static java.io.File plot(File inputFile, Path outDir) throws ToolExceptio "/data/output"); String rParams = "R CMD Rscript --vanilla /data/input/" + inputFile.getName(); try { - String cmdline = DockerUtils.run(MutationalSignatureLocalAnalysisExecutor.R_DOCKER_IMAGE, null, outputBinding, rParams, null); - System.out.println("Docker command line: " + cmdline); + DockerUtils.run(MutationalSignatureLocalAnalysisExecutor.R_DOCKER_IMAGE, null, outputBinding, rParams, null); } catch (IOException e) { throw new ToolException(e); } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexAnalysis.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexAnalysis.java index 5af0792ac38..9e766accb7a 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexAnalysis.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexAnalysis.java @@ -16,19 +16,28 @@ package org.opencb.opencga.analysis.variant.inferredSex; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.opencb.biodata.models.clinical.qc.InferredSexReport; +import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.AnalysisUtils; +import org.opencb.opencga.analysis.alignment.AlignmentConstants; +import org.opencb.opencga.analysis.individual.qc.IndividualQcUtils; import org.opencb.opencga.analysis.tools.OpenCgaTool; import org.opencb.opencga.catalog.exceptions.CatalogException; +import org.opencb.opencga.catalog.managers.CatalogManager; import org.opencb.opencga.core.common.JacksonUtils; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.common.Enums; import org.opencb.opencga.core.models.file.File; +import org.opencb.opencga.core.models.individual.Individual; +import org.opencb.opencga.core.models.sample.Sample; +import org.opencb.opencga.core.response.OpenCGAResult; import org.opencb.opencga.core.tools.annotations.Tool; import org.opencb.opencga.core.tools.variant.InferredSexAnalysisExecutor; import java.io.IOException; +import java.util.List; @Tool(id = InferredSexAnalysis.ID, resource = Enums.Resource.VARIANT, description = InferredSexAnalysis.DESCRIPTION) public class InferredSexAnalysis extends OpenCgaTool { @@ -38,27 +47,13 @@ public class InferredSexAnalysis extends OpenCgaTool { private String studyId; private String individualId; + private String sampleId; - public InferredSexAnalysis() { - } + // Internal members + private Individual individual; + private Sample sample; - /** - * Study of the samples. - * @param studyId Study ID - * @return this - */ - public InferredSexAnalysis setStudyId(String studyId) { - this.studyId = studyId; - return this; - } - - public String getIndividualId() { - return individualId; - } - - public InferredSexAnalysis setIndividualId(String individualId) { - this.individualId = individualId; - return this; + public InferredSexAnalysis() { } @Override @@ -76,18 +71,33 @@ protected void check() throws Exception { throw new ToolException(e); } - // Check individual and sample - if (StringUtils.isEmpty(individualId)) { - throw new ToolException("Missing individual ID."); - } + // Main check (this function is shared with the endpoint individual/qc/run) + checkParameters(individualId, sampleId, studyId, catalogManager, token); + + // Get individual + individual = IndividualQcUtils.getIndividualById(studyId, individualId, catalogManager, token); - // Check BAM and BW files for that individual/sample - File bamFile = AnalysisUtils.getBamFileBySampleId(individualId, studyId, getCatalogManager().getFileManager(), getToken()); - if (bamFile == null) { - throw new ToolException("BAM file not found for individual/sample '" + individualId + "'"); + // Get samples of that individual, but only germline samples + sample = null; + List childGermlineSamples = IndividualQcUtils.getValidGermlineSamplesByIndividualId(studyId, individualId, catalogManager, + token); + if (CollectionUtils.isEmpty(childGermlineSamples)) { + throw new ToolException("Germline sample not found for individual '" + individualId + "'"); } - if (!new java.io.File(bamFile.getUri().getPath() + ".bw").exists()) { - throw new ToolException("BigWig (BW) file not found for individual/sample '" + individualId + "'"); + + if (StringUtils.isNotEmpty(sampleId)) { + for (Sample germlineSample : childGermlineSamples) { + if (sampleId.equals(germlineSample.getId())) { + sample = germlineSample; + break; + } + } + if (sample == null) { + throw new ToolException("The provided sample '" + sampleId + "' not found in the individual '" + individualId + "'"); + } + } else { + // If multiple germline samples, we take the first one + sample = childGermlineSamples.get(0); } } @@ -98,7 +108,8 @@ protected void run() throws ToolException { InferredSexAnalysisExecutor inferredSexExecutor = getToolExecutor(InferredSexAnalysisExecutor.class); inferredSexExecutor.setStudyId(studyId) - .setIndividualId(individualId) + .setIndividualId(individual.getId()) + .setSampleId(sample.getId()) .execute(); // Get inferred sex report @@ -112,4 +123,90 @@ protected void run() throws ToolException { } }); } + + public static void checkParameters(String individualId, String sampleId, String studyId, CatalogManager catalogManager, String token) throws ToolException, CatalogException { + // Check individual and sample + if (StringUtils.isEmpty(individualId)) { + throw new ToolException("Missing individual ID"); + } + Individual individual = IndividualQcUtils.getIndividualById(studyId, individualId, catalogManager, token); + + // Get samples of that individual, but only germline samples + List childGermlineSamples = IndividualQcUtils.getValidGermlineSamplesByIndividualId(studyId, individualId, catalogManager, + token); + if (CollectionUtils.isEmpty(childGermlineSamples)) { + throw new ToolException("Germline sample not found for individual '" + individualId + "'"); + } + + Sample sample = null; + if (StringUtils.isNotEmpty(sampleId)) { + for (Sample germlineSample : childGermlineSamples) { + if (sampleId.equals(germlineSample.getId())) { + sample = germlineSample; + break; + } + } + if (sample == null) { + throw new ToolException("The provided sample '" + sampleId + "' not found in the individual '" + individualId + "'"); + } + } else { + // Taking the first sample + sample = childGermlineSamples.get(0); + } + + // Checking sample file BIGWIG required to compute inferred-sex + String bwFileId = null; + for (String fileId : sample.getFileIds()) { + if (fileId.endsWith(AlignmentConstants.BIGWIG_EXTENSION)) { + if (bwFileId != null) { + throw new ToolException("Multiple BIGWIG files found for individual/sample (" + individual.getId() + "/" + + sample.getId() + ")"); + } + bwFileId = fileId; + } + } + checkSampleFile(bwFileId, "BIGWIG", sample, individual, studyId, catalogManager, token); + } + + private static void checkSampleFile(String fileId, String label, Sample sample, Individual individual, String studyId, + CatalogManager catalogManager, String token) + throws ToolException, CatalogException { + if (StringUtils.isEmpty(fileId)) { + throw new ToolException("None " + label + " file registered for individual/sample (" + individual.getId() + "/" + + sample.getId() + ")"); + } else { + OpenCGAResult fileResult = catalogManager.getFileManager().get(studyId, fileId, QueryOptions.empty(), token); + if (fileResult.getNumResults() == 0) { + throw new ToolException(label + " file ID '" + fileId + "' not found in OpenCGA catalog for individual/sample (" + + individual.getId() + "/" + sample.getId() + ")"); + } + } + } + /** + * Study of the samples. + * @param studyId Study ID + * @return this + */ + public InferredSexAnalysis setStudyId(String studyId) { + this.studyId = studyId; + return this; + } + + public String getIndividualId() { + return individualId; + } + + public InferredSexAnalysis setIndividualId(String individualId) { + this.individualId = individualId; + return this; + } + + public String getSampleId() { + return sampleId; + } + + public InferredSexAnalysis setSampleId(String sampleId) { + this.sampleId = sampleId; + return this; + } } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexLocalAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexLocalAnalysisExecutor.java index 8f773912f1b..228024dff15 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexLocalAnalysisExecutor.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/inferredSex/InferredSexLocalAnalysisExecutor.java @@ -25,8 +25,6 @@ import org.opencb.opencga.analysis.individual.qc.IndividualQcUtils; import org.opencb.opencga.analysis.individual.qc.InferredSexComputation; import org.opencb.opencga.catalog.exceptions.CatalogException; -import org.opencb.opencga.catalog.managers.CatalogManager; -import org.opencb.opencga.catalog.managers.FileManager; import org.opencb.opencga.core.common.JacksonUtils; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.models.file.File; @@ -36,68 +34,66 @@ import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; +import static org.opencb.opencga.core.tools.variant.IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD; + @ToolExecutor(id = "opencga-local", tool = InferredSexAnalysis.ID, framework = ToolExecutor.Framework.LOCAL, source = ToolExecutor.Source.STORAGE) public class InferredSexLocalAnalysisExecutor extends InferredSexAnalysisExecutor implements StorageToolExecutor { @Override public void run() throws ToolException { - // IMPORTANT: we assume sample and individual have the same ID - AlignmentStorageManager alignmentStorageManager = getAlignmentStorageManager(); - CatalogManager catalogManager = alignmentStorageManager.getCatalogManager(); - FileManager fileManager = catalogManager.getFileManager(); - String assembly; + File bwFile = AnalysisUtils.getBwFileBySampleId(sampleId, getStudyId(), getVariantStorageManager().getCatalogManager().getFileManager(), + getToken()); - // Get alignment file by individual - File inferredSexBamFile = AnalysisUtils.getBamFileBySampleId(getIndividualId(), getStudyId(), fileManager, getToken()); - if (inferredSexBamFile == null) { - throw new ToolException("Alignment file not found for the individual/sample '" + getIndividualId() + "'"); + if (bwFile == null) { + throw new ToolException("BIGWIG file not found for sample '" + sampleId + "' of individual '" + individualId + "'"); } - // Ge assembly + // Get managers + AlignmentStorageManager alignmentStorageManager = getAlignmentStorageManager(); + + // Get assembly + String assembly; try { assembly = IndividualQcUtils.getAssembly(getStudyId(), alignmentStorageManager.getCatalogManager(), getToken()); } catch (CatalogException e) { throw new ToolException(e); } + // Infer the sex for that sample // Compute ratios: X-chrom / autosomic-chroms and Y-chrom / autosomic-chroms - double[] ratios = InferredSexComputation.computeRatios(getStudyId(), inferredSexBamFile, assembly, alignmentStorageManager, - getToken()); + double[] ratios = InferredSexComputation.computeRatios(studyId, bwFile, assembly, alignmentStorageManager, getToken()); + // Infer sex from ratios double xAuto = ratios[0]; double yAuto = ratios[1]; - // Read the karyotypic sex tyhresholds - String inferredKaryotypicSex = "UNKNOWN"; Map karyotypicSexThresholds = new HashMap<>(); + String opencgaHome = getExecutorParams().getString("opencgaHome"); + Path thresholdsPath = Paths.get(opencgaHome).resolve("analysis").resolve(IndividualQcAnalysis.ID) + .resolve("karyotypic_sex_thresholds.json"); try { - String opencgaHome = getExecutorParams().getString("opencgaHome"); - Path thresholdsPath = Paths.get(opencgaHome).resolve("analysis").resolve(IndividualQcAnalysis.ID) - .resolve("karyotypic_sex_thresholds.json"); karyotypicSexThresholds = JacksonUtils.getDefaultNonNullObjectMapper().readerFor(Map.class).readValue(thresholdsPath.toFile()); } catch (IOException e) { - addWarning("Skipping inferring karyotypic sex: something wrong happened when loading the karyotypic sex thresholds file" - + " (karyotypic_sex_thresholds.json)"); + throw new ToolException("Skipping inferring karyotypic sex: something wrong happened when loading the karyotypic sex" + + " thresholds file: " + thresholdsPath); } - if (MapUtils.isNotEmpty(karyotypicSexThresholds)) { - inferredKaryotypicSex = InferredSexComputation.inferKaryotypicSex(xAuto, yAuto, karyotypicSexThresholds); + if (MapUtils.isEmpty(karyotypicSexThresholds)) { + throw new ToolException("Impossible to infer karyotypic sex beacause sex thresholds are empty: " + thresholdsPath); } + String inferredKaryotypicSex = InferredSexComputation.inferKaryotypicSex(xAuto, yAuto, karyotypicSexThresholds); - // Set inferred sex report: ratios and files + // Set coverage ratio Map values = new HashMap<>(); values.put("ratioX", xAuto); values.put("ratioY", yAuto); - List reportedFiles = new ArrayList<>(); - reportedFiles.add(inferredSexBamFile.getName()); - reportedFiles.add(inferredSexBamFile.getName() + ".bw"); - - setInferredSexReport(new InferredSexReport(getIndividualId(), "CoverageRatio", inferredKaryotypicSex, values, reportedFiles)); + // Set inferred sex report (individual fields will be set later) + inferredSexReport = new InferredSexReport(sampleId, COVERAGE_RATIO_INFERRED_SEX_METHOD, inferredKaryotypicSex, values, + Collections.singletonList(bwFile.getId())); } } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/operations/VariantFileIndexJobLauncherTool.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/operations/VariantFileIndexJobLauncherTool.java index c548f0fbbca..1178c9a8081 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/operations/VariantFileIndexJobLauncherTool.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/variant/operations/VariantFileIndexJobLauncherTool.java @@ -1,5 +1,6 @@ package org.opencb.opencga.analysis.variant.operations; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.Query; @@ -35,10 +36,15 @@ public class VariantFileIndexJobLauncherTool extends OpenCgaToolScopeStudy { public static final String ID = "variant-index-job-launcher"; public static final String DESCRIPTION = "Detect non-indexed VCF files in the study, and submit a job for indexing them."; + public static final String SUBMITTED_JOBS_ATTRIBUTE = "submittedJobs"; + public static final String SCANNED_FILES_ATTRIBUTE = "scannedFiles"; + public static final String JOB_TAGS_ATTRIBUTE = "jobTags"; @ToolParams protected final VariantFileIndexJobLauncherParams toolParams = new VariantFileIndexJobLauncherParams(); + private List jobTags = new ArrayList<>(); + @Override protected void check() throws Exception { super.check(); @@ -48,6 +54,17 @@ protected void check() throws Exception { toolParams.setDirectory(directory + "/"); } } + String jobId = getJobId(); + if (!StringUtils.isEmpty(jobId)) { + Job parentJob = catalogManager.getJobManager().get(getStudyFqn(), jobId, new QueryOptions(), getToken()).first(); + if (parentJob.getTags() != null) { + jobTags.addAll(parentJob.getTags()); + } + jobTags.add(ID + ":" + parentJob.getId()); + } else { + jobTags.add(ID + ":" + TimeUtils.getTime() + "-" + RandomStringUtils.randomAlphanumeric(5)); + } + addAttribute(JOB_TAGS_ATTRIBUTE, jobTags); } @Override @@ -125,7 +142,7 @@ protected void run() throws Exception { String jobId = buildJobId(file); Job job = catalogManager.getJobManager().submit(getStudy(), VariantIndexOperationTool.ID, Enums.Priority.MEDIUM, indexParams.toParams(new ObjectMap(ParamConstants.STUDY_PARAM, study)), jobId, "Job generated by " + getId(), - Collections.emptyList(), Collections.emptyList(), getToken()).first(); + Collections.emptyList(), jobTags, getToken()).first(); submittedJobs++; logger.info("[{}] Create variant-index job '{}' for file '{}'{}", submittedJobs, @@ -139,8 +156,8 @@ protected void run() throws Exception { } } - addAttribute("submittedJobs", submittedJobs); - addAttribute("scannedFiles", scannedFiles); + addAttribute(SUBMITTED_JOBS_ATTRIBUTE, submittedJobs); + addAttribute(SCANNED_FILES_ATTRIBUTE, scannedFiles); if (scannedFiles == 0) { addWarning("No files found. Nothing to do"); } diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/deeptools/DeeptoolsWrapperAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/deeptools/DeeptoolsWrapperAnalysisExecutor.java index b4825b7dc1e..1c730f10e7a 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/deeptools/DeeptoolsWrapperAnalysisExecutor.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/deeptools/DeeptoolsWrapperAnalysisExecutor.java @@ -1,8 +1,10 @@ package org.opencb.opencga.analysis.wrappers.deeptools; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.opencb.opencga.analysis.alignment.AlignmentConstants; import org.opencb.opencga.analysis.wrappers.executors.DockerWrapperAnalysisExecutor; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.tools.annotations.ToolExecutor; @@ -10,6 +12,10 @@ import org.slf4j.LoggerFactory; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.*; @ToolExecutor(id = DeeptoolsWrapperAnalysisExecutor.ID, @@ -50,6 +56,47 @@ public void run() throws ToolException { private void runBamCommonCommand() throws ToolException { StringBuilder sb = initCommandLine(); + // Check symbolic links to be appended + if (MapUtils.isNotEmpty(getExecutorParams())) { + Set fileParamNames = DeeptoolsWrapperAnalysis.getFileParamNames(command); + Set symbolicPaths = new HashSet<>(); + for (String paramName : getExecutorParams().keySet()) { + if (skipParameter(paramName)) { + continue; + } + + if (fileParamNames.contains(paramName)) { + Path filePath = Paths.get(getExecutorParams().getString(paramName)); + if ( Files.isSymbolicLink(filePath)) { + try { + Path target = Files.readSymbolicLink(filePath); + if (!symbolicPaths.contains(target.getParent())) { + symbolicPaths.add(target.getParent()); + } + // If it is BAM file, we have to check the BAI file (that is not present in the input parameters but it is + // located in the same folder) + if (filePath.toString().endsWith(AlignmentConstants.BAM_EXTENSION)) { + Path baiPath = Paths.get(filePath.toAbsolutePath() + AlignmentConstants.BAI_EXTENSION); + if (baiPath.toFile().exists()) { + if (Files.isSymbolicLink(baiPath)) { + Path baiTarget = Files.readSymbolicLink(baiPath); + if (!symbolicPaths.contains(baiTarget.getParent())) { + symbolicPaths.add(baiTarget.getParent()); + } + } + } + } + } catch (IOException e) { + throw new ToolException("Error processing symbolic links", e); + } + } + } + } + for (Path symbolicPath : symbolicPaths) { + sb.append(" --mount type=bind,source=\"").append(symbolicPath).append("\",target=\"").append(symbolicPath).append("\" "); + } + } + // Append mounts List> inputFilenames = DockerWrapperAnalysisExecutor.getInputFilenames(null, DeeptoolsWrapperAnalysis.getFileParamNames(command), getExecutorParams()); diff --git a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/executors/DockerWrapperAnalysisExecutor.java b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/executors/DockerWrapperAnalysisExecutor.java index 21f619cc5a4..ae2b5072473 100644 --- a/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/executors/DockerWrapperAnalysisExecutor.java +++ b/opencga-analysis/src/main/java/org/opencb/opencga/analysis/wrappers/executors/DockerWrapperAnalysisExecutor.java @@ -7,6 +7,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.exec.Command; +import org.opencb.opencga.analysis.wrappers.deeptools.DeeptoolsWrapperAnalysis; import org.opencb.opencga.core.common.GitRepositoryState; import org.opencb.opencga.core.exceptions.ToolException; import org.opencb.opencga.core.tools.OpenCgaToolExecutor; @@ -17,6 +18,9 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.*; public abstract class DockerWrapperAnalysisExecutor extends OpenCgaToolExecutor { diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/PlatinumFileIndexerTest.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/PlatinumFileIndexerTest.java index f6082bea5d2..4396a3d6e99 100644 --- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/PlatinumFileIndexerTest.java +++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/PlatinumFileIndexerTest.java @@ -26,10 +26,13 @@ import org.opencb.opencga.analysis.tools.ToolRunner; import org.opencb.opencga.analysis.variant.operations.VariantFileIndexJobLauncherTool; import org.opencb.opencga.analysis.variant.operations.VariantIndexOperationTool; +import org.opencb.opencga.catalog.db.api.JobDBAdaptor; import org.opencb.opencga.catalog.exceptions.CatalogException; import org.opencb.opencga.core.api.ParamConstants; import org.opencb.opencga.core.exceptions.ToolException; +import org.opencb.opencga.core.models.common.Enums; import org.opencb.opencga.core.models.file.File; +import org.opencb.opencga.core.models.job.Job; import org.opencb.opencga.core.models.variant.VariantFileIndexJobLauncherParams; import org.opencb.opencga.core.models.variant.VariantIndexParams; import org.opencb.opencga.core.testclassification.duration.MediumTests; @@ -49,6 +52,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import static org.opencb.opencga.core.api.ParamConstants.STUDY_PARAM; /** * Created on 15/07/16 @@ -201,11 +205,48 @@ public void testBatchBySteps() throws Exception { @Test public void testLauncher() throws CatalogException, IOException, ToolException { ToolRunner toolRunner = new ToolRunner(opencga.getOpencgaHome().toString(), catalogManager, StorageEngineFactory.get(variantManager.getStorageConfiguration())); + int numFiles = 0; for (int i = 77; i <= 93; i++) { create("platinum/1K.end.platinum-genomes-vcf-NA128" + i + "_S1.genome.vcf.gz"); + numFiles++; } - toolRunner.execute(VariantFileIndexJobLauncherTool.class, studyFqn, new VariantFileIndexJobLauncherParams().setDirectory("data/vcfs"), - Paths.get(opencga.createTmpOutdir(studyId, "_LOAD_", sessionId)), "", sessionId); + VariantFileIndexJobLauncherParams params = new VariantFileIndexJobLauncherParams().setDirectory("data/vcfs"); + List tags = Arrays.asList("tag1", "tag2"); + Job job = catalogManager.getJobManager().submit(studyFqn, VariantFileIndexJobLauncherTool.ID, Enums.Priority.HIGH, + params.toParams(STUDY_PARAM, studyFqn), null, null, null, tags, sessionId).first(); + ExecutionResult result = toolRunner.execute(job, Paths.get(opencga.createTmpOutdir(studyId, "_LOAD_", sessionId)), sessionId); + + List tagsFromResult = result.getAttributes().getAsStringList(VariantFileIndexJobLauncherTool.JOB_TAGS_ATTRIBUTE); + assertTrue(tagsFromResult.containsAll(tags)); + for (String tag : tagsFromResult) { + List results = catalogManager.getJobManager().search(studyFqn, + new Query() + .append(JobDBAdaptor.QueryParams.TOOL_ID.key(), VariantIndexOperationTool.ID) + .append(JobDBAdaptor.QueryParams.TAGS.key(), tag), + new QueryOptions(), sessionId).getResults(); + assertEquals(numFiles, results.size()); + } + assertEquals(numFiles, result.getAttributes().getInt(VariantFileIndexJobLauncherTool.SUBMITTED_JOBS_ATTRIBUTE)); + assertEquals(numFiles, result.getAttributes().getInt(VariantFileIndexJobLauncherTool.SCANNED_FILES_ATTRIBUTE)); + + //// Execute again, no new jobs should be submitted + tags = Arrays.asList("tag10", "tag20"); + job = catalogManager.getJobManager().submit(studyFqn, VariantFileIndexJobLauncherTool.ID, Enums.Priority.HIGH, + params.toParams(STUDY_PARAM, studyFqn), null, null, null, tags, sessionId).first(); + result = toolRunner.execute(job, Paths.get(opencga.createTmpOutdir(studyId, "_LOAD_", sessionId)), sessionId); + + tagsFromResult = result.getAttributes().getAsStringList(VariantFileIndexJobLauncherTool.JOB_TAGS_ATTRIBUTE); + assertTrue(tagsFromResult.containsAll(tags)); + for (String tag : tagsFromResult) { + List results = catalogManager.getJobManager().search(studyFqn, + new Query() + .append(JobDBAdaptor.QueryParams.TOOL_ID.key(), VariantIndexOperationTool.ID) + .append(JobDBAdaptor.QueryParams.TAGS.key(), tag), + new QueryOptions(), sessionId).getResults(); + assertEquals(0, results.size()); + } + assertEquals(0, result.getAttributes().getInt(VariantFileIndexJobLauncherTool.SUBMITTED_JOBS_ATTRIBUTE)); + assertEquals(numFiles, result.getAttributes().getInt(VariantFileIndexJobLauncherTool.SCANNED_FILES_ATTRIBUTE)); } } diff --git a/opencga-app/app/analysis/resources/README b/opencga-app/app/analysis/resources/README index fa335694428..ed41c2e6f38 100644 --- a/opencga-app/app/analysis/resources/README +++ b/opencga-app/app/analysis/resources/README @@ -1,55 +1,6 @@ README - -In this folder, users should store external files to be used by some OpenCGA analysis. - -1) roleInCancer.txt[.gz] - -This file is used by interpretation clinical analysis, e.g., Tiering and TEAM analysis. - -It stores those genes which contain mutations that have been casually implicated in cancer. This information can be downloaded -from the Cancer Gene Census (CGC) at https://cancer.sanger.ac.uk/census - -The file consists of two tab-separated columns: the first one contains the gene name, and the second, the role in cancer, i.e.: oncogne, -TSG, fusion. In addition, lines starting with # are considered comments and will be ignored. - -Sample of a roleInCancer file: - -#Gene name Role in Cancer -A1CF oncogene -ABI1 TSG, fusion -ABL1 oncogene, fusion -ABL2 oncogene, fusion -ACKR3 oncogene, fusion -ACSL3 fusion -... -... - - -2) actionableVariants_xxx.txt[.gz] where xxx = assembly, e.g.: grch37 - -This file is used by interpretation clinical analysis, e.g., TEAM analysis. - -It stores variants that were identified as clinically actionable variants. The file consists of the following twelve tab-separated columns: - - Chromosome - - Start - - Stop - - Reference allele - - Alternate allele - - dbSNP ID - - ClinVar Variant ID - - HGVS - - Phenotype list - - Clinical significance - - Review status - - Submitter categories - -In addition, lines starting with # are considered comments and will be ignored. - -Sample fo an actionableVariants file: - -#Chromosome Start Stop ReferenceAllele AlternateAllele dbSNP ID ClinVar Variant ID hgvs PhenotypeList ClinicalSignificance ReviewStatus SubmitterCategories -2 47702269 47702269 C T rs28929483 1753 NM_000251.2(MSH2):c.1865C>T (p.Pro622Leu) Hereditary cancer-predisposing syndrome;Hereditary nonpolyposis colon cancer;Lynch syndrome;Lynch syndrome I Pathogenic reviewed by expert panel 3 -2 47657020 47657020 C T rs63751108 1755 NM_000251.2(MSH2):c.1216C>T (p.Arg406Ter) Carcinoma of colon;Hereditary cancer-predisposing syndrome;Hereditary nonpolyposis colon cancer;Lynch syndrome;Lynch syndrome I;not provided Pathogenic reviewed by expert panel 3 -... -... +This directory is designated for OpenCGA analyses to download the necessary external data. +For instance, during the first Exomiser analysis, the files '2109_hg38.zip' and '2109_phenotype.zip' will be downloaded +from the OpenCGA analysis URL and stored in the 'exomiser' folder within this directory. Subsequent Exomiser analyses will +then access this folder to read these files. diff --git a/opencga-app/app/cloud/docker/docker-build.py b/opencga-app/app/cloud/docker/docker-build.py index 3b339665782..49459de914d 100755 --- a/opencga-app/app/cloud/docker/docker-build.py +++ b/opencga-app/app/cloud/docker/docker-build.py @@ -177,9 +177,9 @@ def delete(): # Get hadoop_flavour from JAR library file name hadoop_flavour = None for file in os.listdir(build_folder + "/libs/"): - if (file.startswith("opencga-storage-hadoop-deps")): + if (file.startswith("opencga-storage-hadoop-lib-") and file.endswith(".jar")): if hadoop_flavour is not None: - exit("Error. Multiple libs/opencga-storage-hadoop-deps*.jar found") + exit("Error. Multiple libs/opencga-storage-hadoop-lib*.jar found") hadoop_flavour = file.split("-")[4] # Create docker tag diff --git a/opencga-app/app/cloud/docker/opencga-ext-tools/Dockerfile b/opencga-app/app/cloud/docker/opencga-ext-tools/Dockerfile index 5b9a3bdd956..d2b816aaa06 100644 --- a/opencga-app/app/cloud/docker/opencga-ext-tools/Dockerfile +++ b/opencga-app/app/cloud/docker/opencga-ext-tools/Dockerfile @@ -26,11 +26,11 @@ RUN apt-get update -y && DEBIAN_FRONTEND="noninteractive" TZ="Europe/London" apt WORKDIR /opt/opencga/signature.tools.lib RUN git fetch origin --tags && \ - git checkout tags/v2.4.2 && \ + git checkout tags/v2.4.4 && \ sed -i '/Mmusculus/d' DESCRIPTION && \ sed -i '/Cfamiliaris/d' DESCRIPTION && \ sed -i '/1000genomes/d' DESCRIPTION && \ - R -e 'options(timeout = 300);devtools::install(repos="https://www.stats.bris.ac.uk/R/")' && \ + R -e 'options(timeout = 3600);devtools::install(repos="https://www.stats.bris.ac.uk/R/")' && \ ## Clean up rm -rf /var/lib/apt/lists/* /tmp/* /opt/opencga/signature.tools.lib/.git && \ strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 diff --git a/opencga-app/app/misc/scripts/hadoop-ssh.sh b/opencga-app/app/misc/scripts/hadoop-ssh.sh index c39152339a9..30141a04074 100755 --- a/opencga-app/app/misc/scripts/hadoop-ssh.sh +++ b/opencga-app/app/misc/scripts/hadoop-ssh.sh @@ -1,45 +1,45 @@ #!/usr/bin/env sh -if [ -z ${HADOOP_SSH_USER} ] ; then +if [ -z "${HADOOP_SSH_USER}" ] ; then echo "Undefined HADOOP_SSH_USER" 1>&2 exit 1 fi -if [ -z ${HADOOP_SSH_HOST} ] ; then +if [ -z "${HADOOP_SSH_HOST}" ] ; then echo "Undefined HADOOP_SSH_HOST" 1>&2 exit 1 fi SSHPASS_CMD= -if [ -z ${SSHPASS} ] ; then +if [ -z "${SSHPASS}" ] ; then # If empty, assume ssh-key exists in the system SSHPASS_CMD="" else # If non zero, use sshpass command - SSHPASS_CMD="sshpass -e" + SSHPASS_CMD="sshpass -e " fi SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60" -if [ ! -z ${HADOOP_SSH_KEY} ] && [ -f ${HADOOP_SSH_KEY} ] ; then +if [ -n "${HADOOP_SSH_KEY}" ] && [ -f "${HADOOP_SSH_KEY}" ] ; then SSH_OPTS="${SSH_OPTS} -i ${HADOOP_SSH_KEY}" fi echo "Connect to Hadoop edge node ${HADOOP_SSH_USER}@${HADOOP_SSH_HOST}" 1>&2 -echo "${SSHPASS_CMD} ssh ${SSH_OPTS} ${HADOOP_SSH_USER}@${HADOOP_SSH_HOST}" 1>&2 +echo "${SSHPASS_CMD}ssh ${SSH_OPTS} ${HADOOP_SSH_USER}@${HADOOP_SSH_HOST}" 1>&2 # Escape args with single quotes CMD= -for arg in $@ ; do +for arg in "$@" ; do # Escape single quote, if any : # arg=`echo $arg | sed "s/'/'\"'\"'/g"` # aaa'aaa --> 'aaa'"'"'aaa' - arg=`echo $arg | sed "s/'/'\\\\\\''/g"` # aaa'aaa --> 'aaa'\''aaa' + arg=$(echo "$arg" | sed "s/'/'\\\\\\''/g") # aaa'aaa --> 'aaa'\''aaa' CMD="${CMD}'${arg}' " done echo ${CMD} -${SSHPASS_CMD} ssh ${SSH_OPTS} ${HADOOP_SSH_USER}@${HADOOP_SSH_HOST} /bin/bash << EOF +${SSHPASS_CMD} ssh ${SSH_OPTS} "${HADOOP_SSH_USER}@${HADOOP_SSH_HOST}" /bin/bash << EOF export HADOOP_CLASSPATH=${HADOOP_CLASSPATH} export HADOOP_USER_CLASSPATH_FIRST=${HADOOP_USER_CLASSPATH_FIRST} diff --git a/opencga-app/pom.xml b/opencga-app/pom.xml index 80f8a238c0e..6dcf364e559 100644 --- a/opencga-app/pom.xml +++ b/opencga-app/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/CommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/CommandExecutor.java index d4877431f35..ee5c57c3cbc 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/CommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/CommandExecutor.java @@ -17,16 +17,25 @@ package org.opencb.opencga.app.cli; import com.beust.jcommander.JCommander; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.core.config.Configurator; +import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.FileUtils; import org.opencb.commons.utils.PrintUtils; +import org.opencb.opencga.app.cli.main.utils.CommandLineUtils; import org.opencb.opencga.app.cli.session.SessionManager; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; +import org.opencb.opencga.client.rest.OpenCGAClient; import org.opencb.opencga.core.config.Configuration; import org.opencb.opencga.core.config.storage.StorageConfiguration; +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; @@ -36,6 +45,10 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * Created by imedina on 19/04/16. @@ -281,6 +294,84 @@ public CommandExecutor setSessionManager(SessionManager sessionManager) { return this; } + public String getObjectAsJSON(String objectCategory, String objectPath, OpenCGAClient openCGAClient) throws Exception { + StringBuilder jsonInString = new StringBuilder("\n"); + try { + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("category", objectCategory); + RestResponse response = openCGAClient.getMetaClient().api(queryParams); + ObjectMapper jsonObjectMapper = new ObjectMapper(); + boolean found = false; + 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())) { + for (RestParameter parameter : endpoint.getParameters()) { + if (parameter.getData() != null) { + found = true; + Map map = getExampleBody(parameter.getData()); + jsonInString.append(jsonObjectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(map)); + } + } + } + } + } + } + if (!found) { + jsonInString.append("No model available"); + } + } catch (Exception e) { + jsonInString = new StringBuilder("Data model not found."); + CommandLineUtils.error(e); + } + return jsonInString.toString(); + } + + private Map getExampleBody(List data) { + Map result = new HashMap<>(); + for (RestParameter parameter : data) { + if (parameter.getData() == null) { + result.put(parameter.getName(), getParameterExampleValue(parameter)); + } else { + result.put(parameter.getName(), getExampleBody(parameter.getData())); + } + } + return result; + } + + private Object getParameterExampleValue(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 Collections.singletonList(""); + case "Date": + return "dd/mm/yyyy"; + case "Map": + return Collections.singletonMap("key", "value"); + case "String": + return ""; + default: + logger.debug("Unknown type: " + parameter.getType() + " for parameter: " + parameter.getName()); + return "-"; + } + } + public Logger getLogger() { return logger; } diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/AlignmentCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/AlignmentCommandExecutor.java index 3553384e71a..07ed1b36c1f 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/AlignmentCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/AlignmentCommandExecutor.java @@ -121,7 +121,7 @@ private void indexRun() throws Exception { AlignmentStorageManager alignmentManager = new AlignmentStorageManager(catalogManager, storageEngineFactory, alignmentCommandOptions.internalJobOptions.jobId); - alignmentManager.index(cliOptions.study, cliOptions.file, cliOptions.overwrite, cliOptions.outdir, cliOptions.commonOptions.token); + alignmentManager.index(cliOptions.study, cliOptions.file, cliOptions.outdir, cliOptions.commonOptions.token); } @@ -234,9 +234,9 @@ private void coverageRun() throws ToolException { AlignmentCommandOptions.CoverageAlignmentCommandOptions cliOptions = alignmentCommandOptions.coverageAlignmentCommandOptions; ObjectMap params = new CoverageIndexParams( - cliOptions.file, - cliOptions.windowSize, - cliOptions.overwrite + cliOptions.bamFileId, + cliOptions.baiFileId, + cliOptions.windowSize ).toObjectMap(cliOptions.commonOptions.params).append(ParamConstants.STUDY_PARAM, cliOptions.study); toolRunner.execute(AlignmentCoverageAnalysis.class, params, Paths.get(cliOptions.outdir), jobId, token); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/VariantInternalCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/VariantInternalCommandExecutor.java index 7d3f514a745..e502850d9ee 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/VariantInternalCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/executors/VariantInternalCommandExecutor.java @@ -887,6 +887,7 @@ private void inferredSex() throws Exception { variantCommandOptions.internalJobOptions.jobId, token); inferredSexAnalysis.setStudyId(cliOptions.study) .setIndividualId(cliOptions.individual) + .setSampleId(cliOptions.sample) .start(); } diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/AlignmentCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/AlignmentCommandOptions.java index f97a435aa15..99f09597f4b 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/AlignmentCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/internal/options/AlignmentCommandOptions.java @@ -107,9 +107,6 @@ public class IndexAlignmentCommandOptions extends GeneralCliOptions.StudyOption @Parameter(names = {"--file"}, description = FILE_ID_DESCRIPTION, required = true, arity = 1) public String file; - @Parameter(names = {"--overwrite"}, description = "Overwrite index file", arity = 0) - public boolean overwrite = false; - @Parameter(names = {"-o", "--outdir"}, description = OUTPUT_DIRECTORY_DESCRIPTION) public String outdir; } @@ -335,15 +332,15 @@ public class CoverageAlignmentCommandOptions extends GeneralCliOptions.StudyOpti @ParametersDelegate public Object internalJobOptions = internalJobOptionsObject; - @Parameter(names = {"--file"}, description = FILE_ID_DESCRIPTION, required = true, arity = 1) - public String file; + @Parameter(names = {"--bam-file-id"}, description = "BAM file ID", required = true, arity = 1) + public String bamFileId; + + @Parameter(names = {"--bai-file-id"}, description = "BAI file ID; if not provided, it will search the most recent one", arity = 1) + public String baiFileId; @Parameter(names = {"--window-size"}, description = COVERAGE_WINDOW_SIZE_DESCRIPTION, arity = 1) public int windowSize = 1; - @Parameter(names = {"--overwrite"}, description = "Overwrite coverage file", arity = 0) - public boolean overwrite = false; - @Parameter(names = {"-o", "--outdir"}, description = OUTPUT_DIRECTORY_DESCRIPTION) 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 a39ab4aea61..140e5c0f8c2 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-2024-03-04 OpenCB +* Copyright 2015-2024-03-12 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","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","load","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") + 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","load","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","report-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 249139a1608..02e2876bf2e 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-2024-03-04 OpenCB +* Copyright 2015-2024-03-12 OpenCB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -161,6 +161,7 @@ public OpencgaCliOptionsParser() { analysisClinicalSubCommands.addCommand("interpretation-delete", analysisClinicalCommandOptions.deleteInterpretationCommandOptions); analysisClinicalSubCommands.addCommand("interpretation-revert", analysisClinicalCommandOptions.revertInterpretationCommandOptions); analysisClinicalSubCommands.addCommand("interpretation-update", analysisClinicalCommandOptions.updateInterpretationCommandOptions); + analysisClinicalSubCommands.addCommand("report-update", analysisClinicalCommandOptions.updateReportCommandOptions); jobsCommandOptions = new JobsCommandOptions(commonCommandOptions, jCommander); jCommander.addCommand("jobs", jobsCommandOptions); 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 fcbbfdfc789..217b7421f32 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 @@ -178,9 +178,9 @@ private RestResponse runCoverageIndex() throws Exception { .readValue(new java.io.File(commandOptions.jsonFile), CoverageIndexParams.class); } else { ObjectMap beanParams = new ObjectMap(); - putNestedIfNotEmpty(beanParams, "file",commandOptions.file, true); + putNestedIfNotEmpty(beanParams, "bamFileId",commandOptions.bamFileId, true); + putNestedIfNotEmpty(beanParams, "baiFileId",commandOptions.baiFileId, true); putNestedIfNotNull(beanParams, "windowSize",commandOptions.windowSize, true); - putNestedIfNotNull(beanParams, "overwrite",commandOptions.overwrite, true); coverageIndexParams = JacksonUtils.getDefaultObjectMapper().copy() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisClinicalCommandExecutor.java index 97f7bb98c30..e96ddce01c2 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 @@ -202,6 +202,9 @@ public void execute() throws Exception { case "interpretation-update": queryResponse = updateInterpretation(); break; + case "report-update": + queryResponse = updateReport(); + break; default: logger.error("Subcommand not valid"); break; @@ -1485,4 +1488,48 @@ private RestResponse updateInterpretation() throws Exception { } return openCGAClient.getClinicalAnalysisClient().updateInterpretation(commandOptions.clinicalAnalysis, commandOptions.interpretation, interpretationUpdateParams, queryParams); } + + private RestResponse updateReport() throws Exception { + logger.debug("Executing updateReport in Analysis - Clinical command line"); + + AnalysisClinicalCommandOptions.UpdateReportCommandOptions commandOptions = analysisClinicalCommandOptions.updateReportCommandOptions; + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("include", commandOptions.include); + queryParams.putIfNotEmpty("exclude", commandOptions.exclude); + queryParams.putIfNotEmpty("study", commandOptions.study); + queryParams.putIfNotNull("supportingEvidencesAction", commandOptions.supportingEvidencesAction); + queryParams.putIfNotNull("includeResult", commandOptions.includeResult); + if (queryParams.get("study") == null && OpencgaMain.isShellMode()) { + queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy()); + } + + + ClinicalReport clinicalReport = null; + if (commandOptions.jsonDataModel) { + RestResponse res = new RestResponse<>(); + res.setType(QueryType.VOID); + PrintUtils.println(getObjectAsJSON(categoryName,"/{apiVersion}/analysis/clinical/{clinicalAnalysis}/report/update")); + return res; + } else if (commandOptions.jsonFile != null) { + clinicalReport = JacksonUtils.getDefaultObjectMapper() + .readValue(new java.io.File(commandOptions.jsonFile), ClinicalReport.class); + } else { + ObjectMap beanParams = new ObjectMap(); + putNestedIfNotEmpty(beanParams, "title",commandOptions.title, true); + putNestedIfNotEmpty(beanParams, "overview",commandOptions.overview, true); + putNestedIfNotEmpty(beanParams, "discussion.author",commandOptions.discussionAuthor, true); + putNestedIfNotEmpty(beanParams, "discussion.date",commandOptions.discussionDate, true); + putNestedIfNotEmpty(beanParams, "discussion.text",commandOptions.discussionText, true); + putNestedIfNotEmpty(beanParams, "logo",commandOptions.logo, true); + putNestedIfNotEmpty(beanParams, "signedBy",commandOptions.signedBy, true); + putNestedIfNotEmpty(beanParams, "signature",commandOptions.signature, true); + putNestedIfNotEmpty(beanParams, "date",commandOptions.date, true); + + clinicalReport = JacksonUtils.getDefaultObjectMapper().copy() + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true) + .readValue(beanParams.toJson(), ClinicalReport.class); + } + return openCGAClient.getClinicalAnalysisClient().updateReport(commandOptions.clinicalAnalysis, clinicalReport, queryParams); + } } \ No newline at end of file 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 0d8987f61d6..3a674a32c68 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 @@ -106,7 +106,11 @@ private RestResponse model() throws Exception { logger.debug("Executing model in Meta command line"); MetaCommandOptions.ModelCommandOptions commandOptions = metaCommandOptions.modelCommandOptions; - return openCGAClient.getMetaClient().model(); + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("model", commandOptions.model); + + return openCGAClient.getMetaClient().model(queryParams); } private RestResponse ping() throws Exception { 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 8f935c36ff8..72f9bdd0e8c 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 @@ -225,90 +225,7 @@ public OpencgaCommandExecutor setOpenCGAClient(OpenCGAClient openCGAClient) { } public String getObjectAsJSON(String objectCategory, String objectPath) throws Exception { - StringBuilder jsonInString = new StringBuilder("\n"); - try { - 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.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 "\"-\""; - } + return super.getObjectAsJSON(objectCategory, objectPath, openCGAClient); } private boolean isNumeric(String type) { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisAlignmentCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisAlignmentCommandOptions.java index 007da0c4131..46abae24683 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisAlignmentCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisAlignmentCommandOptions.java @@ -142,15 +142,15 @@ public class RunCoverageIndexCommandOptions { @Parameter(names = {"--job-tags"}, description = "Job tags", required = false, arity = 1) public String jobTags; - @Parameter(names = {"--file"}, description = "The body web service file parameter", required = false, arity = 1) - public String file; + @Parameter(names = {"--bam-file-id"}, description = "The body web service bamFileId parameter", required = false, arity = 1) + public String bamFileId; + + @Parameter(names = {"--bai-file-id"}, description = "The body web service baiFileId parameter", required = false, arity = 1) + public String baiFileId; @Parameter(names = {"--window-size"}, description = "The body web service windowSize parameter", required = false, arity = 1) public Integer windowSize; - @Parameter(names = {"--overwrite"}, description = "The body web service overwrite parameter", required = false, help = true, arity = 0) - public boolean overwrite = false; - } @Parameters(commandNames = {"coverage-qc-genecoveragestats-run"}, commandDescription ="Compute gene coverage stats for a given alignment file and a list of genes") diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java index 5249bdedd46..fcfe1679c19 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisClinicalCommandOptions.java @@ -67,6 +67,7 @@ public class AnalysisClinicalCommandOptions { public DeleteInterpretationCommandOptions deleteInterpretationCommandOptions; public RevertInterpretationCommandOptions revertInterpretationCommandOptions; public UpdateInterpretationCommandOptions updateInterpretationCommandOptions; + public UpdateReportCommandOptions updateReportCommandOptions; public AnalysisClinicalCommandOptions(CommonCommandOptions commonCommandOptions, JCommander jCommander) { @@ -107,6 +108,7 @@ public AnalysisClinicalCommandOptions(CommonCommandOptions commonCommandOptions, this.deleteInterpretationCommandOptions = new DeleteInterpretationCommandOptions(); this.revertInterpretationCommandOptions = new RevertInterpretationCommandOptions(); this.updateInterpretationCommandOptions = new UpdateInterpretationCommandOptions(); + this.updateReportCommandOptions = new UpdateReportCommandOptions(); } @@ -2308,4 +2310,63 @@ public class UpdateInterpretationCommandOptions { } + @Parameters(commandNames = {"report-update"}, commandDescription ="Update clinical analysis report") + public class UpdateReportCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @Parameter(names = {"--json-file"}, description = "File with the body data in JSON format. Note, that using this parameter will ignore all the other parameters.", required = false, arity = 1) + public String jsonFile; + + @Parameter(names = {"--json-data-model"}, description = "Show example of file structure for body data.", help = true, arity = 0) + public Boolean jsonDataModel = false; + + @Parameter(names = {"--include", "-I"}, description = "Fields included in the response, whole JSON path must be provided", required = false, arity = 1) + public String include; + + @Parameter(names = {"--exclude", "-E"}, description = "Fields excluded in the response, whole JSON path must be provided", required = false, arity = 1) + public String exclude; + + @Parameter(names = {"--clinical-analysis"}, description = "Clinical analysis ID", required = true, arity = 1) + public String clinicalAnalysis; + + @Parameter(names = {"--study", "-s"}, description = "Study [[organization@]project:]study where study and project can be either the ID or UUID", required = false, arity = 1) + public String study; + + @Parameter(names = {"--supporting-evidences-action"}, description = "Action to be performed if the array of supporting evidences is being updated.", required = false, arity = 1) + public String supportingEvidencesAction = "ADD"; + + @Parameter(names = {"--include-result"}, description = "Flag indicating to include the created or updated document result in the response", required = false, help = true, arity = 0) + public boolean includeResult = false; + + @Parameter(names = {"--title"}, description = "Report title.", required = false, arity = 1) + public String title; + + @Parameter(names = {"--overview"}, description = "Report overview.", required = false, arity = 1) + public String overview; + + @Parameter(names = {"--discussion-author"}, description = "The body web service author parameter", required = false, arity = 1) + public String discussionAuthor; + + @Parameter(names = {"--discussion-date"}, description = "The body web service date parameter", required = false, arity = 1) + public String discussionDate; + + @Parameter(names = {"--discussion-text"}, description = "The body web service text parameter", required = false, arity = 1) + public String discussionText; + + @Parameter(names = {"--logo"}, description = "Report logo.", required = false, arity = 1) + public String logo; + + @Parameter(names = {"--signed-by"}, description = "Indicates who has signed the report.", required = false, arity = 1) + public String signedBy; + + @Parameter(names = {"--signature"}, description = "Report signature.", required = false, arity = 1) + public String signature; + + @Parameter(names = {"--date"}, description = "Report date.", required = false, arity = 1) + public String date; + + } + } \ No newline at end of file diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java index 526f961225d..82b9edc17a4 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java @@ -1174,16 +1174,16 @@ public class RunIndividualQcCommandOptions { @Parameter(names = {"--job-tags"}, description = "Job tags", required = false, arity = 1) public String jobTags; - @Parameter(names = {"--individual"}, description = "The body web service individual parameter", required = false, arity = 1) + @Parameter(names = {"--individual"}, description = "Individual ID", required = false, arity = 1) public String individual; - @Parameter(names = {"--sample"}, description = "The body web service sample parameter", required = false, arity = 1) + @Parameter(names = {"--sample"}, description = "Sample ID (required when the individual has multiple samples)", required = false, arity = 1) public String sample; - @Parameter(names = {"--inferred-sex-method"}, description = "The body web service inferredSexMethod parameter", required = false, arity = 1) - public String inferredSexMethod; + @Parameter(names = {"--inferred-sex-method"}, description = "Inferred sex method. Valid values: CoverageRatio", required = false, arity = 1) + public String inferredSexMethod = "CoverageRatio"; - @Parameter(names = {"--outdir"}, description = "The body web service outdir parameter", required = false, arity = 1) + @Parameter(names = {"--outdir"}, description = "Output dir for the job.", required = false, arity = 1) public String outdir; } @@ -1215,13 +1215,13 @@ public class RunInferredSexCommandOptions { @Parameter(names = {"--job-tags"}, description = "Job tags", required = false, arity = 1) public String jobTags; - @Parameter(names = {"--individual"}, description = "The body web service individual parameter", required = false, arity = 1) + @Parameter(names = {"--individual"}, description = "Individual ID", required = false, arity = 1) public String individual; - @Parameter(names = {"--sample"}, description = "The body web service sample parameter", required = false, arity = 1) + @Parameter(names = {"--sample"}, description = "Sample ID (required when the individual has multiple samples)", required = false, arity = 1) public String sample; - @Parameter(names = {"--outdir"}, description = "The body web service outdir parameter", required = false, arity = 1) + @Parameter(names = {"--outdir"}, description = "Output dir for the job.", required = false, arity = 1) public String outdir; } diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/MetaCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/MetaCommandOptions.java index 4cb695c9e32..c72e4325362 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/MetaCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/MetaCommandOptions.java @@ -87,6 +87,9 @@ public class ModelCommandOptions { @ParametersDelegate public CommonCommandOptions commonOptions = commonCommandOptions; + @Parameter(names = {"--model"}, description = "Model description", required = false, arity = 1) + public String model; + } @Parameters(commandNames = {"ping"}, commandDescription ="Ping Opencga webservices.") diff --git a/opencga-catalog/pom.xml b/opencga-catalog/pom.xml index 1c630e8d691..fac816b2a76 100644 --- a/opencga-catalog/pom.xml +++ b/opencga-catalog/pom.xml @@ -23,7 +23,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/ClinicalAnalysisDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/ClinicalAnalysisDBAdaptor.java index a4b3d8f19b4..9ba04a571c1 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/ClinicalAnalysisDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/ClinicalAnalysisDBAdaptor.java @@ -73,6 +73,7 @@ enum QueryParams implements QueryParam { ANALYSTS_ID("analysts.id", TEXT, ""), ANALYSTS_ASSIGNED_BY("analysts.assignedBy", TEXT, ""), REPORT("report", OBJECT, ""), + REPORT_UPDATE("report_update", OBJECT, ""), // Made up key to be able to set inner fields and not the entire object REPORT_SUPPORTING_EVIDENCES("report.supportingEvidences", TEXT_ARRAY, ""), REPORT_FILES("report.files", TEXT_ARRAY, ""), REQUEST("request", OBJECT, ""), @@ -165,6 +166,13 @@ public static QueryParams getParam(String key) { } enum ReportQueryParams implements QueryParam { + TITLE("title", STRING, ""), + OVERVIEW("overview", STRING, ""), + DISCUSSION("discussion", OBJECT, ""), + LOGO("logo", STRING, ""), + SIGNED_BY("signedBy", STRING, ""), + SIGNATURE("signature", STRING, ""), + DATE("date", STRING, ""), COMMENTS("comments", OBJECT, ""), SUPPORTING_EVIDENCES("supportingEvidences", TEXT_ARRAY, ""), FILES("files", TEXT_ARRAY, ""); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/ClinicalAnalysisMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/ClinicalAnalysisMongoDBAdaptor.java index 8aaeacc769f..59fc3d56df9 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/ClinicalAnalysisMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/ClinicalAnalysisMongoDBAdaptor.java @@ -142,18 +142,18 @@ static void fixPanelsForRemoval(ObjectMap parameters) { parameters.put(PANELS.key(), panelParamList); } - static void fixFilesForRemoval(ObjectMap parameters) { - if (parameters.get(FILES.key()) == null) { + static void fixFilesForRemoval(ObjectMap parameters, String key) { + if (parameters.get(key) == null) { return; } List fileParamList = new LinkedList<>(); - for (Object file : parameters.getAsList(FILES.key())) { + for (Object file : parameters.getAsList(key)) { if (file instanceof File) { fileParamList.add(new Document("uid", ((File) file).getUid())); } } - parameters.put(FILES.key(), fileParamList); + parameters.put(key, fileParamList); } static void fixAnalystsForRemoval(ObjectMap parameters) { @@ -410,13 +410,87 @@ UpdateDocument parseAndValidateUpdateParams(ObjectMap parameters, List actionMap = queryOptions.getMap(Constants.ACTIONS, new HashMap<>()); + + if (parameters.containsKey(REPORT_UPDATE.key())) { + ObjectMap reportParameters = parameters.getNestedMap(REPORT_UPDATE.key()); + reportParameters.put(ReportQueryParams.DATE.key(), TimeUtils.getTime()); + String[] stringParams = {ReportQueryParams.TITLE.key(), ReportQueryParams.OVERVIEW.key(), ReportQueryParams.LOGO.key(), + ReportQueryParams.SIGNED_BY.key(), ReportQueryParams.SIGNATURE.key(), ReportQueryParams.DATE.key(), }; + filterStringParams(reportParameters, document.getSet(), stringParams, REPORT.key() + "."); + + String[] objectParams = {ReportQueryParams.DISCUSSION.key()}; + filterObjectParams(reportParameters, document.getSet(), objectParams, REPORT.key() + "."); + + String[] commentParams = {ReportQueryParams.COMMENTS.key()}; + ParamUtils.AddRemoveReplaceAction basicOperation = ParamUtils.AddRemoveReplaceAction + .from(actionMap, ReportQueryParams.COMMENTS.key(), ParamUtils.AddRemoveReplaceAction.ADD); + switch (basicOperation) { + case REMOVE: + fixCommentsForRemoval(reportParameters); + filterObjectParams(reportParameters, document.getPull(), commentParams, REPORT.key() + "."); + break; + case ADD: + filterObjectParams(reportParameters, document.getAddToSet(), commentParams, REPORT.key() + "."); + break; + case REPLACE: + filterReplaceParams(reportParameters.getAsList(ReportQueryParams.COMMENTS.key(), ClinicalComment.class), document, + ClinicalComment::getDate, QueryParams.REPORT.key() + "." + QueryParams.COMMENTS_DATE.key()); + break; + default: + throw new IllegalStateException("Unknown operation " + basicOperation); + } + + String[] filesParams = new String[]{ReportQueryParams.FILES.key()}; + ParamUtils.BasicUpdateAction operation = ParamUtils.BasicUpdateAction.from(actionMap, ReportQueryParams.FILES.key(), + ParamUtils.BasicUpdateAction.ADD); + switch (operation) { + case SET: + filterObjectParams(reportParameters, document.getSet(), filesParams, QueryParams.REPORT.key() + "."); + clinicalConverter.validateFilesToUpdate(document.getSet(), QueryParams.REPORT.key() + "." + + ReportQueryParams.FILES.key()); + break; + case REMOVE: + fixFilesForRemoval(reportParameters, ReportQueryParams.FILES.key()); + filterObjectParams(reportParameters, document.getPull(), filesParams, QueryParams.REPORT.key() + "."); + break; + case ADD: + filterObjectParams(reportParameters, document.getAddToSet(), filesParams, QueryParams.REPORT.key() + "."); + clinicalConverter.validateFilesToUpdate(document.getAddToSet(), QueryParams.REPORT.key() + "." + + ReportQueryParams.FILES.key()); + break; + default: + throw new IllegalStateException("Unknown operation " + basicOperation); + } + + String[] supportingEvidencesParams = new String[]{ReportQueryParams.SUPPORTING_EVIDENCES.key()}; + operation = ParamUtils.BasicUpdateAction.from(actionMap, ReportQueryParams.SUPPORTING_EVIDENCES.key(), + ParamUtils.BasicUpdateAction.ADD); + switch (operation) { + case SET: + filterObjectParams(reportParameters, document.getSet(), supportingEvidencesParams, QueryParams.REPORT.key() + "."); + clinicalConverter.validateFilesToUpdate(document.getSet(), QueryParams.REPORT.key() + "." + + ReportQueryParams.SUPPORTING_EVIDENCES.key()); + break; + case REMOVE: + fixFilesForRemoval(reportParameters, ReportQueryParams.SUPPORTING_EVIDENCES.key()); + filterObjectParams(reportParameters, document.getPull(), supportingEvidencesParams, QueryParams.REPORT.key() + "."); + break; + case ADD: + filterObjectParams(reportParameters, document.getAddToSet(), supportingEvidencesParams, QueryParams.REPORT.key() + "."); + clinicalConverter.validateFilesToUpdate(document.getAddToSet(), QueryParams.REPORT.key() + "." + + ReportQueryParams.SUPPORTING_EVIDENCES.key()); + break; + default: + throw new IllegalStateException("Unknown operation " + basicOperation); + } + } + clinicalConverter.validateInterpretationToUpdate(document.getSet()); clinicalConverter.validateFamilyToUpdate(document.getSet()); clinicalConverter.validateProbandToUpdate(document.getSet()); clinicalConverter.validateReportToUpdate(document.getSet()); - Map actionMap = queryOptions.getMap(Constants.ACTIONS, new HashMap<>()); - String[] objectAcceptedParams = new String[]{QueryParams.COMMENTS.key()}; ParamUtils.AddRemoveReplaceAction basicOperation = ParamUtils.AddRemoveReplaceAction.from(actionMap, QueryParams.COMMENTS.key(), ParamUtils.AddRemoveReplaceAction.ADD); @@ -463,7 +537,7 @@ UpdateDocument parseAndValidateUpdateParams(ObjectMap parameters, List filter } static void filterStringParams(ObjectMap parameters, Map filteredParams, String[] acceptedParams) { + filterStringParams(parameters, filteredParams, acceptedParams, ""); + } + + static void filterStringParams(ObjectMap parameters, Map filteredParams, String[] acceptedParams, String dbKeyPrefix) { for (String s : acceptedParams) { if (parameters.containsKey(s)) { - filteredParams.put(s, parameters.getString(s)); + filteredParams.put(dbKeyPrefix + s, parameters.getString(s)); } } } @@ -361,6 +365,11 @@ static void filterMapParams(ObjectMap parameters, Map filteredPa } static void filterObjectParams(ObjectMap parameters, Map filteredParams, String[] acceptedMapParams) { + filterObjectParams(parameters, filteredParams, acceptedMapParams, ""); + } + + static void filterObjectParams(ObjectMap parameters, Map filteredParams, String[] acceptedMapParams, + String dbKeyPrefix) { for (String s : acceptedMapParams) { if (parameters.containsKey(s)) { Document document; @@ -371,10 +380,10 @@ static void filterObjectParams(ObjectMap parameters, Map filtere for (Object object : originalList) { documentList.add(getMongoDBDocument(object, s)); } - filteredParams.put(s, documentList); + filteredParams.put(dbKeyPrefix + s, documentList); } else { document = getMongoDBDocument(parameters.get(s), s); - filteredParams.put(s, document); + filteredParams.put(dbKeyPrefix + s, document); } } catch (CatalogDBException e) { logger.warn("Skipping key '" + s + "': " + e.getMessage(), e); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/converters/ClinicalAnalysisConverter.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/converters/ClinicalAnalysisConverter.java index 45fff9dd2f3..ed7494ae2c9 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/converters/ClinicalAnalysisConverter.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/converters/ClinicalAnalysisConverter.java @@ -156,10 +156,14 @@ public void validatePanelsToUpdate(Document document) { } } - public void validateFilesToUpdate(Document document) { - List files = (List) document.get(ClinicalAnalysisDBAdaptor.QueryParams.FILES.key()); + public void validateFilesToUpdate(Document document, String key) { + List files = (List) document.get(key); List reducedFiles = getReducedFileDocuments(files); - document.put(ClinicalAnalysisDBAdaptor.QueryParams.FILES.key(), reducedFiles); + document.put(key, reducedFiles); + } + + public void validateFilesToUpdate(Document document) { + validateFilesToUpdate(document, ClinicalAnalysisDBAdaptor.QueryParams.FILES.key()); } private static List getReducedFileDocuments(List files) { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java index 0636b147a58..5640aeae5ed 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManager.java @@ -1696,6 +1696,94 @@ private OpenCGAResult update(String organizationId, Study stud return update; } + public OpenCGAResult updateReport(String studyStr, String clinicalAnalysisId, ClinicalReport report, + QueryOptions options, String token) throws CatalogException { + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + + String operationId = UuidUtils.generateOpenCgaUuid(UuidUtils.Entity.AUDIT); + + ObjectMap auditParams = new ObjectMap() + .append("study", studyStr) + .append("clinicalAnalysisId", clinicalAnalysisId) + .append("report", report) + .append("options", options) + .append("token", token); + + String caseId = clinicalAnalysisId; + String caseUuid = ""; + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + String studyId = studyFqn.getStudyId(); + String studyUuid = studyFqn.getStudyUuid(); + try { + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + options = ParamUtils.defaultObject(options, QueryOptions::new); + ClinicalAnalysis clinicalAnalysis = internalGet(organizationId, study.getUid(), clinicalAnalysisId, INCLUDE_CLINICAL_IDS, + userId).first(); + authorizationManager.checkClinicalAnalysisPermission(organizationId, study.getUid(), clinicalAnalysis.getUid(), userId, + ClinicalAnalysisPermissions.WRITE); + caseId = clinicalAnalysis.getId(); + caseUuid = clinicalAnalysis.getUuid(); + + ObjectMap updateMap; + try { + updateMap = new ObjectMap(getUpdateObjectMapper().writeValueAsString(report)); + } catch (JsonProcessingException e) { + throw new CatalogException("Could not parse report object: " + e.getMessage(), e); + } + + Map actionMap = options.getMap(ParamConstants.ACTION, new HashMap<>()); + if (report.getComments() != null) { + ParamUtils.AddRemoveReplaceAction basicOperation = ParamUtils.AddRemoveReplaceAction + .from(actionMap, ClinicalAnalysisDBAdaptor.ReportQueryParams.COMMENTS.key(), ParamUtils.AddRemoveReplaceAction.ADD); + if (basicOperation != ParamUtils.AddRemoveReplaceAction.ADD) { + for (ClinicalComment comment : report.getComments()) { + comment.setDate(TimeUtils.getTime()); + comment.setAuthor(userId); + } + } + updateMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.COMMENTS.key(), report.getComments()); + } + if (CollectionUtils.isNotEmpty(report.getFiles())) { + List files = obtainFiles(organizationId, study, userId, report.getFiles()); + updateMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.FILES.key(), files, false); + } + if (CollectionUtils.isNotEmpty(report.getSupportingEvidences())) { + List files = obtainFiles(organizationId, study, userId, report.getSupportingEvidences()); + updateMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.SUPPORTING_EVIDENCES.key(), files, false); + } + ClinicalAudit clinicalAudit = new ClinicalAudit(userId, ClinicalAudit.Action.UPDATE_CLINICAL_ANALYSIS, + "Update ClinicalAnalysis '" + clinicalAnalysis.getId() + "' report.", TimeUtils.getTime()); + + // Add custom key to ensure it is properly updated + updateMap = new ObjectMap(ClinicalAnalysisDBAdaptor.QueryParams.REPORT_UPDATE.key(), updateMap); + OpenCGAResult update = getClinicalAnalysisDBAdaptor(organizationId) + .update(clinicalAnalysis.getUid(), updateMap, null, Collections.singletonList(clinicalAudit), options); + auditManager.auditUpdate(operationId, userId, Enums.Resource.CLINICAL_ANALYSIS, caseId, caseUuid, study.getId(), + study.getUuid(), auditParams, new AuditRecord.Status(AuditRecord.Status.Result.SUCCESS)); + if (options.getBoolean(ParamConstants.INCLUDE_RESULT_PARAM)) { + // Fetch updated clinical analysis + OpenCGAResult result = getClinicalAnalysisDBAdaptor(organizationId).get(study.getUid(), + new Query(ClinicalAnalysisDBAdaptor.QueryParams.UID.key(), clinicalAnalysis.getUid()), options, userId); + update.setResults(result.getResults()); + } + List reportList = new ArrayList<>(update.getResults().size()); + if (update.getNumResults() > 0) { + for (ClinicalAnalysis result : update.getResults()) { + reportList.add(result.getReport()); + } + } + return new OpenCGAResult<>(update.getTime(), update.getEvents(), update.getNumResults(), reportList, + update.getNumMatches(), update.getNumInserted(), update.getNumUpdated(), update.getNumDeleted(), + update.getNumErrors(), update.getAttributes(), update.getFederationNode()); + } catch (CatalogException e) { + auditManager.auditUpdate(operationId, userId, Enums.Resource.CLINICAL_ANALYSIS, caseId, caseUuid, studyId, studyUuid, + auditParams, new AuditRecord.Status(AuditRecord.Status.Result.ERROR, e.getError())); + throw e; + } + } + /** * Sort the family members in the following order: proband, father, mother, others. * diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManagerTest.java index 350dcc4bf9d..cf267f04b71 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/ClinicalAnalysisManagerTest.java @@ -446,6 +446,151 @@ public void updateClinicalAnalysisReport() throws CatalogException { new ClinicalAnalysisUpdateParams().setReport(report), INCLUDE_RESULT, ownerToken); } + @Test + public void updateClinicalAnalysisReportWithActions() throws CatalogException { + ClinicalAnalysis case1 = createDummyEnvironment(true, true).first(); + assertNull(case1.getReport()); + + // Add files + catalogManager.getFileManager().create(studyFqn, + new FileCreateParams() + .setContent(RandomStringUtils.randomAlphanumeric(1000)) + .setPath("/data/file1.txt") + .setType(File.Type.FILE), + true, ownerToken); + catalogManager.getFileManager().create(studyFqn, + new FileCreateParams() + .setContent(RandomStringUtils.randomAlphanumeric(1000)) + .setPath("/data/file2.txt") + .setType(File.Type.FILE), + true, ownerToken); + catalogManager.getFileManager().create(studyFqn, + new FileCreateParams() + .setContent(RandomStringUtils.randomAlphanumeric(1000)) + .setPath("/data/file3.txt") + .setType(File.Type.FILE), + true, ownerToken); + + ClinicalReport report = new ClinicalReport("title", "overview", new ClinicalDiscussion("me", TimeUtils.getTime(), "text"), "logo", + "me", "signature", TimeUtils.getTime(), Arrays.asList( + new ClinicalComment().setMessage("comment1"), + new ClinicalComment().setMessage("comment2") + ), + Collections.singletonList(new File().setId("data:file1.txt")), + Collections.singletonList(new File().setId("data:file2.txt"))); + OpenCGAResult result = catalogManager.getClinicalAnalysisManager().update(studyFqn, case1.getId(), + new ClinicalAnalysisUpdateParams().setReport(report), INCLUDE_RESULT, ownerToken); + assertNotNull(result.first().getReport()); + assertEquals(report.getTitle(), result.first().getReport().getTitle()); + assertEquals(report.getOverview(), result.first().getReport().getOverview()); + assertEquals(report.getDate(), result.first().getReport().getDate()); + assertEquals(report.getLogo(), result.first().getReport().getLogo()); + assertEquals(report.getSignature(), result.first().getReport().getSignature()); + assertEquals(report.getSignedBy(), result.first().getReport().getSignedBy()); + assertEquals(2, result.first().getReport().getComments().size()); + assertEquals(1, result.first().getReport().getFiles().size()); + assertEquals(1, result.first().getReport().getSupportingEvidences().size()); + + // Add comment + // Set files + // Remove supporting evidence + ObjectMap actionMap = new ObjectMap() + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.COMMENTS.key(), ParamUtils.AddRemoveAction.ADD) + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.FILES.key(), ParamUtils.BasicUpdateAction.SET) + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.SUPPORTING_EVIDENCES.key(), ParamUtils.BasicUpdateAction.REMOVE); + QueryOptions options = new QueryOptions() + .append(Constants.ACTIONS, actionMap) + .append(ParamConstants.INCLUDE_RESULT_PARAM, true); + ClinicalReport reportToUpdate = new ClinicalReport() + .setComments(Collections.singletonList(new ClinicalComment().setMessage("comment3"))) + .setFiles(Arrays.asList( + new File().setId("data:file2.txt"), + new File().setId("data:file3.txt") + )) + .setSupportingEvidences(Collections.singletonList(new File().setId("data:file1.txt"))); + ClinicalReport reportResult = catalogManager.getClinicalAnalysisManager().updateReport(studyFqn, case1.getId(), reportToUpdate, + options, ownerToken).first(); + // Check comments + assertEquals(3, reportResult.getComments().size()); + assertEquals("comment1", reportResult.getComments().get(0).getMessage()); + assertEquals("comment2", reportResult.getComments().get(1).getMessage()); + assertEquals("comment3", reportResult.getComments().get(2).getMessage()); + + // Check files + assertEquals(2, reportResult.getFiles().size()); + assertTrue(reportResult.getFiles().stream().map(File::getPath).collect(Collectors.toSet()).containsAll(Arrays.asList("data/file2.txt", "data/file3.txt"))); + + // Check supporting evidences + assertEquals(0, reportResult.getSupportingEvidences().size()); + + + // Remove comment + // Remove file + // Set supporting evidences + actionMap = new ObjectMap() + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.COMMENTS.key(), ParamUtils.AddRemoveAction.REMOVE) + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.FILES.key(), ParamUtils.BasicUpdateAction.REMOVE) + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.SUPPORTING_EVIDENCES.key(), ParamUtils.BasicUpdateAction.SET); + options = new QueryOptions() + .append(Constants.ACTIONS, actionMap) + .append(ParamConstants.INCLUDE_RESULT_PARAM, true); + reportToUpdate = new ClinicalReport() + .setComments(Arrays.asList(reportResult.getComments().get(0), reportResult.getComments().get(1))) + .setFiles(Collections.singletonList(new File().setId("data:file3.txt"))) + .setSupportingEvidences(Arrays.asList( + new File().setId("data:file1.txt"), + new File().setId("data:file3.txt") + )); + ClinicalComment pendingComment = reportResult.getComments().get(2); + reportResult = catalogManager.getClinicalAnalysisManager().updateReport(studyFqn, case1.getId(), reportToUpdate, + options, ownerToken).first(); + // Check comments + assertEquals(1, reportResult.getComments().size()); + assertEquals(pendingComment.getMessage(), reportResult.getComments().get(0).getMessage()); + + // Check supporting evidences + assertEquals(2, reportResult.getSupportingEvidences().size()); + assertTrue(reportResult.getSupportingEvidences().stream().map(File::getPath).collect(Collectors.toSet()) + .containsAll(Arrays.asList("data/file1.txt", "data/file3.txt"))); + + // Check files + assertEquals(1, reportResult.getFiles().size()); + assertEquals("data/file2.txt", reportResult.getFiles().get(0).getPath()); + + + // Add file + // Add supporting evidences + actionMap = new ObjectMap() + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.FILES.key(), ParamUtils.BasicUpdateAction.ADD) + .append(ClinicalAnalysisDBAdaptor.ReportQueryParams.SUPPORTING_EVIDENCES.key(), ParamUtils.BasicUpdateAction.ADD); + options = new QueryOptions() + .append(Constants.ACTIONS, actionMap) + .append(ParamConstants.INCLUDE_RESULT_PARAM, true); + reportToUpdate = new ClinicalReport() + .setFiles(Arrays.asList( + new File().setId("data:file1.txt"), + new File().setId("data:file3.txt") + )) + .setSupportingEvidences(Collections.singletonList( + new File().setId("data:file2.txt") + )); + reportResult = catalogManager.getClinicalAnalysisManager().updateReport(studyFqn, case1.getId(), reportToUpdate, + options, ownerToken).first(); + // Check comments + assertEquals(1, reportResult.getComments().size()); + assertEquals("comment3", reportResult.getComments().get(0).getMessage()); + + // Check files + assertEquals(3, reportResult.getFiles().size()); + assertTrue(reportResult.getFiles().stream().map(File::getPath).collect(Collectors.toSet()) + .containsAll(Arrays.asList("data/file1.txt", "data/file2.txt", "data/file3.txt"))); + + // Check supporting evidences + assertEquals(3, reportResult.getSupportingEvidences().size()); + assertTrue(reportResult.getSupportingEvidences().stream().map(File::getPath).collect(Collectors.toSet()) + .containsAll(Arrays.asList("data/file1.txt", "data/file2.txt", "data/file3.txt"))); + } + @Test public void createAndUpdateClinicalAnalysisWithQualityControl() throws CatalogException, InterruptedException { Individual individual = new Individual().setId("child1").setSamples(Arrays.asList(new Sample().setId("sample2"))); diff --git a/opencga-client/pom.xml b/opencga-client/pom.xml index e8e9c753dd4..ce253ddc6ae 100644 --- a/opencga-client/pom.xml +++ b/opencga-client/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-client/src/main/R/R/Admin-methods.R b/opencga-client/src/main/R/R/Admin-methods.R index 707daa2b23b..6bf61415c9b 100644 --- a/opencga-client/src/main/R/R/Admin-methods.R +++ b/opencga-client/src/main/R/R/Admin-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Alignment-methods.R b/opencga-client/src/main/R/R/Alignment-methods.R index c8659700389..69c82c573a3 100644 --- a/opencga-client/src/main/R/R/Alignment-methods.R +++ b/opencga-client/src/main/R/R/Alignment-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/AllGenerics.R b/opencga-client/src/main/R/R/AllGenerics.R index 9b9e50d376b..1b566838bf7 100644 --- a/opencga-client/src/main/R/R/AllGenerics.R +++ b/opencga-client/src/main/R/R/AllGenerics.R @@ -5,52 +5,52 @@ setGeneric("organizationClient", function(OpencgaR, organization, endpointName, # ############################################################################## ## UserClient -setGeneric("userClient", function(OpencgaR, user, filterId, users, endpointName, params=NULL, ...) +setGeneric("userClient", function(OpencgaR, filterId, users, user, endpointName, params=NULL, ...) standardGeneric("userClient")) # ############################################################################## ## ProjectClient -setGeneric("projectClient", function(OpencgaR, project, projects, endpointName, params=NULL, ...) +setGeneric("projectClient", function(OpencgaR, projects, project, endpointName, params=NULL, ...) standardGeneric("projectClient")) # ############################################################################## ## StudyClient -setGeneric("studyClient", function(OpencgaR, group, members, templateId, studies, study, variableSet, endpointName, params=NULL, ...) +setGeneric("studyClient", function(OpencgaR, studies, variableSet, members, templateId, group, study, endpointName, params=NULL, ...) standardGeneric("studyClient")) # ############################################################################## ## FileClient -setGeneric("fileClient", function(OpencgaR, file, annotationSet, members, files, folder, endpointName, params=NULL, ...) +setGeneric("fileClient", function(OpencgaR, folder, files, members, annotationSet, file, endpointName, params=NULL, ...) standardGeneric("fileClient")) # ############################################################################## ## JobClient -setGeneric("jobClient", function(OpencgaR, job, members, jobs, endpointName, params=NULL, ...) +setGeneric("jobClient", function(OpencgaR, members, job, jobs, endpointName, params=NULL, ...) standardGeneric("jobClient")) # ############################################################################## ## SampleClient -setGeneric("sampleClient", function(OpencgaR, members, annotationSet, sample, samples, endpointName, params=NULL, ...) +setGeneric("sampleClient", function(OpencgaR, samples, annotationSet, sample, members, endpointName, params=NULL, ...) standardGeneric("sampleClient")) # ############################################################################## ## IndividualClient -setGeneric("individualClient", function(OpencgaR, individual, members, annotationSet, individuals, endpointName, params=NULL, ...) +setGeneric("individualClient", function(OpencgaR, annotationSet, individuals, members, individual, endpointName, params=NULL, ...) standardGeneric("individualClient")) # ############################################################################## ## FamilyClient -setGeneric("familyClient", function(OpencgaR, members, annotationSet, families, family, endpointName, params=NULL, ...) +setGeneric("familyClient", function(OpencgaR, annotationSet, family, members, families, endpointName, params=NULL, ...) standardGeneric("familyClient")) # ############################################################################## ## CohortClient -setGeneric("cohortClient", function(OpencgaR, cohort, members, annotationSet, cohorts, endpointName, params=NULL, ...) +setGeneric("cohortClient", function(OpencgaR, cohort, annotationSet, cohorts, members, endpointName, params=NULL, ...) standardGeneric("cohortClient")) # ############################################################################## ## PanelClient -setGeneric("panelClient", function(OpencgaR, members, panels, endpointName, params=NULL, ...) +setGeneric("panelClient", function(OpencgaR, panels, members, endpointName, params=NULL, ...) standardGeneric("panelClient")) # ############################################################################## @@ -65,7 +65,7 @@ setGeneric("variantClient", function(OpencgaR, endpointName, params=NULL, ...) # ############################################################################## ## ClinicalClient -setGeneric("clinicalClient", function(OpencgaR, annotationSet, clinicalAnalysis, interpretations, members, clinicalAnalyses, interpretation, endpointName, params=NULL, ...) +setGeneric("clinicalClient", function(OpencgaR, clinicalAnalysis, members, annotationSet, interpretation, interpretations, clinicalAnalyses, endpointName, params=NULL, ...) standardGeneric("clinicalClient")) # ############################################################################## diff --git a/opencga-client/src/main/R/R/Clinical-methods.R b/opencga-client/src/main/R/R/Clinical-methods.R index 87f8857e184..f807bde4301 100644 --- a/opencga-client/src/main/R/R/Clinical-methods.R +++ b/opencga-client/src/main/R/R/Clinical-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -54,6 +54,7 @@ #' | deleteInterpretation | /{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/{interpretations}/delete | study, clinicalAnalysis[*], interpretations[*], setAsPrimary | #' | revertInterpretation | /{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/{interpretation}/revert | study, clinicalAnalysis[*], interpretation[*], version[*] | #' | updateInterpretation | /{apiVersion}/analysis/clinical/{clinicalAnalysis}/interpretation/{interpretation}/update | include, exclude, study, primaryFindingsAction, methodsAction, secondaryFindingsAction, commentsAction, panelsAction, setAs, clinicalAnalysis[*], interpretation[*], includeResult, body[*] | +#' | updateReport | /{apiVersion}/analysis/clinical/{clinicalAnalysis}/report/update | include, exclude, clinicalAnalysis[*], study, commentsAction, supportingEvidencesAction, filesAction, includeResult, body[*] | #' #' @md #' @seealso \url{http://docs.opencb.org/display/opencga/Using+OpenCGA} and the RESTful API documentation @@ -61,7 +62,7 @@ #' [*]: Required parameter #' @export -setMethod("clinicalClient", "OpencgaR", function(OpencgaR, annotationSet, clinicalAnalysis, interpretations, members, clinicalAnalyses, interpretation, endpointName, params=NULL, ...) { +setMethod("clinicalClient", "OpencgaR", function(OpencgaR, clinicalAnalysis, members, annotationSet, interpretation, interpretations, clinicalAnalyses, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/analysis/clinical/acl/{members}/update: @@ -727,5 +728,20 @@ setMethod("clinicalClient", "OpencgaR", function(OpencgaR, annotationSet, clinic updateInterpretation=fetchOpenCGA(object=OpencgaR, category="analysis/clinical", categoryId=clinicalAnalysis, subcategory="interpretation", subcategoryId=interpretation, action="update", params=params, httpMethod="POST", as.queryParam=NULL, ...), + + #' @section Endpoint /{apiVersion}/analysis/clinical/{clinicalAnalysis}/report/update: + #' Update clinical analysis report. + #' @param include Fields included in the response, whole JSON path must be provided. + #' @param exclude Fields excluded in the response, whole JSON path must be provided. + #' @param clinicalAnalysis Clinical analysis ID. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param commentsAction Action to be performed if the array of comments is being updated. Allowed values: ['ADD REMOVE REPLACE'] + #' @param supportingEvidencesAction Action to be performed if the array of supporting evidences is being updated. Allowed values: ['ADD SET REMOVE'] + #' @param filesAction Action to be performed if the array of files is being updated. Allowed values: ['ADD SET REMOVE'] + #' @param includeResult Flag indicating to include the created or updated document result in the response. + #' @param data JSON containing clinical report information. + updateReport=fetchOpenCGA(object=OpencgaR, category="analysis/clinical", categoryId=clinicalAnalysis, + subcategory="report", subcategoryId=NULL, action="update", params=params, httpMethod="POST", + as.queryParam=NULL, ...), ) }) \ No newline at end of file diff --git a/opencga-client/src/main/R/R/Cohort-methods.R b/opencga-client/src/main/R/R/Cohort-methods.R index 8ecc2a2a569..99482a604c9 100644 --- a/opencga-client/src/main/R/R/Cohort-methods.R +++ b/opencga-client/src/main/R/R/Cohort-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -38,7 +38,7 @@ #' [*]: Required parameter #' @export -setMethod("cohortClient", "OpencgaR", function(OpencgaR, cohort, members, annotationSet, cohorts, endpointName, params=NULL, ...) { +setMethod("cohortClient", "OpencgaR", function(OpencgaR, cohort, annotationSet, cohorts, members, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/cohorts/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Family-methods.R b/opencga-client/src/main/R/R/Family-methods.R index 09fa66b277b..f41421db5a1 100644 --- a/opencga-client/src/main/R/R/Family-methods.R +++ b/opencga-client/src/main/R/R/Family-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -37,7 +37,7 @@ #' [*]: Required parameter #' @export -setMethod("familyClient", "OpencgaR", function(OpencgaR, members, annotationSet, families, family, endpointName, params=NULL, ...) { +setMethod("familyClient", "OpencgaR", function(OpencgaR, annotationSet, family, members, families, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/families/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/File-methods.R b/opencga-client/src/main/R/R/File-methods.R index e7fd203262e..8b8e60cf054 100644 --- a/opencga-client/src/main/R/R/File-methods.R +++ b/opencga-client/src/main/R/R/File-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -53,7 +53,7 @@ #' [*]: Required parameter #' @export -setMethod("fileClient", "OpencgaR", function(OpencgaR, file, annotationSet, members, files, folder, endpointName, params=NULL, ...) { +setMethod("fileClient", "OpencgaR", function(OpencgaR, folder, files, members, annotationSet, file, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/files/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/GA4GH-methods.R b/opencga-client/src/main/R/R/GA4GH-methods.R index 0798244b349..a176ca0951d 100644 --- a/opencga-client/src/main/R/R/GA4GH-methods.R +++ b/opencga-client/src/main/R/R/GA4GH-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Individual-methods.R b/opencga-client/src/main/R/R/Individual-methods.R index 82244dd5909..3a9e4d0710d 100644 --- a/opencga-client/src/main/R/R/Individual-methods.R +++ b/opencga-client/src/main/R/R/Individual-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -38,7 +38,7 @@ #' [*]: Required parameter #' @export -setMethod("individualClient", "OpencgaR", function(OpencgaR, individual, members, annotationSet, individuals, endpointName, params=NULL, ...) { +setMethod("individualClient", "OpencgaR", function(OpencgaR, annotationSet, individuals, members, individual, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/individuals/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Job-methods.R b/opencga-client/src/main/R/R/Job-methods.R index a7875bc8330..1d033cbc80a 100644 --- a/opencga-client/src/main/R/R/Job-methods.R +++ b/opencga-client/src/main/R/R/Job-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ #' [*]: Required parameter #' @export -setMethod("jobClient", "OpencgaR", function(OpencgaR, job, members, jobs, endpointName, params=NULL, ...) { +setMethod("jobClient", "OpencgaR", function(OpencgaR, members, job, jobs, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/jobs/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Meta-methods.R b/opencga-client/src/main/R/R/Meta-methods.R index e730fbeba31..975200c2b12 100644 --- a/opencga-client/src/main/R/R/Meta-methods.R +++ b/opencga-client/src/main/R/R/Meta-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -23,7 +23,7 @@ #' | about | /{apiVersion}/meta/about | | #' | api | /{apiVersion}/meta/api | category | #' | fail | /{apiVersion}/meta/fail | | -#' | model | /{apiVersion}/meta/model | | +#' | model | /{apiVersion}/meta/model | model | #' | ping | /{apiVersion}/meta/ping | | #' | status | /{apiVersion}/meta/status | | #' @@ -56,7 +56,7 @@ setMethod("metaClient", "OpencgaR", function(OpencgaR, endpointName, params=NULL #' @section Endpoint /{apiVersion}/meta/model: #' Opencga model webservices. - + #' @param model Model description. model=fetchOpenCGA(object=OpencgaR, category="meta", categoryId=NULL, subcategory=NULL, subcategoryId=NULL, action="model", params=params, httpMethod="GET", as.queryParam=NULL, ...), diff --git a/opencga-client/src/main/R/R/Operation-methods.R b/opencga-client/src/main/R/R/Operation-methods.R index f0481f21a19..bd6884c6906 100644 --- a/opencga-client/src/main/R/R/Operation-methods.R +++ b/opencga-client/src/main/R/R/Operation-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Organization-methods.R b/opencga-client/src/main/R/R/Organization-methods.R index 016e3650dab..0260f97f9df 100644 --- a/opencga-client/src/main/R/R/Organization-methods.R +++ b/opencga-client/src/main/R/R/Organization-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/R/R/Panel-methods.R b/opencga-client/src/main/R/R/Panel-methods.R index ab0a4245978..887ec48d5b0 100644 --- a/opencga-client/src/main/R/R/Panel-methods.R +++ b/opencga-client/src/main/R/R/Panel-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -36,7 +36,7 @@ #' [*]: Required parameter #' @export -setMethod("panelClient", "OpencgaR", function(OpencgaR, members, panels, endpointName, params=NULL, ...) { +setMethod("panelClient", "OpencgaR", function(OpencgaR, panels, members, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/panels/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Project-methods.R b/opencga-client/src/main/R/R/Project-methods.R index c8e201907e7..3a136539be5 100644 --- a/opencga-client/src/main/R/R/Project-methods.R +++ b/opencga-client/src/main/R/R/Project-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -33,7 +33,7 @@ #' [*]: Required parameter #' @export -setMethod("projectClient", "OpencgaR", function(OpencgaR, project, projects, endpointName, params=NULL, ...) { +setMethod("projectClient", "OpencgaR", function(OpencgaR, projects, project, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/projects/create: diff --git a/opencga-client/src/main/R/R/Sample-methods.R b/opencga-client/src/main/R/R/Sample-methods.R index b8769eb9ed5..39ceaba71d4 100644 --- a/opencga-client/src/main/R/R/Sample-methods.R +++ b/opencga-client/src/main/R/R/Sample-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -38,7 +38,7 @@ #' [*]: Required parameter #' @export -setMethod("sampleClient", "OpencgaR", function(OpencgaR, members, annotationSet, sample, samples, endpointName, params=NULL, ...) { +setMethod("sampleClient", "OpencgaR", function(OpencgaR, samples, annotationSet, sample, members, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/samples/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/Study-methods.R b/opencga-client/src/main/R/R/Study-methods.R index d5cf5e23190..5ff6deccb29 100644 --- a/opencga-client/src/main/R/R/Study-methods.R +++ b/opencga-client/src/main/R/R/Study-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -45,7 +45,7 @@ #' [*]: Required parameter #' @export -setMethod("studyClient", "OpencgaR", function(OpencgaR, group, members, templateId, studies, study, variableSet, endpointName, params=NULL, ...) { +setMethod("studyClient", "OpencgaR", function(OpencgaR, studies, variableSet, members, templateId, group, study, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/studies/acl/{members}/update: diff --git a/opencga-client/src/main/R/R/User-methods.R b/opencga-client/src/main/R/R/User-methods.R index 17748045ad9..921e466d5e4 100644 --- a/opencga-client/src/main/R/R/User-methods.R +++ b/opencga-client/src/main/R/R/User-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ #' [*]: Required parameter #' @export -setMethod("userClient", "OpencgaR", function(OpencgaR, user, filterId, users, endpointName, params=NULL, ...) { +setMethod("userClient", "OpencgaR", function(OpencgaR, filterId, users, user, endpointName, params=NULL, ...) { switch(endpointName, #' @section Endpoint /{apiVersion}/users/anonymous: diff --git a/opencga-client/src/main/R/R/Variant-methods.R b/opencga-client/src/main/R/R/Variant-methods.R index 02a4587345a..f03c5b00d9d 100644 --- a/opencga-client/src/main/R/R/Variant-methods.R +++ b/opencga-client/src/main/R/R/Variant-methods.R @@ -2,7 +2,7 @@ # WARNING: AUTOGENERATED CODE # # This code was generated by a tool. -# Autogenerated on: 2024-03-04 +# Autogenerated on: 2024-03-12 # # Manual changes to this file may cause unexpected behavior in your application. # Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java index 12ae402b6fd..dd0251bd427 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AdminClient.java @@ -37,7 +37,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -46,7 +46,7 @@ /** * This class contains methods for the Admin webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: admin */ public class AdminClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java index 1d5978075e9..3efdbd23bb1 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/AlignmentClient.java @@ -40,7 +40,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -49,7 +49,7 @@ /** * This class contains methods for the Alignment webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: analysis/alignment */ public class AlignmentClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java index bce7a38809a..050f9e9ca68 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ClinicalAnalysisClient.java @@ -35,6 +35,7 @@ import org.opencb.opencga.core.models.clinical.ClinicalAnalysisCreateParams; import org.opencb.opencga.core.models.clinical.ClinicalAnalysisLoadParams; import org.opencb.opencga.core.models.clinical.ClinicalAnalysisUpdateParams; +import org.opencb.opencga.core.models.clinical.ClinicalReport; import org.opencb.opencga.core.models.clinical.ExomiserInterpretationAnalysisParams; import org.opencb.opencga.core.models.clinical.Interpretation; import org.opencb.opencga.core.models.clinical.InterpretationCreateParams; @@ -54,7 +55,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -63,7 +64,7 @@ /** * This class contains methods for the ClinicalAnalysis webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: analysis/clinical */ public class ClinicalAnalysisClient extends AbstractParentClient { @@ -997,4 +998,26 @@ public RestResponse updateInterpretation(String clinicalAnalysis return execute("analysis/clinical", clinicalAnalysis, "interpretation", interpretation, "update", params, POST, Interpretation.class); } + + /** + * Update clinical analysis report. + * @param clinicalAnalysis Clinical analysis ID. + * @param data JSON containing clinical report information. + * @param params Map containing any of the following optional parameters. + * include: Fields included in the response, whole JSON path must be provided. + * exclude: Fields excluded in the response, whole JSON path must be provided. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * commentsAction: Action to be performed if the array of comments is being updated. + * supportingEvidencesAction: Action to be performed if the array of supporting evidences is being updated. + * filesAction: Action to be performed if the array of files is being updated. + * includeResult: Flag indicating to include the created or updated document result in the response. + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse updateReport(String clinicalAnalysis, ClinicalReport data, ObjectMap params) + throws ClientException { + params = params != null ? params : new ObjectMap(); + params.put("body", data); + return execute("analysis/clinical", clinicalAnalysis, "report", null, "update", params, POST, ClinicalReport.class); + } } diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java index ff8b862c90e..4dd5000180b 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/CohortClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -45,7 +45,7 @@ /** * This class contains methods for the Cohort webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: cohorts */ public class CohortClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java index 1338bd481c3..b9967e99b99 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/DiseasePanelClient.java @@ -35,7 +35,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -44,7 +44,7 @@ /** * This class contains methods for the DiseasePanel webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: panels */ public class DiseasePanelClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java index 5c2a1cc5b26..11c95587092 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FamilyClient.java @@ -35,7 +35,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -44,7 +44,7 @@ /** * This class contains methods for the Family webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: families */ public class FamilyClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java index 51d75ccbf27..537d9f525c5 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/FileClient.java @@ -42,7 +42,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -51,7 +51,7 @@ /** * This class contains methods for the File webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: files */ public class FileClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java index 02563c65a5e..1a94000c0a8 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/GA4GHClient.java @@ -27,7 +27,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -36,7 +36,7 @@ /** * This class contains methods for the GA4GH webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: ga4gh */ public class GA4GHClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java index fd639f51b5b..261eb7b7659 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/IndividualClient.java @@ -35,7 +35,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -44,7 +44,7 @@ /** * This class contains methods for the Individual webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: individuals */ public class IndividualClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java index b30b0645561..69536b9f108 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/JobClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -45,7 +45,7 @@ /** * This class contains methods for the Job webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: jobs */ public class JobClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java index abc9ab92cc1..cec88c6b456 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/MetaClient.java @@ -28,7 +28,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -37,7 +37,7 @@ /** * This class contains methods for the Meta webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: meta */ public class MetaClient extends AbstractParentClient { @@ -80,11 +80,13 @@ public RestResponse fail() throws ClientException { /** * Opencga model webservices. + * @param params Map containing any of the following optional parameters. + * model: Model description. * @return a RestResponse object. * @throws ClientException ClientException if there is any server error. */ - public RestResponse model() throws ClientException { - ObjectMap params = new ObjectMap(); + public RestResponse model(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); return execute("meta", null, null, null, "model", params, GET, String.class); } diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/OrganizationClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/OrganizationClient.java index ac14662b2fc..5caccab45d2 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/OrganizationClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/OrganizationClient.java @@ -30,7 +30,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -39,7 +39,7 @@ /** * This class contains methods for the Organization webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: organizations */ public class OrganizationClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java index 3ffc498d075..10e1ad23a81 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/ProjectClient.java @@ -31,7 +31,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -40,7 +40,7 @@ /** * This class contains methods for the Project webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: projects */ public class ProjectClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java index ccc25dc7587..9e557189f2d 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/SampleClient.java @@ -35,7 +35,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -44,7 +44,7 @@ /** * This class contains methods for the Sample webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: samples */ public class SampleClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java index 33ad71249c0..5afd9ea399e 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/StudyClient.java @@ -44,7 +44,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -53,7 +53,7 @@ /** * This class contains methods for the Study webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: studies */ public class StudyClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java index 8e75b697355..ab798ce82f0 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/UserClient.java @@ -36,7 +36,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -45,7 +45,7 @@ /** * This class contains methods for the User webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: users */ public class UserClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java index 5caa76bc51b..1a528519366 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java @@ -62,7 +62,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -71,7 +71,7 @@ /** * This class contains methods for the Variant webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: analysis/variant */ public class VariantClient extends AbstractParentClient { diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java index faf5f3c633f..1aae70260a3 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantOperationClient.java @@ -50,7 +50,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. -* Autogenerated on: 2024-03-04 +* Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -59,7 +59,7 @@ /** * This class contains methods for the VariantOperation webservices. - * Client version: 3.0.0-SNAPSHOT + * Client version: 3.1.0-SNAPSHOT * PATH: operation */ public class VariantOperationClient extends AbstractParentClient { diff --git a/opencga-client/src/main/javascript/Admin.js b/opencga-client/src/main/javascript/Admin.js index c7e969ce00a..3ab8837cfde 100644 --- a/opencga-client/src/main/javascript/Admin.js +++ b/opencga-client/src/main/javascript/Admin.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Alignment.js b/opencga-client/src/main/javascript/Alignment.js index cd0c803073c..550e528c9d0 100644 --- a/opencga-client/src/main/javascript/Alignment.js +++ b/opencga-client/src/main/javascript/Alignment.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Clinical.js b/opencga-client/src/main/javascript/Clinical.js deleted file mode 100644 index 2c695aacd91..00000000000 --- a/opencga-client/src/main/javascript/Clinical.js +++ /dev/null @@ -1,807 +0,0 @@ -/** - * 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. - * WARNING: AUTOGENERATED CODE - * - * This code was generated by a tool. - * Autogenerated on: 2022-08-02 08:25:32 ->>>>>>> develop ->>>>>>> release-2.4.x ->>>>>>> release-2.4.x - * - * Manual changes to this file may cause unexpected behavior in your application. - * Manual changes to this file will be overwritten if the code is regenerated. - * -**/ - -import OpenCGAParentClass from "./../opencga-parent-class.js"; - - -/** - * This class contains the methods for the "Clinical" resource - */ - -export default class Clinical extends OpenCGAParentClass { - - constructor(config) { - super(config); - } - - /** Update the set of permissions granted for the member - * @param {String} members - Comma separated list of user or group IDs. - * @param {Object} data - JSON containing the parameters to add ACLs. - * @param {String} action = "ADD" - Action to be performed [ADD, SET, REMOVE or RESET]. The default value is ADD. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {Boolean} [params.propagate = "false"] - Propagate permissions to related families, individuals, samples and files. The default - * value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - updateAcl(members, action, data, params) { - return this._post("analysis", null, "clinical/acl", members, "update", data, {action, ...params}); - } - - /** Update Clinical Analysis configuration. - * @param {Object} [data] - Configuration params to update. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - updateClinicalConfiguration(data, params) { - return this._post("analysis", null, "clinical/clinical/configuration", null, "update", data, params); - } - - /** Create a new clinical analysis - * @param {Object} data - JSON containing clinical analysis information. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {Boolean} [params.skipCreateDefaultInterpretation] - Flag to skip creating and initialise an empty default primary - * interpretation (Id will be '{clinicalAnalysisId}.1'). This flag is only considered if no Interpretation object is passed. - * @param {Boolean} [params.includeResult = "false"] - Flag indicating to include the created or updated document result in the response. - * The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - create(data, params) { - return this._post("analysis", null, "clinical", null, "create", data, params); - } - - /** Clinical Analysis distinct method - * @param {String} field - Field for which to obtain the distinct values. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.id] - Comma separated list of Clinical Analysis IDs up to a maximum of 100. - * @param {String} [params.uuid] - Comma separated list of Clinical Analysis UUIDs up to a maximum of 100. - * @param {String} [params.type] - Clinical Analysis type. - * @param {String} [params.disorder] - Clinical Analysis disorder. - * @param {String} [params.files] - Clinical Analysis files. - * @param {String} [params.sample] - Sample associated to the proband or any member of a family. - * @param {String} [params.individual] - Proband or any member of a family. - * @param {String} [params.proband] - Clinical Analysis proband. - * @param {String} [params.probandSamples] - Clinical Analysis proband samples. - * @param {String} [params.family] - Clinical Analysis family. - * @param {String} [params.familyMembers] - Clinical Analysis family members. - * @param {String} [params.familyMemberSamples] - Clinical Analysis family members samples. - * @param {String} [params.panels] - Clinical Analysis panels. - * @param {Boolean} [params.locked] - Locked Clinical Analyses. - * @param {String} [params.analystId] - Clinical Analysis analyst id. - * @param {String} [params.priority] - Clinical Analysis priority. - * @param {String} [params.flags] - Clinical Analysis flags. - * @param {String} [params.creationDate] - Clinical Analysis Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.modificationDate] - Clinical Analysis Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, - * <201805. - * @param {String} [params.dueDate] - Clinical Analysis due date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.qualityControlSummary] - Clinical Analysis quality control summary. - * @param {String} [params.release] - Release when it was created. - * @param {String} [params.status] - Filter by status. - * @param {String} [params.internalStatus] - Filter by internal status. - * @param {Boolean} [params.deleted] - Boolean to retrieve deleted entries. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - distinct(field, params) { - return this._get("analysis", null, "clinical", null, "distinct", {field, ...params}); - } - - /** Interpretation distinct method - * @param {String} field - Field for which to obtain the distinct values. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.id] - Comma separated list of Interpretation IDs up to a maximum of 100. - * @param {String} [params.uuid] - Comma separated list of Interpretation UUIDs up to a maximum of 100. - * @param {String} [params.clinicalAnalysisId] - Clinical Analysis id. - * @param {String} [params.analystId] - Analyst ID. - * @param {String} [params.methodName] - Interpretation method name. - * @param {String} [params.panels] - Interpretation panels. - * @param {String} [params.primaryFindings] - Interpretation primary findings. - * @param {String} [params.secondaryFindings] - Interpretation secondary findings. - * @param {String} [params.creationDate] - Interpretation Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.modificationDate] - Interpretation Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, - * <201805. - * @param {String} [params.status] - Filter by status. - * @param {String} [params.internalStatus] - Filter by internal status. - * @param {String} [params.release] - Release when it was created. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - distinctInterpretation(field, params) { - return this._get("analysis", null, "clinical/interpretation", null, "distinct", {field, ...params}); - } - - /** Search clinical interpretations - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.sort] - Sort the results. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.id] - Comma separated list of Interpretation IDs up to a maximum of 100. - * @param {String} [params.uuid] - Comma separated list of Interpretation UUIDs up to a maximum of 100. - * @param {String} [params.clinicalAnalysisId] - Clinical Analysis id. - * @param {String} [params.analystId] - Analyst ID. - * @param {String} [params.methodName] - Interpretation method name. - * @param {String} [params.panels] - Interpretation panels. - * @param {String} [params.primaryFindings] - Interpretation primary findings. - * @param {String} [params.secondaryFindings] - Interpretation secondary findings. - * @param {String} [params.creationDate] - Interpretation Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.modificationDate] - Interpretation Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, - * <201805. - * @param {String} [params.status] - Filter by status. - * @param {String} [params.internalStatus] - Filter by internal status. - * @param {String} [params.release] - Release when it was created. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - searchInterpretation(params) { - return this._get("analysis", null, "clinical/interpretation", null, "search", params); - } - - /** Clinical interpretation information - * @param {String} interpretations - Comma separated list of clinical interpretation IDs up to a maximum of 100. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.version] - Comma separated list of interpretation versions. 'all' to get all the interpretation versions. Not - * supported if multiple interpretation ids are provided. - * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - infoInterpretation(interpretations, params) { - return this._get("analysis", null, "clinical/interpretation", interpretations, "info", params); - } - - /** Run cancer tiering interpretation analysis - * @param {Object} data - Cancer tiering interpretation analysis params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runInterpreterCancerTiering(data, params) { - return this._post("analysis", null, "clinical/interpreter/cancerTiering", null, "run", data, params); - } - - /** Run exomiser interpretation analysis - * @param {Object} data - Exomizer interpretation analysis params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runInterpreterExomiser(data, params) { - return this._post("analysis", null, "clinical/interpreter/exomiser", null, "run", data, params); - } - - /** Run TEAM interpretation analysis - * @param {Object} data - TEAM interpretation analysis params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runInterpreterTeam(data, params) { - return this._post("analysis", null, "clinical/interpreter/team", null, "run", data, params); - } - - /** Run tiering interpretation analysis - * @param {Object} data - Tiering interpretation analysis params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runInterpreterTiering(data, params) { - return this._post("analysis", null, "clinical/interpreter/tiering", null, "run", data, params); - } - - /** Run Zetta interpretation analysis - * @param {Object} data - Zetta interpretation analysis params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runInterpreterZetta(data, params) { - return this._post("analysis", null, "clinical/interpreter/zetta", null, "run", data, params); - } - - /** RGA aggregation stats - * @param {String} field - List of fields separated by semicolons, e.g.: clinicalSignificances;type. For nested fields use >>, e.g.: - * type>>clinicalSignificances;knockoutType. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - aggregationStatsRga(field, params) { - return this._get("analysis", null, "clinical/rga", null, "aggregationStats", {field, ...params}); - } - - /** Query gene RGA - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.includeIndividual] - Include only the comma separated list of individuals to the response. - * @param {Number} [params.skipIndividual] - Number of individuals to skip. - * @param {Number} [params.limitIndividual] - Limit number of individuals returned (default: 1000). - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - queryRgaGene(params) { - return this._get("analysis", null, "clinical/rga/gene", null, "query", params); - } - - /** RGA gene summary stats - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - summaryRgaGene(params) { - return this._get("analysis", null, "clinical/rga/gene", null, "summary", params); - } - - /** Generate Recessive Gene Analysis secondary index - * @param {Object} data - Recessive Gene Analysis index params. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not - * provided. - * @param {String} [params.jobDescription] - Job description. - * @param {String} [params.jobDependsOn] - Comma separated list of existing job IDs the job will depend on. - * @param {String} [params.jobTags] - Job tags. - * @param {Boolean} [params.auxiliarIndex = "false"] - Index auxiliar collection to improve performance assuming RGA is completely - * indexed. The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - runRgaIndex(data, params) { - return this._post("analysis", null, "clinical/rga/index", null, "run", data, params); - } - - /** Query individual RGA - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - queryRgaIndividual(params) { - return this._get("analysis", null, "clinical/rga/individual", null, "query", params); - } - - /** RGA individual summary stats - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - summaryRgaIndividual(params) { - return this._get("analysis", null, "clinical/rga/individual", null, "summary", params); - } - - /** Query variant RGA - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.includeIndividual] - Include only the comma separated list of individuals to the response. - * @param {Number} [params.skipIndividual] - Number of individuals to skip. - * @param {Number} [params.limitIndividual] - Limit number of individuals returned (default: 1000). - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - queryRgaVariant(params) { - return this._get("analysis", null, "clinical/rga/variant", null, "query", params); - } - - /** RGA variant summary stats - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {String} [params.sampleId] - Filter by sample id. - * @param {String} [params.individualId] - Filter by individual id. - * @param {String} [params.sex] - Filter by sex. - * @param {String} [params.phenotypes] - Filter by phenotypes. - * @param {String} [params.disorders] - Filter by disorders. - * @param {String} [params.numParents] - Filter by the number of parents registered. - * @param {String} [params.geneId] - Filter by gene id. - * @param {String} [params.geneName] - Filter by gene name. - * @param {String} [params.chromosome] - Filter by chromosome. - * @param {String} [params.start] - Filter by start position. - * @param {String} [params.end] - Filter by end position. - * @param {String} [params.transcriptId] - Filter by transcript id. - * @param {String} [params.variants] - Filter by variant id. - * @param {String} [params.dbSnps] - Filter by DB_SNP id. - * @param {String} [params.knockoutType] - Filter by knockout type. - * @param {String} [params.filter] - Filter by filter (PASS, NOT_PASS). - * @param {String} [params.type] - Filter by variant type. - * @param {String} [params.clinicalSignificance] - Filter by clinical significance. - * @param {String} [params.populationFrequency] - Filter by population frequency. - * @param {String} [params.consequenceType] - Filter by consequence type. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - summaryRgaVariant(params) { - return this._get("analysis", null, "clinical/rga/variant", null, "summary", params); - } - - /** Clinical analysis search. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count = "false"] - Get the total number of results matching the query. Deactivated by default. The default - * value is false. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.id] - Comma separated list of Clinical Analysis IDs up to a maximum of 100. - * @param {String} [params.uuid] - Comma separated list of Clinical Analysis UUIDs up to a maximum of 100. - * @param {String} [params.type] - Clinical Analysis type. - * @param {String} [params.disorder] - Clinical Analysis disorder. - * @param {String} [params.files] - Clinical Analysis files. - * @param {String} [params.sample] - Sample associated to the proband or any member of a family. - * @param {String} [params.individual] - Proband or any member of a family. - * @param {String} [params.proband] - Clinical Analysis proband. - * @param {String} [params.probandSamples] - Clinical Analysis proband samples. - * @param {String} [params.family] - Clinical Analysis family. - * @param {String} [params.familyMembers] - Clinical Analysis family members. - * @param {String} [params.familyMemberSamples] - Clinical Analysis family members samples. - * @param {String} [params.panels] - Clinical Analysis panels. - * @param {Boolean} [params.locked] - Locked Clinical Analyses. - * @param {String} [params.analystId] - Clinical Analysis analyst id. - * @param {String} [params.priority] - Clinical Analysis priority. - * @param {String} [params.flags] - Clinical Analysis flags. - * @param {String} [params.creationDate] - Clinical Analysis Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.modificationDate] - Clinical Analysis Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, - * <201805. - * @param {String} [params.dueDate] - Clinical Analysis due date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. - * @param {String} [params.qualityControlSummary] - Clinical Analysis quality control summary. - * @param {String} [params.release] - Release when it was created. - * @param {String} [params.status] - Filter by status. - * @param {String} [params.internalStatus] - Filter by internal status. - * @param {Boolean} [params.deleted] - Boolean to retrieve deleted entries. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - search(params) { - return this._get("analysis", null, "clinical", null, "search", params); - } - - /** Fetch actionable clinical variants - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.sample] - Sample ID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - actionableVariant(params) { - return this._get("analysis", null, "clinical/variant", null, "actionable", params); - } - - /** Fetch clinical variants - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {Number} [params.limit] - Number of results to be returned. - * @param {Number} [params.skip] - Number of results to skip. - * @param {Boolean} [params.count] - Get the total number of results matching the query. Deactivated by default. - * @param {Boolean} [params.approximateCount] - Get an approximate count, instead of an exact total count. Reduces execution time. - * @param {Number} [params.approximateCountSamplingSize] - Sampling size to get the approximate count. Larger values increase accuracy - * but also increase execution time. - * @param {String} [params.savedFilter] - Use a saved filter at User level. - * @param {String} [params.id] - List of IDs, these can be rs IDs (dbSNP) or variants in the format chrom:start:ref:alt, e.g. - * rs116600158,19:7177679:C:T. - * @param {String} [params.region] - List of regions, these can be just a single chromosome name or regions in the format chr:start-end, - * e.g.: 2,3:100000-200000. - * @param {String} [params.type] - List of types, accepted values are SNV, MNV, INDEL, SV, COPY_NUMBER, COPY_NUMBER_LOSS, - * COPY_NUMBER_GAIN, INSERTION, DELETION, DUPLICATION, TANDEM_DUPLICATION, BREAKEND, e.g. SNV,INDEL. - * @param {String} [params.study] - Filter variants from the given studies, these can be either the numeric ID or the alias with the - * format user@project:study. - * @param {String} [params.file] - Filter variants from the files specified. This will set includeFile parameter when not provided. - * @param {String} [params.filter] - Specify the FILTER for any of the files. If 'file' filter is provided, will match the file and the - * filter. e.g.: PASS,LowGQX. - * @param {String} [params.qual] - Specify the QUAL for any of the files. If 'file' filter is provided, will match the file and the qual. - * e.g.: >123.4. - * @param {String} [params.fileData] - Filter by file data (i.e. FILTER, QUAL and INFO columns from VCF file). - * [{file}:]{key}{op}{value}[,;]* . If no file is specified, will use all files from "file" filter. e.g. AN>200 or - * file_1.vcf:AN>200;file_2.vcf:AN<10 . Many fields can be combined. e.g. file_1.vcf:AN>200;DB=true;file_2.vcf:AN<10,FILTER=PASS,LowDP. - * @param {String} [params.sample] - Filter variants by sample genotype. This will automatically set 'includeSample' parameter when not - * provided. This filter accepts multiple 3 forms: 1) List of samples: Samples that contain the main variant. Accepts AND (;) and OR (,) - * operators. e.g. HG0097,HG0098 . 2) List of samples with genotypes: {sample}:{gt1},{gt2}. Accepts AND (;) and OR (,) operators. e.g. - * HG0097:0/0;HG0098:0/1,1/1 . Unphased genotypes (e.g. 0/1, 1/1) will also include phased genotypes (e.g. 0|1, 1|0, 1|1), but not vice - * versa. When filtering by multi-allelic genotypes, any secondary allele will match, regardless of its position e.g. 1/2 will match with - * genotypes 1/2, 1/3, 1/4, .... Genotype aliases accepted: HOM_REF, HOM_ALT, HET, HET_REF, HET_ALT, HET_MISS and MISS e.g. - * HG0097:HOM_REF;HG0098:HET_REF,HOM_ALT . 3) Sample with segregation mode: {sample}:{segregation}. Only one sample accepted.Accepted - * segregation modes: [ autosomalDominant, autosomalRecessive, XLinkedDominant, XLinkedRecessive, YLinked, mitochondrial, deNovo, - * mendelianError, compoundHeterozygous ]. Value is case insensitive. e.g. HG0097:DeNovo Sample must have parents defined and indexed. . - * @param {String} [params.sampleData] - Filter by any SampleData field from samples. [{sample}:]{key}{op}{value}[,;]* . If no sample is - * specified, will use all samples from "sample" or "genotype" filter. e.g. DP>200 or HG0097:DP>200,HG0098:DP<10 . Many FORMAT fields can - * be combined. e.g. HG0097:DP>200;GT=1/1,0/1,HG0098:DP<10. - * @param {String} [params.sampleAnnotation] - Selects some samples using metadata information from Catalog. e.g. - * age>20;phenotype=hpo:123,hpo:456;name=smith. - * @param {String} [params.cohort] - Select variants with calculated stats for the selected cohorts. - * @param {String} [params.cohortStatsRef] - Reference Allele Frequency: [{study:}]{cohort}[<|>|<=|>=]{number}. e.g. ALL<=0.4. - * @param {String} [params.cohortStatsAlt] - Alternate Allele Frequency: [{study:}]{cohort}[<|>|<=|>=]{number}. e.g. ALL<=0.4. - * @param {String} [params.cohortStatsMaf] - Minor Allele Frequency: [{study:}]{cohort}[<|>|<=|>=]{number}. e.g. ALL<=0.4. - * @param {String} [params.cohortStatsMgf] - Minor Genotype Frequency: [{study:}]{cohort}[<|>|<=|>=]{number}. e.g. ALL<=0.4. - * @param {String} [params.cohortStatsPass] - Filter PASS frequency: [{study:}]{cohort}[<|>|<=|>=]{number}. e.g. ALL>0.8. - * @param {String} [params.missingAlleles] - Number of missing alleles: [{study:}]{cohort}[<|>|<=|>=]{number}. - * @param {String} [params.missingGenotypes] - Number of missing genotypes: [{study:}]{cohort}[<|>|<=|>=]{number}. - * @param {String} [params.score] - Filter by variant score: [{study:}]{score}[<|>|<=|>=]{number}. - * @param {String} [params.family] - Filter variants where any of the samples from the given family contains the variant (HET or - * HOM_ALT). - * @param {String} [params.familyDisorder] - Specify the disorder to use for the family segregation. - * @param {String} [params.familySegregation] - Filter by segregation mode from a given family. Accepted values: [ autosomalDominant, - * autosomalRecessive, XLinkedDominant, XLinkedRecessive, YLinked, mitochondrial, deNovo, mendelianError, compoundHeterozygous ]. - * @param {String} [params.familyMembers] - Sub set of the members of a given family. - * @param {String} [params.familyProband] - Specify the proband child to use for the family segregation. - * @param {String} [params.gene] - List of genes, most gene IDs are accepted (HGNC, Ensembl gene, ...). This is an alias to 'xref' - * parameter. - * @param {String} [params.ct] - List of SO consequence types, e.g. missense_variant,stop_lost or SO:0001583,SO:0001578. Accepts aliases - * 'loss_of_function' and 'protein_altering'. - * @param {String} [params.xref] - List of any external reference, these can be genes, proteins or variants. Accepted IDs include HGNC, - * Ensembl genes, dbSNP, ClinVar, HPO, Cosmic, ... - * @param {String} [params.biotype] - List of biotypes, e.g. protein_coding. - * @param {String} [params.proteinSubstitution] - Protein substitution scores include SIFT and PolyPhen. You can query using the score - * {protein_score}[<|>|<=|>=]{number} or the description {protein_score}[~=|=]{description} e.g. polyphen>0.1,sift=tolerant. - * @param {String} [params.conservation] - Filter by conservation score: {conservation_score}[<|>|<=|>=]{number} e.g. - * phastCons>0.5,phylop<0.1,gerp>0.1. - * @param {String} [params.populationFrequencyAlt] - Alternate Population Frequency: {study}:{population}[<|>|<=|>=]{number}. e.g. - * 1000G:ALL<0.01. - * @param {String} [params.populationFrequencyRef] - Reference Population Frequency: {study}:{population}[<|>|<=|>=]{number}. e.g. - * 1000G:ALL<0.01. - * @param {String} [params.populationFrequencyMaf] - Population minor allele frequency: {study}:{population}[<|>|<=|>=]{number}. e.g. - * 1000G:ALL<0.01. - * @param {String} [params.transcriptFlag] - List of transcript flags. e.g. canonical, CCDS, basic, LRG, MANE Select, MANE Plus Clinical, - * EGLH_HaemOnc, TSO500. - * @param {String} [params.geneTraitId] - List of gene trait association id. e.g. "umls:C0007222" , "OMIM:269600". - * @param {String} [params.go] - List of GO (Gene Ontology) terms. e.g. "GO:0002020". - * @param {String} [params.expression] - List of tissues of interest. e.g. "lung". - * @param {String} [params.proteinKeyword] - List of Uniprot protein variant annotation keywords. - * @param {String} [params.drug] - List of drug names. - * @param {String} [params.functionalScore] - Functional score: {functional_score}[<|>|<=|>=]{number} e.g. cadd_scaled>5.2 , - * cadd_raw<=0.3. - * @param {String} [params.clinical] - Clinical source: clinvar, cosmic. - * @param {String} [params.clinicalSignificance] - Clinical significance: benign, likely_benign, likely_pathogenic, pathogenic. - * @param {Boolean} [params.clinicalConfirmedStatus] - Clinical confirmed status. - * @param {String} [params.customAnnotation] - Custom annotation: {key}[<|>|<=|>=]{number} or {key}[~=|=]{text}. - * @param {String} [params.panel] - Filter by genes from the given disease panel. - * @param {String} [params.panelModeOfInheritance] - Filter genes from specific panels that match certain mode of inheritance. Accepted - * values : [ autosomalDominant, autosomalRecessive, XLinkedDominant, XLinkedRecessive, YLinked, mitochondrial, deNovo, mendelianError, - * compoundHeterozygous ]. - * @param {String} [params.panelConfidence] - Filter genes from specific panels that match certain confidence. Accepted values : [ high, - * medium, low, rejected ]. - * @param {String} [params.panelRoleInCancer] - Filter genes from specific panels that match certain role in cancer. Accepted values : [ - * both, oncogene, tumorSuppressorGene, fusion ]. - * @param {String} [params.panelFeatureType] - Filter elements from specific panels by type. Accepted values : [ gene, region, str, - * variant ]. - * @param {Boolean} [params.panelIntersection] - Intersect panel genes and regions with given genes and regions from que input query. - * This will prevent returning variants from regions out of the panel. - * @param {String} [params.trait] - List of traits, based on ClinVar, HPO, COSMIC, i.e.: IDs, histologies, descriptions,... - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - queryVariant(params) { - return this._get("analysis", null, "clinical/variant", null, "query", params); - } - - /** Returns the acl of the clinical analyses. If member is provided, it will only return the acl for the member. - * @param {String} clinicalAnalyses - Comma separated list of clinical analysis IDs or names up to a maximum of 100. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {String} [params.member] - User or group ID. - * @param {Boolean} [params.silent = "false"] - Boolean to retrieve all possible entries that are queried for, false to raise an - * exception whenever one of the entries looked for cannot be shown for whichever reason. The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - acl(clinicalAnalyses, params) { - return this._get("analysis", null, "clinical", clinicalAnalyses, "acl", params); - } - - /** Delete clinical analyses - * @param {String} clinicalAnalyses - Comma separated list of clinical analysis IDs or names up to a maximum of 100. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {Boolean} [params.force = "false"] - Force deletion if the ClinicalAnalysis contains interpretations or is locked. The default - * value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - delete(clinicalAnalyses, params) { - return this._delete("analysis", null, "clinical", clinicalAnalyses, "delete", params); - } - - /** Update clinical analysis attributes - * @param {String} clinicalAnalyses - Comma separated list of clinical analysis IDs. - * @param {Object} data - JSON containing clinical analysis information. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {"ADD"|"REMOVE"|"REPLACE"} [params.commentsAction = "ADD"] - Action to be performed if the array of comments is being updated. - * The default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"} [params.flagsAction = "ADD"] - Action to be performed if the array of flags is being updated. The - * default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"} [params.filesAction = "ADD"] - Action to be performed if the array of files is being updated. The - * default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"} [params.panelsAction = "ADD"] - Action to be performed if the array of panels is being updated. The - * default value is ADD. - * @param {Boolean} [params.includeResult = "false"] - Flag indicating to include the created or updated document result in the response. - * The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - update(clinicalAnalyses, data, params) { - return this._post("analysis", null, "clinical", clinicalAnalyses, "update", data, params); - } - - /** Clinical analysis info - * @param {String} clinicalAnalysis - Comma separated list of clinical analysis IDs or names up to a maximum of 100. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - Study [[user@]project:]study where study and project can be either the ID or UUID. - * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - info(clinicalAnalysis, params) { - return this._get("analysis", null, "clinical", clinicalAnalysis, "info", params); - } - - /** Create a new Interpretation - * @param {String} clinicalAnalysis - Clinical analysis ID. - * @param {Object} data - JSON containing clinical interpretation information. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - [[user@]project:]study id. - * @param {"PRIMARY"|"SECONDARY"} [params.setAs = "SECONDARY"] - Set interpretation as. The default value is SECONDARY. - * @param {Boolean} [params.includeResult = "false"] - Flag indicating to include the created or updated document result in the response. - * The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - createInterpretation(clinicalAnalysis, data, params) { - return this._post("analysis/clinical", clinicalAnalysis, "interpretation", null, "create", data, params); - } - - /** Clear the fields of the main interpretation of the Clinical Analysis - * @param {String} interpretations - Interpretation IDs of the Clinical Analysis. - * @param {String} clinicalAnalysis - Clinical analysis ID. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - [[user@]project:]study ID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - clearInterpretation(clinicalAnalysis, interpretations, params) { - return this._post("analysis/clinical", clinicalAnalysis, "interpretation", interpretations, "clear", params); - } - - /** Delete interpretation - * @param {String} clinicalAnalysis - Clinical analysis ID. - * @param {String} interpretations - Interpretation IDs of the Clinical Analysis. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - [[user@]project:]study ID. - * @param {String} [params.setAsPrimary] - Interpretation id to set as primary from the list of secondaries in case of deleting the - * actual primary one. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - deleteInterpretation(clinicalAnalysis, interpretations, params) { - return this._delete("analysis/clinical", clinicalAnalysis, "interpretation", interpretations, "delete", params); - } - - /** Revert to a previous interpretation version - * @param {String} clinicalAnalysis - Clinical analysis ID. - * @param {String} interpretation - Interpretation ID. - * @param {Number} version - Version to revert to. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.study] - [[user@]project:]study ID. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - revertInterpretation(clinicalAnalysis, interpretation, version, params) { - return this._post("analysis/clinical", clinicalAnalysis, "interpretation", interpretation, "revert", {version, ...params}); - } - - /** Update interpretation fields - * @param {String} clinicalAnalysis - Clinical analysis ID. - * @param {String} interpretation - Interpretation ID. - * @param {Object} data - JSON containing clinical interpretation information. - * @param {Object} [params] - The Object containing the following optional parameters: - * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. - * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. - * @param {String} [params.study] - [[user@]project:]study ID. - * @param {"ADD"|"SET"|"REMOVE"|"REPLACE"} [params.primaryFindingsAction = "ADD"] - Action to be performed if the array of primary - * findings is being updated. The default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"} [params.methodsAction = "ADD"] - Action to be performed if the array of methods is being updated. The - * default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"|"REPLACE"} [params.secondaryFindingsAction = "ADD"] - Action to be performed if the array of secondary - * findings is being updated. The default value is ADD. - * @param {"ADD"|"REMOVE"|"REPLACE"} [params.commentsAction = "ADD"] - Action to be performed if the array of comments is being updated. - * To REMOVE or REPLACE, the date will need to be provided to identify the comment. The default value is ADD. - * @param {"ADD"|"SET"|"REMOVE"} [params.panelsAction = "ADD"] - Action to be performed if the array of panels is being updated. The - * default value is ADD. - * @param {"PRIMARY"|"SECONDARY"} [params.setAs] - Set interpretation as. - * @param {Boolean} [params.includeResult = "false"] - Flag indicating to include the created or updated document result in the response. - * The default value is false. - * @returns {Promise} Promise object in the form of RestResponse instance. - */ - updateInterpretation(clinicalAnalysis, interpretation, data, params) { - return this._post("analysis/clinical", clinicalAnalysis, "interpretation", interpretation, "update", data, params); - } - -} \ No newline at end of file diff --git a/opencga-client/src/main/javascript/ClinicalAnalysis.js b/opencga-client/src/main/javascript/ClinicalAnalysis.js index 6390431f8da..0a4a554b1e7 100644 --- a/opencga-client/src/main/javascript/ClinicalAnalysis.js +++ b/opencga-client/src/main/javascript/ClinicalAnalysis.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -860,4 +860,25 @@ export default class ClinicalAnalysis extends OpenCGAParentClass { return this._post("analysis/clinical", clinicalAnalysis, "interpretation", interpretation, "update", data, params); } + /** Update clinical analysis report + * @param {String} clinicalAnalysis - Clinical analysis ID. + * @param {Object} data - JSON containing clinical report information. + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.include] - Fields included in the response, whole JSON path must be provided. + * @param {String} [params.exclude] - Fields excluded in the response, whole JSON path must be provided. + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {"ADD REMOVE REPLACE"} [params.commentsAction = "ADD"] - Action to be performed if the array of comments is being updated. The + * default value is ADD. + * @param {"ADD SET REMOVE"} [params.supportingEvidencesAction = "ADD"] - Action to be performed if the array of supporting evidences is + * being updated. The default value is ADD. + * @param {"ADD SET REMOVE"} [params.filesAction = "ADD"] - Action to be performed if the array of files is being updated. The default + * value is ADD. + * @param {Boolean} [params.includeResult = "false"] - Flag indicating to include the created or updated document result in the response. + * The default value is false. + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + updateReport(clinicalAnalysis, data, params) { + return this._post("analysis/clinical", clinicalAnalysis, "report", null, "update", data, params); + } + } \ No newline at end of file diff --git a/opencga-client/src/main/javascript/Cohort.js b/opencga-client/src/main/javascript/Cohort.js index 6b8ab16cb1d..a8beab20022 100644 --- a/opencga-client/src/main/javascript/Cohort.js +++ b/opencga-client/src/main/javascript/Cohort.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/DiseasePanel.js b/opencga-client/src/main/javascript/DiseasePanel.js index 1a83bbd6a26..e109c595a4e 100644 --- a/opencga-client/src/main/javascript/DiseasePanel.js +++ b/opencga-client/src/main/javascript/DiseasePanel.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Family.js b/opencga-client/src/main/javascript/Family.js index ef938cd64c9..f9dc5c48dac 100644 --- a/opencga-client/src/main/javascript/Family.js +++ b/opencga-client/src/main/javascript/Family.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/File.js b/opencga-client/src/main/javascript/File.js index adac7ffc6fa..68a977dc9a3 100644 --- a/opencga-client/src/main/javascript/File.js +++ b/opencga-client/src/main/javascript/File.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/GA4GH.js b/opencga-client/src/main/javascript/GA4GH.js index 67c191b5710..1c8bc3aec74 100644 --- a/opencga-client/src/main/javascript/GA4GH.js +++ b/opencga-client/src/main/javascript/GA4GH.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Individual.js b/opencga-client/src/main/javascript/Individual.js index 1b6366f8ff0..893ad686998 100644 --- a/opencga-client/src/main/javascript/Individual.js +++ b/opencga-client/src/main/javascript/Individual.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Job.js b/opencga-client/src/main/javascript/Job.js index 065b92a75d8..6b59792e2be 100644 --- a/opencga-client/src/main/javascript/Job.js +++ b/opencga-client/src/main/javascript/Job.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Meta.js b/opencga-client/src/main/javascript/Meta.js index 7e42eb048d1..20aa39d36d3 100644 --- a/opencga-client/src/main/javascript/Meta.js +++ b/opencga-client/src/main/javascript/Meta.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. @@ -58,11 +58,12 @@ export default class Meta extends OpenCGAParentClass { } /** Opencga model webservices. - * + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.model] - Model description. * @returns {Promise} Promise object in the form of RestResponse instance. */ - model() { - return this._get("meta", null, null, null, "model"); + model(params) { + return this._get("meta", null, null, null, "model", params); } /** Ping Opencga webservices. diff --git a/opencga-client/src/main/javascript/Organization.js b/opencga-client/src/main/javascript/Organization.js index 5102f6b76b5..848305cb541 100644 --- a/opencga-client/src/main/javascript/Organization.js +++ b/opencga-client/src/main/javascript/Organization.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Project.js b/opencga-client/src/main/javascript/Project.js index b2307a44a8f..96fd5d76d5b 100644 --- a/opencga-client/src/main/javascript/Project.js +++ b/opencga-client/src/main/javascript/Project.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Sample.js b/opencga-client/src/main/javascript/Sample.js index 04a70eb6d6a..2bff7c6c805 100644 --- a/opencga-client/src/main/javascript/Sample.js +++ b/opencga-client/src/main/javascript/Sample.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Study.js b/opencga-client/src/main/javascript/Study.js index 83caa14961b..9cba17724a2 100644 --- a/opencga-client/src/main/javascript/Study.js +++ b/opencga-client/src/main/javascript/Study.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/User.js b/opencga-client/src/main/javascript/User.js index dc60a5a9bfa..ca89e9c6cd8 100644 --- a/opencga-client/src/main/javascript/User.js +++ b/opencga-client/src/main/javascript/User.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/Variant.js b/opencga-client/src/main/javascript/Variant.js index 2ee8e9882b5..b2b717f2733 100644 --- a/opencga-client/src/main/javascript/Variant.js +++ b/opencga-client/src/main/javascript/Variant.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/javascript/VariantOperation.js b/opencga-client/src/main/javascript/VariantOperation.js index 4ae38846bd4..9bc29ecfedd 100644 --- a/opencga-client/src/main/javascript/VariantOperation.js +++ b/opencga-client/src/main/javascript/VariantOperation.js @@ -12,7 +12,7 @@ * WARNING: AUTOGENERATED CODE * * This code was generated by a tool. - * Autogenerated on: 2024-03-04 + * Autogenerated on: 2024-03-12 * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py index fc501c27f87..5c7acf23a1b 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/admin_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Admin(_ParentRestClient): """ This class contains methods for the 'Admin' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/admin """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py index 713e21ed980..3f88bb0d464 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/alignment_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Alignment(_ParentRestClient): """ This class contains methods for the 'Analysis - Alignment' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/analysis/alignment """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py index 17bd6b2ca38..5ad28af0295 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/clinical_analysis_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class ClinicalAnalysis(_ParentRestClient): """ This class contains methods for the 'Analysis - Clinical' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/analysis/clinical """ @@ -1088,3 +1088,30 @@ def update_interpretation(self, clinical_analysis, interpretation, data=None, ** return self._post(category='analysis/clinical', resource='update', query_id=clinical_analysis, subcategory='interpretation', second_query_id=interpretation, data=data, **options) + def update_report(self, clinical_analysis, data=None, **options): + """ + Update clinical analysis report. + PATH: /{apiVersion}/analysis/clinical/{clinicalAnalysis}/report/update + + :param dict data: JSON containing clinical report information. + (REQUIRED) + :param str clinical_analysis: Clinical analysis ID. (REQUIRED) + :param str include: Fields included in the response, whole JSON path + must be provided. + :param str exclude: Fields excluded in the response, whole JSON path + must be provided. + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str comments_action: Action to be performed if the array of + comments is being updated. Allowed values: ['ADD REMOVE REPLACE'] + :param str supporting_evidences_action: Action to be performed if the + array of supporting evidences is being updated. Allowed values: + ['ADD SET REMOVE'] + :param str files_action: Action to be performed if the array of files + is being updated. Allowed values: ['ADD SET REMOVE'] + :param bool include_result: Flag indicating to include the created or + updated document result in the response. + """ + + return self._post(category='analysis/clinical', resource='update', query_id=clinical_analysis, subcategory='report', data=data, **options) + diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py index 0146948677b..ac75391b6ab 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/cohort_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Cohort(_ParentRestClient): """ This class contains methods for the 'Cohorts' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/cohorts """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py index 46fb2ba4414..0392ebc1ff7 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/disease_panel_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class DiseasePanel(_ParentRestClient): """ This class contains methods for the 'Disease Panels' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/panels """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py index a8c8ca3b884..d40660bdc72 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/family_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Family(_ParentRestClient): """ This class contains methods for the 'Families' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/families """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py index e65ef171cfb..6ec39174d2d 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/file_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class File(_ParentRestClient): """ This class contains methods for the 'Files' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/files """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py index cc8d7089afc..937c64be1c7 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/ga4gh_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class GA4GH(_ParentRestClient): """ This class contains methods for the 'GA4GH' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/ga4gh """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py index 5179f72d86a..bf1a2279d8b 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/individual_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Individual(_ParentRestClient): """ This class contains methods for the 'Individuals' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/individuals """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py index f4d7eb3265b..33704a42321 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/job_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Job(_ParentRestClient): """ This class contains methods for the 'Jobs' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/jobs """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py index 6d6f3512234..55180c56871 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/meta_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Meta(_ParentRestClient): """ This class contains methods for the 'Meta' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/meta """ @@ -51,6 +51,8 @@ def model(self, **options): """ Opencga model webservices. PATH: /{apiVersion}/meta/model + + :param str model: Model description. """ return self._get(category='meta', resource='model', **options) diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/organization_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/organization_client.py index 7938fd9bed5..535c4e21d87 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/organization_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/organization_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Organization(_ParentRestClient): """ This class contains methods for the 'Organizations' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/organizations """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py index 4007df86afc..8f869340bd8 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/project_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Project(_ParentRestClient): """ This class contains methods for the 'Projects' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/projects """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py index 083b2b1827c..9c0a698ee52 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/sample_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Sample(_ParentRestClient): """ This class contains methods for the 'Samples' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/samples """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py index 2d4552feb5e..8b68612d1d8 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/study_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Study(_ParentRestClient): """ This class contains methods for the 'Studies' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/studies """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py index 44e283b47d0..0cb21ab37ac 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/user_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class User(_ParentRestClient): """ This class contains methods for the 'Users' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/users """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py index 150d0de143e..e459f95847d 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class Variant(_ParentRestClient): """ This class contains methods for the 'Analysis - Variant' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/analysis/variant """ diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py index 2e97b915706..33301600c61 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/variant_operation_client.py @@ -2,7 +2,7 @@ WARNING: AUTOGENERATED CODE This code was generated by a tool. - Autogenerated on: 2024-03-04 + Autogenerated on: 2024-03-12 Manual changes to this file may cause unexpected behavior in your application. Manual changes to this file will be overwritten if the code is regenerated. @@ -14,7 +14,7 @@ class VariantOperation(_ParentRestClient): """ This class contains methods for the 'Operations - Variant Storage' webservices - Client version: 3.0.0-SNAPSHOT + Client version: 3.1.0-SNAPSHOT PATH: /{apiVersion}/operation """ diff --git a/opencga-clinical/pom.xml b/opencga-clinical/pom.xml index 80cf5324837..215d392ce1c 100644 --- a/opencga-clinical/pom.xml +++ b/opencga-clinical/pom.xml @@ -5,7 +5,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/opencga-core/pom.xml b/opencga-core/pom.xml index dd8e2ad01d4..432db00c834 100644 --- a/opencga-core/pom.xml +++ b/opencga-core/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java index 14c7f7ac9e9..ffcbb073b44 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java @@ -4,6 +4,7 @@ import org.opencb.opencga.core.models.alignment.AlignmentQcParams; import org.opencb.opencga.core.models.variant.MutationalSignatureAnalysisParams; import org.opencb.opencga.core.models.variant.SampleQcAnalysisParams; +import org.opencb.opencga.core.tools.variant.IndividualQcAnalysisExecutor; public class FieldConstants { @@ -166,11 +167,19 @@ public class FieldConstants { //FamilyQualityControl public static final String FAMILY_QUALITY_CONTROL_RELATEDNESS_DESCRIPTION = "Reports of family relationship."; + + + // Individual quality control + public static final String INDIVIDUAL_QC_INDIVIDUAL_ID_DESCRIPTION = "Individual ID"; + public static final String INDIVIDUAL_QC_SAMPLE_ID_DESCRIPTION = "Sample ID (required when the individual has multiple samples)"; + public static final String INFERRED_SEX_METHOD_DESCRIPTION = "Inferred sex method. Valid values: " + + IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD; public static final String INDIVIDUAL_QUALITY_CONTROL_INFERRED_SEX_REPORT_DESCRIPTION = "List of inferred sex reports, it depends on" + " the method (currently by coverage ratio)."; public static final String INDIVIDUAL_QUALITY_CONTROL_SAMPLE_RELATEDNESS_REPORT_DESCRIPTION = "Reports of samples relatedness."; public static final String INDIVIDUAL_QUALITY_CONTROL_MENDELIAN_ERRORS_DESCRIPTION = "Mendelian errors."; + //Status public static final String STATUS_DATE_DESCRIPTION = "Date has setted the status."; public static final String STATUS_MESSAGE_DESCRIPTION = "Deprecated: Message describing the status."; diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java index 3cbbe83f0bc..41c17e5a787 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java @@ -81,7 +81,7 @@ public class ParamConstants { public static final String CELLBASE_URL = "https://ws.zettagenomics.com/cellbase"; public static final String CELLBASE_VERSION = "v5.2"; - public static final String CELLBASE_DATA_RELEASE = "2"; + public static final String CELLBASE_DATA_RELEASE = "3"; public static final String CELLBASE_APIKEY = ""; public static final String POP_FREQ_1000G_CB_V4 = "1kG_phase3"; diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/alignment/CoverageIndexParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/alignment/CoverageIndexParams.java index 60250f19169..f655829625d 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/alignment/CoverageIndexParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/alignment/CoverageIndexParams.java @@ -7,55 +7,55 @@ public class CoverageIndexParams extends ToolParams { public static final String DESCRIPTION = "Coverage computation parameters"; - private String file; + private String bamFileId; + private String baiFileId; @JsonProperty(defaultValue = "1") private int windowSize; - private boolean overwrite; public CoverageIndexParams() { } - public CoverageIndexParams(String file, int windowSize, boolean overwrite) { - this.file = file; + public CoverageIndexParams(String bamFileId, String baiFileId, int windowSize) { + this.bamFileId = bamFileId; + this.baiFileId = baiFileId; this.windowSize = windowSize; - this.overwrite = overwrite; } @Override public String toString() { final StringBuilder sb = new StringBuilder("CoverageIndexParams{"); - sb.append("file='").append(file).append('\''); + sb.append("bamFileId='").append(bamFileId).append('\''); + sb.append(", baiFileId='").append(baiFileId).append('\''); sb.append(", windowSize=").append(windowSize); - sb.append(", overwrite=").append(overwrite); sb.append('}'); return sb.toString(); } - public String getFile() { - return file; + public String getBamFileId() { + return bamFileId; } - public CoverageIndexParams setFile(String file) { - this.file = file; + public CoverageIndexParams setBamFileId(String bamFileId) { + this.bamFileId = bamFileId; return this; } - public int getWindowSize() { - return windowSize; + public String getBaiFileId() { + return baiFileId; } - public CoverageIndexParams setWindowSize(int windowSize) { - this.windowSize = windowSize; + public CoverageIndexParams setBaiFileId(String baiFileId) { + this.baiFileId = baiFileId; return this; } - public boolean isOverwrite() { - return overwrite; + public int getWindowSize() { + return windowSize; } - public CoverageIndexParams setOverwrite(boolean overwrite) { - this.overwrite = overwrite; + public CoverageIndexParams setWindowSize(int windowSize) { + this.windowSize = windowSize; return this; } } diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/file/FileRelatedFile.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/file/FileRelatedFile.java index 52d224d9855..822eb941168 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/file/FileRelatedFile.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/file/FileRelatedFile.java @@ -29,7 +29,8 @@ public enum Relation { PRODUCED_FROM, PART_OF_PAIR, PEDIGREE, - REFERENCE_GENOME + REFERENCE_GENOME, + ALIGNMENT } public FileRelatedFile() { diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java index 6f45eb6788c..e06fdf09b6e 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java @@ -16,14 +16,25 @@ package org.opencb.opencga.core.models.variant; +import org.opencb.commons.annotations.DataField; +import org.opencb.opencga.core.api.FieldConstants; import org.opencb.opencga.core.tools.ToolParams; +import org.opencb.opencga.core.tools.variant.IndividualQcAnalysisExecutor; public class IndividualQcAnalysisParams extends ToolParams { public static final String DESCRIPTION = "Individual QC analysis params"; + + @DataField(id = "individual", description = FieldConstants.INDIVIDUAL_QC_INDIVIDUAL_ID_DESCRIPTION) private String individual; + + @DataField(id = "sample", description = FieldConstants.INDIVIDUAL_QC_SAMPLE_ID_DESCRIPTION) private String sample; + + @DataField(id = "inferredSexMethod", description = FieldConstants.INFERRED_SEX_METHOD_DESCRIPTION, + defaultValue = IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD) private String inferredSexMethod; + @DataField(id = "outdir", description = FieldConstants.JOB_OUT_DIR_DESCRIPTION) private String outdir; public IndividualQcAnalysisParams() { diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/InferredSexAnalysisParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/InferredSexAnalysisParams.java index bf3fda5bb97..f927fea73ae 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/InferredSexAnalysisParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/InferredSexAnalysisParams.java @@ -16,14 +16,22 @@ package org.opencb.opencga.core.models.variant; +import org.opencb.commons.annotations.DataField; +import org.opencb.opencga.core.api.FieldConstants; import org.opencb.opencga.core.tools.ToolParams; import java.util.List; public class InferredSexAnalysisParams extends ToolParams { public static final String DESCRIPTION = "Inferred sex analysis params"; + + @DataField(id = "individual", description = FieldConstants.INDIVIDUAL_QC_INDIVIDUAL_ID_DESCRIPTION) private String individual; + + @DataField(id = "sample", description = FieldConstants.INDIVIDUAL_QC_SAMPLE_ID_DESCRIPTION) private String sample; + + @DataField(id = "outdir", description = FieldConstants.JOB_OUT_DIR_DESCRIPTION) private String outdir; public InferredSexAnalysisParams() { diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/IndividualQcAnalysisExecutor.java b/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/IndividualQcAnalysisExecutor.java index 6547fb85889..a94e5ee8bcf 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/IndividualQcAnalysisExecutor.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/IndividualQcAnalysisExecutor.java @@ -42,7 +42,7 @@ public enum QcType { protected IndividualQualityControl qualityControl; - public IndividualQcAnalysisExecutor() { + protected IndividualQcAnalysisExecutor() { } public String getStudyId() { diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/InferredSexAnalysisExecutor.java b/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/InferredSexAnalysisExecutor.java index 945914de376..d8ac8b488f0 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/InferredSexAnalysisExecutor.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/tools/variant/InferredSexAnalysisExecutor.java @@ -24,10 +24,11 @@ public abstract class InferredSexAnalysisExecutor extends OpenCgaToolExecutor { - private String studyId; - private String individualId; + protected String studyId; + protected String individualId; + protected String sampleId; - private InferredSexReport inferredSexReport; + protected InferredSexReport inferredSexReport; public InferredSexAnalysisExecutor() { } @@ -50,6 +51,15 @@ public InferredSexAnalysisExecutor setIndividualId(String individualId) { return this; } + public String getSampleId() { + return sampleId; + } + + public InferredSexAnalysisExecutor setSampleId(String sampleId) { + this.sampleId = sampleId; + return this; + } + public InferredSexReport getInferredSexReport() { return inferredSexReport; } diff --git a/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java b/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java index 933a27a8663..82535278561 100644 --- a/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java +++ b/opencga-core/src/test/java/org/opencb/opencga/core/cellbase/CellBaseValidatorTest.java @@ -22,27 +22,27 @@ public class CellBaseValidatorTest { @Test public void testValidateFixVersion() throws IOException { - CellBaseConfiguration c = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "5.1", "2", null), "hsapiens", "grch38", true); - Assert.assertEquals("v5.1", c.getVersion()); + CellBaseConfiguration c = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "5.2", "3", null), "hsapiens", "grch38", true); + Assert.assertEquals("v5.2", c.getVersion()); } @Test public void testValidateUndefinedDataRelease() throws IOException { - CellBaseConfiguration c = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, null), "hsapiens", "grch38", true); - Assert.assertEquals("v5.1", c.getVersion()); + CellBaseConfiguration c = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, null), "hsapiens", "grch38", true); + Assert.assertEquals("v5.2", c.getVersion()); Assert.assertNotNull(c.getDataRelease()); } @Test public void testInvalidUrlPath() throws IOException { thrown.expectMessage("Unable to access cellbase url"); - CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL+"/NONEXISTING/", "v5.1", null, null), "green alien", "grch84", true); + CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL+"/NONEXISTING/", "v5.2", null, null), "green alien", "grch84", true); } @Test public void testInvalidUrl() throws IOException { thrown.expectMessage("Unable to access cellbase url"); - CellBaseValidator.validate(new CellBaseConfiguration("https://ws.zettagenomics-NONEXISTING.com/cellbase/NONEXISTING/", "v5.1", null, null), "green alien", "grch84", true); + CellBaseValidator.validate(new CellBaseConfiguration("https://ws.zettagenomics-NONEXISTING.com/cellbase/NONEXISTING/", "v5.2", null, null), "green alien", "grch84", true); } @Test @@ -54,33 +54,33 @@ public void testInvalidVersion() throws IOException { @Test public void testInvalidSpecies() throws IOException { thrown.expectMessage("Species 'galien' not found in cellbase"); - CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, null), "green alien", "grch84", true); + CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, null), "green alien", "grch84", true); } @Test public void testInvalidAssembly() throws IOException { thrown.expectMessage("Assembly 'grch84' not found in cellbase"); thrown.expectMessage("Supported assemblies : [GRCh38, GRCh37]"); - CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, null), "homo sapiens", "grch84", true); + CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, null), "homo sapiens", "grch84", true); } @Test public void testInvalidDR() throws IOException { thrown.expectMessage("DataRelease 'INVALID_DR' not found on cellbase"); - CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", "INVALID_DR", null), "hsapiens", "grch38", true); + CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", "INVALID_DR", null), "hsapiens", "grch38", true); } @Test public void testNoActiveReleases() throws IOException { thrown.expectMessage("No active data releases found on cellbase"); - CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, null), "mmusculus", "GRCm38", true); + CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, null), "mmusculus", "GRCm38", true); } @Test public void testApiKey() throws IOException { String apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.8", null, apiKey), "hsapiens", "grch38", true); Assert.assertNotNull(validated.getApiKey()); } @@ -89,14 +89,14 @@ public void testApiKeyNotSupported() throws IOException { String apiKey = System.getenv("CELLBASE_HGMD_APIKEY"); Assume.assumeTrue(StringUtils.isNotEmpty(apiKey)); thrown.expectMessage("API key not supported"); - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, apiKey), "hsapiens", "grch38", true); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, apiKey), "hsapiens", "grch38", true); Assert.assertNotNull(validated.getApiKey()); } @Test public void testApiKeyEmpty() throws IOException { String apiKey = ""; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.1", null, apiKey), "hsapiens", "grch38", true); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.2", null, apiKey), "hsapiens", "grch38", true); Assert.assertNull(validated.getApiKey()); } @@ -104,7 +104,7 @@ public void testApiKeyEmpty() throws IOException { public void testMalformedApiKey() throws IOException { thrown.expectMessage("Malformed API key for cellbase"); String apiKey = "MALFORMED_API_KEY"; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.8", null, apiKey), "hsapiens", "grch38", true); Assert.assertNotNull(validated.getApiKey()); } @@ -112,7 +112,7 @@ public void testMalformedApiKey() throws IOException { public void testUnsignedApiKey() throws IOException { thrown.expectMessage("Invalid API key for cellbase"); String apiKey = "eyJhbGciOiJIUzI1NiJ9.eyJzb3VyY2VzIjp7ImhnbWQiOjkyMjMzNzIwMzY4NTQ3NzU4MDd9LCJ2ZXJzaW9uIjoiMS4wIiwic3ViIjoiWkVUVEEiLCJpYXQiOjE2OTMyMTY5MDd9.invalidsignature"; - CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.4", null, apiKey), "hsapiens", "grch38", true); + CellBaseConfiguration validated = CellBaseValidator.validate(new CellBaseConfiguration(ParamConstants.CELLBASE_URL, "v5.8", null, apiKey), "hsapiens", "grch38", true); Assert.assertNotNull(validated.getApiKey()); } diff --git a/opencga-master/pom.xml b/opencga-master/pom.xml index 8152c26eaf4..eda14c31ea1 100644 --- a/opencga-master/pom.xml +++ b/opencga-master/pom.xml @@ -22,7 +22,7 @@ opencga org.opencb.opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-server/pom.xml b/opencga-server/pom.xml index c5632ce7c14..7632ed6d65f 100644 --- a/opencga-server/pom.xml +++ b/opencga-server/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml @@ -193,17 +193,14 @@ org.glassfish.jersey.core jersey-client - test org.glassfish.jersey.containers jersey-container-servlet-core - test org.opencb.commons commons-datastore-mongodb - test junit diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/generator/models/RestParameter.java b/opencga-server/src/main/java/org/opencb/opencga/server/generator/models/RestParameter.java index 59dad03d1a3..3d1414d3cbd 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/generator/models/RestParameter.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/generator/models/RestParameter.java @@ -99,104 +99,117 @@ public String getName() { return name; } - public void setName(String name) { + public RestParameter setName(String name) { this.name = name; + return this; } public RestParamType getParam() { return param; } - public void setParam(RestParamType param) { + public RestParameter setParam(RestParamType param) { this.param = param; + return this; } public String getParentName() { return parentName; } - public void setParentName(String parentName) { + public RestParameter setParentName(String parentName) { this.parentName = parentName; + return this; } public String getType() { return type; } - public void setType(String type) { + public RestParameter setType(String type) { this.type = type; + return this; } public String getTypeClass() { return typeClass; } - public void setTypeClass(String typeClass) { + public RestParameter setTypeClass(String typeClass) { this.typeClass = typeClass; + return this; } public boolean isRequired() { return required; } - public void setRequired(boolean required) { + public RestParameter setRequired(boolean required) { this.required = required; + return this; } public String getDefaultValue() { return defaultValue; } - public void setDefaultValue(String defaultValue) { + public RestParameter setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; + return this; } public String getDescription() { return description; } - public void setDescription(String description) { + public RestParameter setDescription(String description) { this.description = description; + return this; } public List getData() { return data; } - public void setData(List data) { + public RestParameter setData(List data) { this.data = data; + return this; } public String getAllowedValues() { return allowedValues; } - public void setAllowedValues(String allowedValues) { + public RestParameter setAllowedValues(String allowedValues) { this.allowedValues = allowedValues; + return this; } public boolean isComplex() { return complex; } - public void setComplex(boolean complex) { + public RestParameter setComplex(boolean complex) { this.complex = complex; + return this; } public String getGenericType() { return genericType; } - public void setGenericType(String genericType) { + public RestParameter setGenericType(String genericType) { this.genericType = genericType; + return this; } public boolean isInnerParam() { return innerParam; } - public void setInnerParam(boolean innerParam) { + public RestParameter setInnerParam(boolean innerParam) { this.innerParam = innerParam; + return this; } public boolean isEnum() { diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/MetaWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/MetaWSServer.java index 47896b43f5f..6569dd3effe 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/MetaWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/MetaWSServer.java @@ -110,7 +110,7 @@ public Response status() { @GET @Path("/model") @ApiOperation(value = "Opencga model webservices.", response = String.class) - public Response model(@QueryParam("model") String modelStr) { + public Response model(@ApiParam(value = "Model description") @QueryParam("model") String modelStr) { return run(() -> new OpenCGAResult<>(0, Collections.emptyList(), 1, Collections.singletonList(DataModelsUtils.dataModelToJsonString(modelStr, false)), 1)); diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/ClinicalWebService.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/ClinicalWebService.java index 1084d90c274..d69c237e421 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/ClinicalWebService.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/ClinicalWebService.java @@ -275,6 +275,51 @@ public Response update( } } + @POST + @Path("/{clinicalAnalysis}/report/update") + @Consumes(MediaType.APPLICATION_JSON) + @ApiOperation(value = "Update clinical analysis report", response = ClinicalReport.class) + @ApiImplicitParams({ + @ApiImplicitParam(name = QueryOptions.INCLUDE, value = ParamConstants.INCLUDE_DESCRIPTION, + dataType = "string", paramType = "query"), + @ApiImplicitParam(name = QueryOptions.EXCLUDE, value = ParamConstants.EXCLUDE_DESCRIPTION, + dataType = "string", paramType = "query") + }) + public Response updateReport( + @ApiParam(value = "Clinical analysis ID") @PathParam(value = "clinicalAnalysis") String clinicalAnalysisStr, + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = "Action to be performed if the array of comments is being updated.", allowableValues = "ADD,REMOVE,REPLACE", defaultValue = "ADD") + @QueryParam("commentsAction") ParamUtils.AddRemoveReplaceAction commentsAction, + @ApiParam(value = "Action to be performed if the array of supporting evidences is being updated.", allowableValues = "ADD,SET,REMOVE", defaultValue = "ADD") + @QueryParam("supportingEvidencesAction") ParamUtils.BasicUpdateAction supportingEvidencesAction, + @ApiParam(value = "Action to be performed if the array of files is being updated.", allowableValues = "ADD,SET,REMOVE", defaultValue = "ADD") + @QueryParam("filesAction") ParamUtils.BasicUpdateAction filesAction, + @ApiParam(value = ParamConstants.INCLUDE_RESULT_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.INCLUDE_RESULT_PARAM) boolean includeResult, + @ApiParam(name = "body", value = "JSON containing clinical report information", required = true) ClinicalReport params) { + try { + if (commentsAction == null) { + commentsAction = ParamUtils.AddRemoveReplaceAction.ADD; + } + if (supportingEvidencesAction == null) { + supportingEvidencesAction = ParamUtils.BasicUpdateAction.ADD; + } + if (filesAction == null) { + filesAction = ParamUtils.BasicUpdateAction.ADD; + } + + Map actionMap = new HashMap<>(); + actionMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.COMMENTS.key(), commentsAction); + actionMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.SUPPORTING_EVIDENCES.key(), supportingEvidencesAction); + actionMap.put(ClinicalAnalysisDBAdaptor.ReportQueryParams.FILES.key(), filesAction); + queryOptions.put(Constants.ACTIONS, actionMap); + + return createOkResponse(clinicalManager.updateReport(studyStr, clinicalAnalysisStr, params, queryOptions, token)); + } catch (Exception e) { + return createErrorResponse(e); + } + } + + @POST @Path("/annotationSets/load") @Consumes(MediaType.APPLICATION_JSON) diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/VariantWebService.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/VariantWebService.java index f297b867702..a62b08e0413 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/VariantWebService.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/analysis/VariantWebService.java @@ -30,6 +30,7 @@ import org.opencb.commons.datastore.core.*; import org.opencb.opencga.analysis.AnalysisUtils; import org.opencb.opencga.analysis.ResourceUtils; +import org.opencb.opencga.analysis.alignment.AlignmentConstants; import org.opencb.opencga.analysis.family.qc.FamilyQcAnalysis; import org.opencb.opencga.analysis.individual.qc.IndividualQcAnalysis; import org.opencb.opencga.analysis.individual.qc.IndividualQcUtils; @@ -1079,7 +1080,13 @@ public Response inferredSexRun( @ApiParam(value = ParamConstants.JOB_DEPENDS_ON_DESCRIPTION) @QueryParam(JOB_DEPENDS_ON) String dependsOn, @ApiParam(value = ParamConstants.JOB_TAGS_DESCRIPTION) @QueryParam(ParamConstants.JOB_TAGS) String jobTags, @ApiParam(value = InferredSexAnalysisParams.DESCRIPTION, required = true) InferredSexAnalysisParams params) { - return submitJob(InferredSexAnalysis.ID, study, params, jobName, jobDescription, dependsOn, jobTags); + return run(() -> { + // Check before submitting the job + InferredSexAnalysis.checkParameters(params.getIndividual(), params.getSample(), study, catalogManager, token); + + // Submit the inferred sex analysis + return submitJobRaw(InferredSexAnalysis.ID, null, study, params, jobName, jobDescription, dependsOn, jobTags); + }); } @POST @@ -1118,88 +1125,13 @@ public Response individualQcRun( @ApiParam(value = ParamConstants.JOB_DEPENDS_ON_DESCRIPTION) @QueryParam(JOB_DEPENDS_ON) String dependsOn, @ApiParam(value = ParamConstants.JOB_TAGS_DESCRIPTION) @QueryParam(ParamConstants.JOB_TAGS) String jobTags, @ApiParam(value = IndividualQcAnalysisParams.DESCRIPTION, required = true) IndividualQcAnalysisParams params) { - return run(() -> { - List dependsOnList = StringUtils.isEmpty(dependsOn) ? new ArrayList<>() : Arrays.asList(dependsOn.split(",")); - - Individual individual = IndividualQcUtils.getIndividualById(study, params.getIndividual(), catalogManager, token); - - // Get samples of that individual, but only germline samples - List childGermlineSamples = IndividualQcUtils.getValidGermlineSamplesByIndividualId(study, individual.getId(), + // Check before submitting the job + IndividualQcAnalysis.checkParameters(params.getIndividual(), params.getSample(), params.getInferredSexMethod(), study, catalogManager, token); - if (CollectionUtils.isEmpty(childGermlineSamples)) { - throw new ToolException("Germline sample not found for individual '" + params.getIndividual() + "'"); - } - - Sample sample = null; - if (StringUtils.isNotEmpty(params.getSample())) { - for (Sample germlineSample : childGermlineSamples) { - if (params.getSample().equals(germlineSample.getId())) { - sample = germlineSample; - break; - } - } - if (sample == null) { - throw new ToolException("The provided sample '" + params.getSample() + "' not found in the individual '" - + params.getIndividual() + "'"); - } - } else { - // If multiple germline samples, we take the first one - sample = childGermlineSamples.get(0); - } - - org.opencb.opencga.core.models.file.File catalogBamFile; - catalogBamFile = AnalysisUtils.getBamFileBySampleId(sample.getId(), study, catalogManager.getFileManager(), token); - - if (catalogBamFile != null) { - // Check if .bw (coverage file) exists - OpenCGAResult fileResult; - - Query query = new Query(FileDBAdaptor.QueryParams.ID.key(), catalogBamFile.getId() + ".bw"); - fileResult = catalogManager.getFileManager().search(study, query, QueryOptions.empty(), token); - Job deeptoolsJob = null; - if (fileResult.getNumResults() == 0) { - // Coverage file does not exit, a job must be submitted to create the .bw file - // but first, check if .bai (bam index file) exist - - query = new Query(FileDBAdaptor.QueryParams.ID.key(), catalogBamFile.getId() + ".bai"); - fileResult = catalogManager.getFileManager().search(study, query, QueryOptions.empty(), token); - - Job samtoolsJob = null; - if (fileResult.getNumResults() == 0) { - // BAM index file does not exit, a job must be submitted to create the .bai file - SamtoolsWrapperParams samtoolsParams = new SamtoolsWrapperParams() - .setCommand("index") - .setInputFile(catalogBamFile.getId()) - .setSamtoolsParams(new HashMap<>()); - - DataResult jobResult = submitJobRaw(SamtoolsWrapperAnalysis.ID, null, study, samtoolsParams, null, null, null, - null); - samtoolsJob = jobResult.first(); - } - - // Coverage file does not exit, a job must be submitted to create the .bw file - DeeptoolsWrapperParams deeptoolsParams = new DeeptoolsWrapperParams() - .setCommand("bamCoverage"); - - Map bamCoverageParams = new HashMap<>(); - bamCoverageParams.put("b", catalogBamFile.getId()); - bamCoverageParams.put("o", Paths.get(catalogBamFile.getUri()).getFileName() + ".bw"); - bamCoverageParams.put("binSize", "1"); - bamCoverageParams.put("outFileFormat", "bigwig"); - bamCoverageParams.put("minMappingQuality", "20"); - deeptoolsParams.setDeeptoolsParams(bamCoverageParams); - - DataResult jobResult = submitJobRaw(DeeptoolsWrapperAnalysis.ID, null, study, deeptoolsParams, null, null, - samtoolsJob == null ? null : samtoolsJob.getId(), null); - deeptoolsJob = jobResult.first(); - dependsOnList.add(deeptoolsJob.getId()); - } - } - - return submitJobRaw(IndividualQcAnalysis.ID, null, study, params, jobName, jobDescription, StringUtils.join(dependsOnList, ","), - jobTags); + // Submit the individual QC analysis + return submitJobRaw(IndividualQcAnalysis.ID, null, study, params, jobName, jobDescription, dependsOn, jobTags); }); } diff --git a/opencga-storage/opencga-storage-app/pom.xml b/opencga-storage/opencga-storage-app/pom.xml index 38475fb2365..cc692c6fcea 100644 --- a/opencga-storage/opencga-storage-app/pom.xml +++ b/opencga-storage/opencga-storage-app/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-benchmark/pom.xml b/opencga-storage/opencga-storage-benchmark/pom.xml index 66f14ff71c6..bae503e0e91 100644 --- a/opencga-storage/opencga-storage-benchmark/pom.xml +++ b/opencga-storage/opencga-storage-benchmark/pom.xml @@ -22,7 +22,7 @@ opencga-storage org.opencb.opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-core/pom.xml b/opencga-storage/opencga-storage-core/pom.xml index e1fe11fd455..0dffe6806ff 100644 --- a/opencga-storage/opencga-storage-core/pom.xml +++ b/opencga-storage/opencga-storage-core/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManager.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManager.java index 34c08b356e2..350f577f9a9 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManager.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManager.java @@ -86,11 +86,12 @@ protected final VariantAnnotationMetadata checkCurrentAnnotation(ProjectMetadata current.setId(1); current.setName(CURRENT); } + boolean firstAnnotation = current.getAnnotator() == null; // Check using same annotator and same source version VariantAnnotatorProgram currentAnnotator = current.getAnnotator(); VariantAnnotatorProgram newAnnotator = newVariantAnnotationMetadata.getAnnotator(); - if (currentAnnotator != null && !currentAnnotator.equals(newAnnotator)) { + if (!firstAnnotation && !currentAnnotator.equals(newAnnotator)) { String currentVersion = removePatchFromVersion(currentAnnotator.getVersion()); String newVersion = removePatchFromVersion(newAnnotator.getVersion()); if (!currentAnnotator.getName().equals(newAnnotator.getName()) @@ -136,7 +137,7 @@ protected final VariantAnnotationMetadata checkCurrentAnnotation(ProjectMetadata if (newPrivateSources == null) { newPrivateSources = Collections.emptyList(); } - if (!new HashSet<>(currentPrivateSources).equals(new HashSet<>(newPrivateSources))) { + if (!firstAnnotation && !new HashSet<>(currentPrivateSources).equals(new HashSet<>(newPrivateSources))) { String msg = "Private sources has changed. " + "Existing annotation calculated with private sources " + currentPrivateSources + ", attempting to annotate with " + newPrivateSources; diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java index 33f24bbbe4a..ce6dad773e7 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/utils/CellBaseUtilsTest.java @@ -55,20 +55,10 @@ public class CellBaseUtilsTest { @Parameters(name = "{0}{1}/?assembly={2}%dataRelease={3}") public static List data() { return Arrays.asList( - new Object[]{"http://ws.opencb.org/cellbase-4.7.3/", "v4", "grch37", null}, - new Object[]{"http://ws.opencb.org/cellbase-4.8.2/", "v4", "grch37", null}, -// new Object[]{"http://ws.opencb.org/cellbase-4.8.3/", "v4", "grch37", null}, -// new Object[]{"http://ws.opencb.org/cellbase-4.9.0/", "v4", "grch37", null}, -// new Object[]{"http://ws.opencb.org/cellbase/", "v4", "grch37", null}, - -// new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.3", "grch37", "1"}, -// new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.3", "grch38", "2"}, - new Object[]{"https://ws.zettagenomics.com/cellbase/", "v5", "grch38", null}, - new Object[]{"https://ws.zettagenomics.com/cellbase/", "v5.1", "grch38", "1"}, - new Object[]{"https://ws.zettagenomics.com/cellbase/", "v5.1", "grch38", "2"}, new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.2", "grch37", "1"}, - new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.2", "grch38", "2"}, - new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.4", "grch38", "3"}); + new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.2", "grch38", "3"}, + new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.8", "grch37", "1"}, + new Object[]{"https://uk.ws.zettagenomics.com/cellbase/", "v5.8", "grch38", "3"}); } @Parameter(0) @@ -206,7 +196,6 @@ public void convertGeneToRegionFail() { @Test public void validateGeneNames() { - Assume.assumeTrue(!version.startsWith("v4")); Assume.assumeFalse("HGNC ids not supported in GRCH37", assembly.equalsIgnoreCase("grch37")); List validated = cellBaseUtils.validateGenes(Arrays.asList("BRCA2", "NonExistingGene", "HGNC:12363"), true); assertEquals(Arrays.asList("BRCA2", "TSC2"), validated); @@ -215,6 +204,7 @@ public void validateGeneNames() { @Test @Ignore public void testGetVariant() throws Exception { + Assume.assumeFalse(assembly.equalsIgnoreCase("grch37")); assertEquals(new Variant("19:44934489:G:A"), cellBaseUtils.getVariant("rs2571174")); assertEquals(Arrays.asList(new Variant("19:44934489:G:A"), new Variant("1:7797503:C:G")), cellBaseUtils.getVariants(Arrays.asList("rs2571174", "rs41278952"))); diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java index a581ae3f2b0..fe7cebbd6a4 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java @@ -56,8 +56,8 @@ public void before() throws Exception { protected void loadFiles() throws Exception { variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL); - variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.1"); - variantStorageEngine.getConfiguration().getCellbase().setDataRelease("2"); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.2"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("3"); variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38"); variantStorageEngine.reloadCellbaseConfiguration(); diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManagerTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManagerTest.java index 26b5dcfad4f..dc2721882fa 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManagerTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/VariantAnnotationManagerTest.java @@ -1,6 +1,8 @@ package org.opencb.opencga.storage.core.variant.annotation; import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.junit.Assume; import org.junit.Test; import org.opencb.biodata.models.variant.avro.VariantAnnotation; import org.opencb.commons.datastore.core.ObjectMap; @@ -88,12 +90,46 @@ public void testChangeAnnotatorFail() throws Exception { assertEquals("v2", variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getAnnotator().getVersion()); } + @Test + public void testApiKey() throws Exception { + String cosmicApiKey = System.getenv("CELLBASE_COSMIC_APIKEY"); + String hgmdApiKey = System.getenv("CELLBASE_HGMD_APIKEY"); + Assume.assumeTrue(StringUtils.isNotEmpty(cosmicApiKey)); + Assume.assumeTrue(StringUtils.isNotEmpty(hgmdApiKey)); + + VariantStorageEngine variantStorageEngine = getVariantStorageEngine(); + variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.4"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("3"); + variantStorageEngine.getConfiguration().getCellbase().setApiKey(cosmicApiKey); + variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38"); + variantStorageEngine.reloadCellbaseConfiguration(); + variantStorageEngine.getCellBaseUtils().validate(); + + runDefaultETL(smallInputUri, variantStorageEngine, newStudyMetadata(), + new ObjectMap(VariantStorageOptions.ANNOTATE.key(), false)); + + variantStorageEngine.annotate(outputUri, new ObjectMap()); + + variantStorageEngine.getConfiguration().getCellbase().setApiKey(hgmdApiKey); + variantStorageEngine.reloadCellbaseConfiguration(); + variantStorageEngine.getCellBaseUtils().validate(); + + try { + variantStorageEngine.annotate(outputUri, new ObjectMap()); + fail("Expected to fail!"); + } catch (VariantAnnotatorException e) { + assertTrue(e.getMessage().contains("Existing annotation calculated with private sources [cosmic], attempting to annotate with [hgmd]")); + } + variantStorageEngine.annotate(outputUri, new ObjectMap(VariantStorageOptions.ANNOTATION_OVERWEITE.key(), true)); + } + @Test public void testChangeDataRelease() throws Exception { VariantStorageEngine variantStorageEngine = getVariantStorageEngine(); variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL); - variantStorageEngine.getConfiguration().getCellbase().setVersion("v5"); - variantStorageEngine.getConfiguration().getCellbase().setDataRelease(null); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.2"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("2"); variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38"); variantStorageEngine.reloadCellbaseConfiguration(); variantStorageEngine.getCellBaseUtils().validate(); @@ -103,10 +139,10 @@ public void testChangeDataRelease() throws Exception { // First annotation. Should run ok. variantStorageEngine.annotate(outputUri, new ObjectMap()); - assertNull(variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease()); + assertEquals(2, variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease()); - variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.1"); - variantStorageEngine.getConfiguration().getCellbase().setDataRelease("1"); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.8"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("2"); variantStorageEngine.reloadCellbaseConfiguration(); // New annotator. Do not overwrite. Should fail. @@ -119,10 +155,10 @@ public void testChangeDataRelease() throws Exception { // New annotator. Overwrite. Should run ok. variantStorageEngine.annotate(outputUri, new ObjectMap(VariantStorageOptions.ANNOTATION_OVERWEITE.key(), true)); - assertEquals("1", String.valueOf(variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease())); + assertEquals(2, variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease()); - variantStorageEngine.getConfiguration().getCellbase().setDataRelease("2"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("3"); variantStorageEngine.reloadCellbaseConfiguration(); // Same annotator, new datarelease. Do not overwrite. Should fail. @@ -131,16 +167,16 @@ public void testChangeDataRelease() throws Exception { fail("Should fail"); } catch (Exception e) { e.printStackTrace(); - assertEquals("DataRelease has changed. Existing annotation calculated with dataRelease 1, attempting to annotate with 2", e.getMessage()); + assertEquals("DataRelease has changed. Existing annotation calculated with dataRelease 2, attempting to annotate with 3", e.getMessage()); } // Same annotator, new datarelease. Overwrite. Should run ok. variantStorageEngine.annotate(outputUri, new ObjectMap(VariantStorageOptions.ANNOTATION_OVERWEITE.key(), true)); - assertEquals("2", String.valueOf(variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease())); + assertEquals(3, variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease()); - // Revert annotator to 5.0. Do not overwrite. Should fail. - variantStorageEngine.getConfiguration().getCellbase().setDataRelease(null); - variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.0"); + // Revert annotator to 5.2. Do not overwrite. Should fail. + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("3"); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.2"); variantStorageEngine.reloadCellbaseConfiguration(); try { variantStorageEngine.annotate(outputUri, new ObjectMap(VariantStorageOptions.ANNOTATION_OVERWEITE.key(), false)); @@ -149,9 +185,9 @@ public void testChangeDataRelease() throws Exception { e.printStackTrace(); } - // Revert annotator to 5.0. Do not overwrite. Should run ok. + // Revert annotator to 5.2 Overwrite. Should run ok. variantStorageEngine.annotate(outputUri, new ObjectMap(VariantStorageOptions.ANNOTATION_OVERWEITE.key(), true)); - assertNull(variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease()); + assertEquals(3, variantStorageEngine.getMetadataManager().getProjectMetadata().getAnnotation().getCurrent().getDataRelease().getRelease()); } @Test diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java index 455eaa5f071..6ece2f05138 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorByApiKeyTest.java @@ -38,11 +38,11 @@ public void setUp() throws Exception { String url = "https://uk.ws.zettagenomics.com/cellbase/"; storageConfiguration.getCellbase().setUrl(url); storageConfiguration.getCellbase().setDataRelease("3"); - storageConfiguration.getCellbase().setVersion("v5.4"); + storageConfiguration.getCellbase().setVersion("v5.8"); storageConfiguration.getCellbase().setApiKey(null); CellBaseUtils cellBaseUtils = new CellBaseUtils(new CellBaseClient(storageConfiguration.getCellbase().toClientConfiguration())); - Assume.assumeTrue(cellBaseUtils.isMinVersion("v5.4")); + Assume.assumeTrue(cellBaseUtils.isMinVersion("v5.8")); projectMetadata = new ProjectMetadata("hsapiens", "grch38", "3", 1, null, null, null); } diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java index 9e2e3a353fa..5f50c28828d 100644 --- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java +++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/annotation/annotators/VariantAnnotatorTest.java @@ -110,11 +110,10 @@ public void testErrorVariant() throws VariantAnnotatorException { testAnnotator.annotate(Arrays.asList(new Variant("10:999:A:C"), new Variant("10:1000:A:C"), new Variant("10:1001:A:C"))); } - @Ignore @Test public void useCellBaseApiKeys() throws VariantAnnotatorException { storageConfiguration.getCellbase().setUrl("https://uk.ws.zettagenomics.com/cellbase/"); - storageConfiguration.getCellbase().setVersion("v5.4"); + storageConfiguration.getCellbase().setVersion("v5.8"); storageConfiguration.getCellbase().setDataRelease("3"); VariantAnnotator variantAnnotator = null; diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-api/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-api/pom.xml index c132f168e75..deac888af82 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-api/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-api/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage-hadoop-compat - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.0/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.0/pom.xml index 5397637414f..661d9416a8f 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.0/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.0/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage-hadoop-compat - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.2/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.2/pom.xml index 9faa5dbe70a..358590f69f6 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.2/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.2/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage-hadoop-compat - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.4/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.4/pom.xml index 140f3c239e6..394e6c90e16 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.4/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/opencga-storage-hadoop-compat-hbase2.4/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage-hadoop-compat - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/pom.xml index 4718c9e24e6..58aac8414c5 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-compat/pom.xml @@ -23,7 +23,7 @@ org.opencb.opencga opencga-storage-hadoop - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/pom.xml index c7b4e429c48..8c00149ba90 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/pom.xml @@ -23,7 +23,7 @@ org.opencb.opencga opencga-storage-hadoop - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml @@ -60,6 +60,12 @@ ${jetty-for-hadoop-test.version} test + + org.eclipse.jetty.http2 + http2-hpack + ${jetty-for-hadoop-test.version} + test + org.eclipse.jetty jetty-io diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/family/FamilyIndexTest.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/family/FamilyIndexTest.java index 034e676c1b4..ccafd14be63 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/family/FamilyIndexTest.java +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/family/FamilyIndexTest.java @@ -66,8 +66,8 @@ public void before() throws Exception { if (!loaded) { HadoopVariantStorageEngine variantStorageEngine = getVariantStorageEngine(); variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL); - variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.1"); - variantStorageEngine.getConfiguration().getCellbase().setDataRelease("2"); + variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.2"); + variantStorageEngine.getConfiguration().getCellbase().setDataRelease("3"); variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38"); variantStorageEngine.reloadCellbaseConfiguration(); URI outputUri = newOutputUri(); diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexTest.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexTest.java index 0e478690499..6267f8d8e23 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexTest.java +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexTest.java @@ -222,13 +222,6 @@ public void load() throws Exception { // ---------------- Annotate -// variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL); -// variantStorageEngine.getConfiguration().getCellbase().setVersion("v5.1"); -// variantStorageEngine.getMetadataManager().updateProjectMetadata(projectMetadata -> { -// projectMetadata.setAssembly("grch38"); -// }); -// variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38"); -// this.variantStorageEngine.reloadCellbaseConfiguration(); this.variantStorageEngine.annotate(outputUri, new QueryOptions()); engine.familyIndex(STUDY_NAME_3, triosPlatinum, new ObjectMap()); diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.1/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.1/pom.xml index 7e68b543899..45370142854 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.1/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.1/pom.xml @@ -7,7 +7,7 @@ org.opencb.opencga opencga-storage-hadoop-lib - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.13/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.13/pom.xml index 4f5a99e5897..82a3d1f0fdc 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.13/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-emr6.13/pom.xml @@ -7,7 +7,7 @@ org.opencb.opencga opencga-storage-hadoop-lib - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdi5.1/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdi5.1/pom.xml index 31b1f00598d..c4839e1c646 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdi5.1/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdi5.1/pom.xml @@ -7,7 +7,7 @@ org.opencb.opencga opencga-storage-hadoop-lib - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdp3.1/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdp3.1/pom.xml index 024269d35fc..8d09832b15a 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdp3.1/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/opencga-storage-hadoop-lib-hdp3.1/pom.xml @@ -7,7 +7,7 @@ org.opencb.opencga opencga-storage-hadoop-lib - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/pom.xml b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/pom.xml index 917c026de61..0326f2479f3 100644 --- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-lib/pom.xml @@ -23,7 +23,7 @@ org.opencb.opencga opencga-storage-hadoop - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-hadoop/pom.xml b/opencga-storage/opencga-storage-hadoop/pom.xml index b3264cdf8db..7d97161a5e3 100644 --- a/opencga-storage/opencga-storage-hadoop/pom.xml +++ b/opencga-storage/opencga-storage-hadoop/pom.xml @@ -23,7 +23,7 @@ org.opencb.opencga opencga-storage - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/opencga-storage-server/pom.xml b/opencga-storage/opencga-storage-server/pom.xml index c2d67f4046c..054ab3bc9de 100644 --- a/opencga-storage/opencga-storage-server/pom.xml +++ b/opencga-storage/opencga-storage-server/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga-storage - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/opencga-storage/pom.xml b/opencga-storage/pom.xml index 221a9b348c6..c3f5166b7fd 100644 --- a/opencga-storage/pom.xml +++ b/opencga-storage/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml @@ -101,7 +101,7 @@ analyze-only - true + false diff --git a/opencga-test/pom.xml b/opencga-test/pom.xml index dcf660958ab..12981fefe10 100644 --- a/opencga-test/pom.xml +++ b/opencga-test/pom.xml @@ -24,7 +24,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 4b98a5274f8..24e41953d60 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.opencb.opencga opencga - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT pom OpenCGA @@ -43,12 +43,12 @@ - 3.0.0_dev - 3.0.0_dev - 6.0.0-SNAPSHOT - 3.0.0-SNAPSHOT - 5.0.0-SNAPSHOT - 3.0.0-SNAPSHOT + 3.1.0_dev + 3.1.0_dev + 6.1.0-SNAPSHOT + 3.1.0-SNAPSHOT + 5.1.0-SNAPSHOT + 3.1.0-SNAPSHOT 0.2.0 2.14.3 @@ -59,10 +59,10 @@ 1.28.1 1.7.36 2.17.2 - 8.11.2 + 8.11.3 0.11.2 - 9.4.51.v20230217 + 9.4.53.v20231009 ${jetty.version} 28.0-jre 2.23.0 @@ -885,6 +885,12 @@ com.microsoft.azure adal4j ${adal4j.version} + + + org.slf4j + slf4j-simple + + com.microsoft.graph @@ -910,11 +916,23 @@ com.microsoft.azure azure-client-runtime ${azure-client.version} + + + org.slf4j + slf4j-simple + + com.microsoft.azure azure-client-authentication ${azure-client.version} + + + org.slf4j + slf4j-simple + + org.apache.httpcomponents @@ -935,6 +953,12 @@ com.microsoft.azure azure-batch ${azure-batch.version} + + + org.slf4j + slf4j-simple + + io.fabric8 @@ -1042,6 +1066,12 @@ azure-storage-blob ${azure-storage-blob.version} ${azure.optional} + + + org.slf4j + slf4j-simple + + com.google.code.findbugs