Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-5618 - Port Patch 2.12.2 -> 3.0.0 (XB 1.10.2 -> 2.0.0) #2408

Merged
merged 33 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
76eef6f
catalog: update report with actions, #TASK-5349
pfurio Dec 1, 2023
98f3f05
Prepare next release 2.12.2-SNAPSHOT
juanfeSanahuja Dec 20, 2023
9c78cc6
Merge branch 'release-2.12.x' into TASK-5349
pfurio Dec 22, 2023
7f39487
Merge pull request #2369 from opencb/TASK-5349
pfurio Dec 22, 2023
7e957cc
app: update opencga-ext-tools dockerfile, #TASK-5450
jtarraga Jan 11, 2024
0989602
pom: exclude slf4j-simple from azure dependencies #TASK-5404
juanfeSanahuja Jan 11, 2024
e38f516
Merge pull request #2371 from opencb/TASK-5450
jtarraga Jan 11, 2024
04bf491
Merge branch 'release-2.12.x' into TASK-5404
juanfeSanahuja Jan 11, 2024
f6ab5d6
Merge pull request #2372 from opencb/TASK-5404
juanfeSanahuja Jan 11, 2024
3e90d67
storage: Fix hbase ssh command execution. Avoid double splitting. #TA…
j-coll Jan 12, 2024
9eaef09
Copy method getObjectAsJSON to CommandExecutor for be used in enterpr…
juanfeSanahuja Jan 18, 2024
3f1c8f8
app: update the content of the resource README file, #TASK-5501
jtarraga Jan 19, 2024
0b8ca91
Added workaround for sonar
juanfeSanahuja Jan 23, 2024
5f1ce41
Merge branch 'TASK-5475' into TASK-5475-release
juanfeSanahuja Jan 25, 2024
ccebb07
Merge branch 'TASK-5475' into TASK-5475-release
juanfeSanahuja Jan 25, 2024
86026da
Merge pull request #2385 from opencb/TASK-5475-release
juanfeSanahuja Jan 26, 2024
874b0df
Merge branch 'release-2.12.x' into TASK-5482
juanfeSanahuja Jan 26, 2024
39b05ec
Merge pull request #2377 from opencb/TASK-5482
juanfeSanahuja Jan 26, 2024
d75b215
CommanExecutor: Fix malformed JSON #TASK-5511
juanfeSanahuja Jan 26, 2024
39da25d
Merge branch 'release-2.12.x' into TASK-5501
jtarraga Jan 29, 2024
cfcf47e
Merge pull request #2378 from opencb/TASK-5501
jtarraga Jan 29, 2024
d51611a
Merge pull request #2374 from opencb/TASK-5452
j-coll Jan 29, 2024
780b54a
Merge branch 'release-2.12.x' into TASK-5511
juanfeSanahuja Jan 30, 2024
88c589a
Merge pull request #2386 from opencb/TASK-5511
juanfeSanahuja Jan 30, 2024
a3fcda0
Clients for release 2.12.2 #TASK-5445
juanfeSanahuja Jan 30, 2024
aaf7129
client: Autogerated classes to Fix meta/model client #TASK-5580
juanfeSanahuja Feb 2, 2024
c361224
Merge pull request #2388 from opencb/TASK-5580
juanfeSanahuja Feb 5, 2024
be0798f
Prepare release 2.12.2
juanfeSanahuja Feb 6, 2024
311a97f
Prepare portpatch #TASK-5618
juanfeSanahuja Mar 5, 2024
2e8b13f
Merge branch 'develop' into TASK-5618
juanfeSanahuja Mar 6, 2024
730e249
catalog: fix ClinicalAnalysisManager for port patch, #TASK-5618
pfurio Mar 6, 2024
1ed3c35
Port Patch 1.10.2 -> 2.0.0 #TASK-5618
juanfeSanahuja Mar 6, 2024
df495c1
Deleted the folder opencga-storage-hadoop-deps #TASK-5618
juanfeSanahuja Mar 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 4 additions & 53 deletions opencga-app/app/analysis/resources/README
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions opencga-app/app/cloud/docker/opencga-ext-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,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
Expand Down
18 changes: 9 additions & 9 deletions opencga-app/app/misc/scripts/hadoop-ssh.sh
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -36,6 +45,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

/**
* Created by imedina on 19/04/16.
Expand Down Expand Up @@ -281,6 +291,95 @@ 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<List> response = openCGAClient.getMetaClient().api(queryParams);
ObjectMapper jsonObjectMapper = new ObjectMapper();
for (List list : response.getResponses().get(0).getResults()) {
List<RestCategory> categories = jsonObjectMapper.convertValue(list, new TypeReference<List<RestCategory>>() {});
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<RestParameter> 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 "\"-\"";
}
}


public Logger getLogger() {
return logger;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2024-03-04 OpenCB
* Copyright 2015-2024-03-06 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +60,7 @@ public abstract class OpenCgaCompleter implements Completer {
.map(Candidate::new)
.collect(toList());

private List<Candidate> 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<Candidate> 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());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2024-03-04 OpenCB
* Copyright 2015-2024-03-06 OpenCB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1485,4 +1488,48 @@ private RestResponse<Interpretation> updateInterpretation() throws Exception {
}
return openCGAClient.getClinicalAnalysisClient().updateInterpretation(commandOptions.clinicalAnalysis, commandOptions.interpretation, interpretationUpdateParams, queryParams);
}

private RestResponse<ClinicalReport> 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<ClinicalReport> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ private RestResponse<String> 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<String> ping() throws Exception {
Expand Down
Loading
Loading