Skip to content

Commit

Permalink
server: add facets (aggregation stats) for clinical analyses and inte…
Browse files Browse the repository at this point in the history
…rpretations, #TASK-7152, #TASK-7134
  • Loading branch information
jtarraga committed Oct 28, 2024
1 parent 68c8290 commit 1982e4c
Show file tree
Hide file tree
Showing 10 changed files with 598 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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","report-update")
private List<Candidate> clinicalList = asList( "acl-update","aggregationstats","annotation-sets-load","clinical-configuration-update","create","distinct","interpretation-aggregation-stats","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
Expand Up @@ -113,10 +113,12 @@ public OpencgaCliOptionsParser() {
jCommander.addCommand("clinical", analysisClinicalCommandOptions);
JCommander analysisClinicalSubCommands = jCommander.getCommands().get("clinical");
analysisClinicalSubCommands.addCommand("acl-update", analysisClinicalCommandOptions.updateAclCommandOptions);
analysisClinicalSubCommands.addCommand("aggregationstats", analysisClinicalCommandOptions.aggregationStatsCommandOptions);
analysisClinicalSubCommands.addCommand("annotation-sets-load", analysisClinicalCommandOptions.loadAnnotationSetsCommandOptions);
analysisClinicalSubCommands.addCommand("clinical-configuration-update", analysisClinicalCommandOptions.updateClinicalConfigurationCommandOptions);
analysisClinicalSubCommands.addCommand("create", analysisClinicalCommandOptions.createCommandOptions);
analysisClinicalSubCommands.addCommand("distinct", analysisClinicalCommandOptions.distinctCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-aggregation-stats", analysisClinicalCommandOptions.aggregationStatsInterpretationCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-distinct", analysisClinicalCommandOptions.distinctInterpretationCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-search", analysisClinicalCommandOptions.searchInterpretationCommandOptions);
analysisClinicalSubCommands.addCommand("interpretation-info", analysisClinicalCommandOptions.infoInterpretationCommandOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public void execute() throws Exception {
case "acl-update":
queryResponse = updateAcl();
break;
case "aggregationstats":
queryResponse = aggregationStats();
break;
case "annotation-sets-load":
queryResponse = loadAnnotationSets();
break;
Expand All @@ -115,6 +118,9 @@ public void execute() throws Exception {
case "distinct":
queryResponse = distinct();
break;
case "interpretation-aggregation-stats":
queryResponse = aggregationStatsInterpretation();
break;
case "interpretation-distinct":
queryResponse = distinctInterpretation();
break;
Expand Down Expand Up @@ -248,6 +254,48 @@ private RestResponse<ClinicalAnalysisAclEntryList> updateAcl() throws Exception
return openCGAClient.getClinicalAnalysisClient().updateAcl(commandOptions.members, commandOptions.action, clinicalAnalysisAclUpdateParams, queryParams);
}

private RestResponse<FacetField> aggregationStats() throws Exception {
logger.debug("Executing aggregationStats in Analysis - Clinical command line");

AnalysisClinicalCommandOptions.AggregationStatsCommandOptions commandOptions = analysisClinicalCommandOptions.aggregationStatsCommandOptions;

ObjectMap queryParams = new ObjectMap();
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("id", commandOptions.id);
queryParams.putIfNotEmpty("uuid", commandOptions.uuid);
queryParams.putIfNotEmpty("type", commandOptions.type);
queryParams.putIfNotEmpty("disorder", commandOptions.disorder);
queryParams.putIfNotEmpty("files", commandOptions.files);
queryParams.putIfNotEmpty("sample", commandOptions.sample);
queryParams.putIfNotEmpty("individual", commandOptions.individual);
queryParams.putIfNotEmpty("proband", commandOptions.proband);
queryParams.putIfNotEmpty("probandSamples", commandOptions.probandSamples);
queryParams.putIfNotEmpty("family", commandOptions.family);
queryParams.putIfNotEmpty("familyMembers", commandOptions.familyMembers);
queryParams.putIfNotEmpty("familyMemberSamples", commandOptions.familyMemberSamples);
queryParams.putIfNotEmpty("panels", commandOptions.panels);
queryParams.putIfNotNull("locked", commandOptions.locked);
queryParams.putIfNotEmpty("analystId", commandOptions.analystId);
queryParams.putIfNotEmpty("priority", commandOptions.priority);
queryParams.putIfNotEmpty("flags", commandOptions.flags);
queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate);
queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate);
queryParams.putIfNotEmpty("dueDate", commandOptions.dueDate);
queryParams.putIfNotEmpty("qualityControlSummary", commandOptions.qualityControlSummary);
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotNull("snapshot", commandOptions.snapshot);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
queryParams.putIfNotEmpty("annotation", commandOptions.annotation);
queryParams.putIfNotNull("deleted", commandOptions.deleted);
queryParams.putIfNotEmpty("field", commandOptions.field);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
}

return openCGAClient.getClinicalAnalysisClient().aggregationStats(queryParams);
}

private RestResponse<Job> loadAnnotationSets() throws Exception {
logger.debug("Executing loadAnnotationSets in Analysis - Clinical command line");

Expand Down Expand Up @@ -432,6 +480,35 @@ private RestResponse<ObjectMap> distinct() throws Exception {
return openCGAClient.getClinicalAnalysisClient().distinct(commandOptions.field, queryParams);
}

private RestResponse<FacetField> aggregationStatsInterpretation() throws Exception {
logger.debug("Executing aggregationStatsInterpretation in Analysis - Clinical command line");

AnalysisClinicalCommandOptions.AggregationStatsInterpretationCommandOptions commandOptions = analysisClinicalCommandOptions.aggregationStatsInterpretationCommandOptions;

ObjectMap queryParams = new ObjectMap();
queryParams.putIfNotEmpty("study", commandOptions.study);
queryParams.putIfNotEmpty("id", commandOptions.id);
queryParams.putIfNotEmpty("uuid", commandOptions.uuid);
queryParams.putIfNotEmpty("name", commandOptions.name);
queryParams.putIfNotEmpty("clinicalAnalysisId", commandOptions.clinicalAnalysisId);
queryParams.putIfNotEmpty("analystId", commandOptions.analystId);
queryParams.putIfNotEmpty("methodName", commandOptions.methodName);
queryParams.putIfNotEmpty("panels", commandOptions.panels);
queryParams.putIfNotEmpty("primaryFindings", commandOptions.primaryFindings);
queryParams.putIfNotEmpty("secondaryFindings", commandOptions.secondaryFindings);
queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate);
queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate);
queryParams.putIfNotEmpty("status", commandOptions.status);
queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus);
queryParams.putIfNotEmpty("release", commandOptions.release);
queryParams.putIfNotEmpty("field", commandOptions.field);
if (queryParams.get("study") == null && OpencgaMain.isShellMode()) {
queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy());
}

return openCGAClient.getClinicalAnalysisClient().aggregationStatsInterpretation(queryParams);
}

private RestResponse<ObjectMap> distinctInterpretation() throws Exception {
logger.debug("Executing distinctInterpretation in Analysis - Clinical command line");

Expand Down
Loading

0 comments on commit 1982e4c

Please sign in to comment.