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 fa5b348228..efa60539cb 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 @@ -39,17 +39,17 @@ public abstract class OpenCgaCompleter implements Completer { .map(Candidate::new) .collect(toList()); - private List panelsList = asList( "acl-update","create","distinct","import","search","acl","delete","info","update") + private List panelsList = asList( "acl-update","aggregationstats","create","distinct","import","search","acl","delete","info","update") .stream() .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","report-update") + private List 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()); - private List jobsList = asList( "acl-update","create","distinct","retry","search","top","acl","delete","info","update","kill","log-head","log-tail") + private List jobsList = asList( "acl-update","aggregationstats","create","distinct","retry","search","top","acl","delete","info","update","kill","log-head","log-tail") .stream() .map(Candidate::new) .collect(toList()); @@ -59,12 +59,12 @@ public abstract class OpenCgaCompleter implements Completer { .map(Candidate::new) .collect(toList()); - private List individualsList = asList( "acl-update","annotation-sets-load","create","distinct","search","acl","delete","info","update","annotation-sets-annotations-update","relatives") + private List individualsList = asList( "acl-update","aggregationstats","annotation-sets-load","create","distinct","search","acl","delete","info","update","annotation-sets-annotations-update","relatives") .stream() .map(Candidate::new) .collect(toList()); - private List familiesList = asList( "acl-update","annotation-sets-load","create","distinct","search","acl","delete","info","update","annotation-sets-annotations-update") + private List familiesList = asList( "acl-update","aggregationstats","annotation-sets-load","create","distinct","search","acl","delete","info","update","annotation-sets-annotations-update") .stream() .map(Candidate::new) .collect(toList()); @@ -74,7 +74,7 @@ public abstract class OpenCgaCompleter implements Completer { .map(Candidate::new) .collect(toList()); - private List samplesList = asList( "acl-update","annotation-sets-load","create","distinct","load","search","acl","delete","info","update","annotation-sets-annotations-update") + private List samplesList = asList( "acl-update","aggregationstats","annotation-sets-load","create","distinct","load","search","acl","delete","info","update","annotation-sets-annotations-update") .stream() .map(Candidate::new) .collect(toList()); @@ -99,7 +99,7 @@ public abstract class OpenCgaCompleter implements Completer { .map(Candidate::new) .collect(toList()); - private List filesList = asList( "acl-update","annotation-sets-load","bioformats","create","distinct","fetch","formats","link","link-run","postlink-run","search","upload","acl","delete","info","unlink","update","annotation-sets-annotations-update","download","grep","head","image","move","refresh","tail","list","tree") + private List filesList = asList( "acl-update","aggregationstats","annotation-sets-load","bioformats","create","distinct","fetch","formats","link","link-run","postlink-run","search","upload","acl","delete","info","unlink","update","annotation-sets-annotations-update","download","grep","head","image","move","refresh","tail","list","tree") .stream() .map(Candidate::new) .collect(toList()); @@ -109,7 +109,7 @@ public abstract class OpenCgaCompleter implements Completer { .map(Candidate::new) .collect(toList()); - private List cohortsList = asList( "acl-update","annotation-sets-load","create","distinct","generate","search","acl","delete","info","update","annotation-sets-annotations-update") + private List cohortsList = asList( "acl-update","aggregationstats","annotation-sets-load","create","distinct","generate","search","acl","delete","info","update","annotation-sets-annotations-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 cfd4cee991..ec5f2e3186 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 @@ -99,6 +99,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("panels", diseasePanelsCommandOptions); JCommander diseasePanelsSubCommands = jCommander.getCommands().get("panels"); diseasePanelsSubCommands.addCommand("acl-update", diseasePanelsCommandOptions.updateAclCommandOptions); + diseasePanelsSubCommands.addCommand("aggregationstats", diseasePanelsCommandOptions.aggregationStatsCommandOptions); diseasePanelsSubCommands.addCommand("create", diseasePanelsCommandOptions.createCommandOptions); diseasePanelsSubCommands.addCommand("distinct", diseasePanelsCommandOptions.distinctCommandOptions); diseasePanelsSubCommands.addCommand("import", diseasePanelsCommandOptions.importCommandOptions); @@ -112,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); @@ -151,6 +154,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("jobs", jobsCommandOptions); JCommander jobsSubCommands = jCommander.getCommands().get("jobs"); jobsSubCommands.addCommand("acl-update", jobsCommandOptions.updateAclCommandOptions); + jobsSubCommands.addCommand("aggregationstats", jobsCommandOptions.aggregationStatsCommandOptions); jobsSubCommands.addCommand("create", jobsCommandOptions.createCommandOptions); jobsSubCommands.addCommand("distinct", jobsCommandOptions.distinctCommandOptions); jobsSubCommands.addCommand("retry", jobsCommandOptions.retryCommandOptions); @@ -182,6 +186,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("individuals", individualsCommandOptions); JCommander individualsSubCommands = jCommander.getCommands().get("individuals"); individualsSubCommands.addCommand("acl-update", individualsCommandOptions.updateAclCommandOptions); + individualsSubCommands.addCommand("aggregationstats", individualsCommandOptions.aggregationStatsCommandOptions); individualsSubCommands.addCommand("annotation-sets-load", individualsCommandOptions.loadAnnotationSetsCommandOptions); individualsSubCommands.addCommand("create", individualsCommandOptions.createCommandOptions); individualsSubCommands.addCommand("distinct", individualsCommandOptions.distinctCommandOptions); @@ -197,6 +202,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("families", familiesCommandOptions); JCommander familiesSubCommands = jCommander.getCommands().get("families"); familiesSubCommands.addCommand("acl-update", familiesCommandOptions.updateAclCommandOptions); + familiesSubCommands.addCommand("aggregationstats", familiesCommandOptions.aggregationStatsCommandOptions); familiesSubCommands.addCommand("annotation-sets-load", familiesCommandOptions.loadAnnotationSetsCommandOptions); familiesSubCommands.addCommand("create", familiesCommandOptions.createCommandOptions); familiesSubCommands.addCommand("distinct", familiesCommandOptions.distinctCommandOptions); @@ -227,6 +233,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("samples", samplesCommandOptions); JCommander samplesSubCommands = jCommander.getCommands().get("samples"); samplesSubCommands.addCommand("acl-update", samplesCommandOptions.updateAclCommandOptions); + samplesSubCommands.addCommand("aggregationstats", samplesCommandOptions.aggregationStatsCommandOptions); samplesSubCommands.addCommand("annotation-sets-load", samplesCommandOptions.loadAnnotationSetsCommandOptions); samplesSubCommands.addCommand("create", samplesCommandOptions.createCommandOptions); samplesSubCommands.addCommand("distinct", samplesCommandOptions.distinctCommandOptions); @@ -309,6 +316,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("files", filesCommandOptions); JCommander filesSubCommands = jCommander.getCommands().get("files"); filesSubCommands.addCommand("acl-update", filesCommandOptions.updateAclCommandOptions); + filesSubCommands.addCommand("aggregationstats", filesCommandOptions.aggregationStatsCommandOptions); filesSubCommands.addCommand("annotation-sets-load", filesCommandOptions.loadAnnotationSetsCommandOptions); filesSubCommands.addCommand("bioformats", filesCommandOptions.bioformatsCommandOptions); filesSubCommands.addCommand("create", filesCommandOptions.createCommandOptions); @@ -373,6 +381,7 @@ public OpencgaCliOptionsParser() { jCommander.addCommand("cohorts", cohortsCommandOptions); JCommander cohortsSubCommands = jCommander.getCommands().get("cohorts"); cohortsSubCommands.addCommand("acl-update", cohortsCommandOptions.updateAclCommandOptions); + cohortsSubCommands.addCommand("aggregationstats", cohortsCommandOptions.aggregationStatsCommandOptions); cohortsSubCommands.addCommand("annotation-sets-load", cohortsCommandOptions.loadAnnotationSetsCommandOptions); cohortsSubCommands.addCommand("create", cohortsCommandOptions.createCommandOptions); cohortsSubCommands.addCommand("distinct", cohortsCommandOptions.distinctCommandOptions); 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 45bb96358d..8add2f8009 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 @@ -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; @@ -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; @@ -248,6 +254,48 @@ private RestResponse updateAcl() throws Exception return openCGAClient.getClinicalAnalysisClient().updateAcl(commandOptions.members, commandOptions.action, clinicalAnalysisAclUpdateParams, queryParams); } + private RestResponse 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 loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Analysis - Clinical command line"); @@ -432,6 +480,35 @@ private RestResponse distinct() throws Exception { return openCGAClient.getClinicalAnalysisClient().distinct(commandOptions.field, queryParams); } + private RestResponse 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 distinctInterpretation() throws Exception { logger.debug("Executing distinctInterpretation in Analysis - Clinical command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java index 287c2223a0..0e5e365882 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/CohortsCommandExecutor.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -66,6 +67,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "annotation-sets-load": queryResponse = loadAnnotationSets(); break; @@ -138,6 +142,35 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getCohortClient().updateAcl(commandOptions.members, commandOptions.action, cohortAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Cohorts command line"); + + CohortsCommandOptions.AggregationStatsCommandOptions commandOptions = cohortsCommandOptions.aggregationStatsCommandOptions; + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("study", commandOptions.study); + queryParams.putIfNotEmpty("id", commandOptions.id); + queryParams.putIfNotEmpty("name", commandOptions.name); + queryParams.putIfNotEmpty("uuid", commandOptions.uuid); + queryParams.putIfNotEmpty("type", commandOptions.type); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("annotation", commandOptions.annotation); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotEmpty("samples", commandOptions.samples); + queryParams.putIfNotEmpty("numSamples", commandOptions.numSamples); + 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.getCohortClient().aggregationStats(queryParams); + } + private RestResponse loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Cohorts command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java index d2fde239e7..300f8ead69 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/DiseasePanelsCommandExecutor.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import org.opencb.biodata.models.clinical.interpretation.DiseasePanel; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -61,6 +62,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "create": queryResponse = create(); break; @@ -127,6 +131,39 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getDiseasePanelClient().updateAcl(commandOptions.members, commandOptions.action, panelAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Disease Panels command line"); + + DiseasePanelsCommandOptions.AggregationStatsCommandOptions commandOptions = diseasePanelsCommandOptions.aggregationStatsCommandOptions; + + 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("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("disorders", commandOptions.disorders); + queryParams.putIfNotEmpty("variants", commandOptions.variants); + queryParams.putIfNotEmpty("genes", commandOptions.genes); + queryParams.putIfNotEmpty("source", commandOptions.source); + queryParams.putIfNotEmpty("regions", commandOptions.regions); + queryParams.putIfNotEmpty("categories", commandOptions.categories); + queryParams.putIfNotEmpty("tags", commandOptions.tags); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotEmpty("release", commandOptions.release); + queryParams.putIfNotNull("snapshot", commandOptions.snapshot); + queryParams.putIfNotEmpty("field", commandOptions.field); + if (queryParams.get("study") == null && OpencgaMain.isShellMode()) { + queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy()); + } + + return openCGAClient.getDiseasePanelClient().aggregationStats(queryParams); + } + private RestResponse create() throws Exception { logger.debug("Executing create in Disease Panels command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java index dc5a1878e4..833d3a38eb 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FamiliesCommandExecutor.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -66,6 +67,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "annotation-sets-load": queryResponse = loadAnnotationSets(); break; @@ -138,6 +142,38 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getFamilyClient().updateAcl(commandOptions.members, commandOptions.action, familyAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Families command line"); + + FamiliesCommandOptions.AggregationStatsCommandOptions commandOptions = familiesCommandOptions.aggregationStatsCommandOptions; + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("study", commandOptions.study); + queryParams.putIfNotEmpty("id", commandOptions.id); + queryParams.putIfNotEmpty("name", commandOptions.name); + queryParams.putIfNotEmpty("uuid", commandOptions.uuid); + queryParams.putIfNotEmpty("members", commandOptions.members); + queryParams.putIfNotNull("expectedSize", commandOptions.expectedSize); + queryParams.putIfNotEmpty("samples", commandOptions.samples); + queryParams.putIfNotEmpty("phenotypes", commandOptions.phenotypes); + queryParams.putIfNotEmpty("disorders", commandOptions.disorders); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("annotation", commandOptions.annotation); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotEmpty("release", commandOptions.release); + queryParams.putIfNotNull("snapshot", commandOptions.snapshot); + queryParams.putIfNotEmpty("field", commandOptions.field); + if (queryParams.get("study") == null && OpencgaMain.isShellMode()) { + queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy()); + } + + return openCGAClient.getFamilyClient().aggregationStats(queryParams); + } + private RestResponse loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Families command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java index 873a16baac..b46e090e21 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/FilesCommandExecutor.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.Map; import org.opencb.biodata.models.clinical.interpretation.Software; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -87,6 +88,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "annotation-sets-load": queryResponse = loadAnnotationSets(); break; @@ -208,6 +212,46 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getFileClient().updateAcl(commandOptions.members, commandOptions.action, fileAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Files command line"); + + FilesCommandOptions.AggregationStatsCommandOptions commandOptions = filesCommandOptions.aggregationStatsCommandOptions; + + 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("path", commandOptions.path); + queryParams.putIfNotEmpty("uri", commandOptions.uri); + queryParams.putIfNotEmpty("type", commandOptions.type); + queryParams.putIfNotEmpty("bioformat", commandOptions.bioformat); + queryParams.putIfNotEmpty("format", commandOptions.format); + queryParams.putIfNotNull("external", commandOptions.external); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("internalVariantIndexStatus", commandOptions.internalVariantIndexStatus); + queryParams.putIfNotEmpty("softwareName", commandOptions.softwareName); + queryParams.putIfNotEmpty("directory", commandOptions.directory); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotEmpty("description", commandOptions.description); + queryParams.putIfNotEmpty("tags", commandOptions.tags); + queryParams.putIfNotEmpty("size", commandOptions.size); + queryParams.putIfNotEmpty("sampleIds", commandOptions.sampleIds); + queryParams.putIfNotEmpty("jobId", commandOptions.jobId); + queryParams.putIfNotEmpty("annotation", commandOptions.annotation); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + 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.getFileClient().aggregationStats(queryParams); + } + private RestResponse loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Files command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java index dcf24216d8..f9eb26d282 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/IndividualsCommandExecutor.java @@ -9,6 +9,7 @@ import org.opencb.biodata.models.core.OntologyTermAnnotation; import org.opencb.biodata.models.core.SexOntologyTermAnnotation; import org.opencb.biodata.models.pedigree.IndividualProperty; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -72,6 +73,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "annotation-sets-load": queryResponse = loadAnnotationSets(); break; @@ -146,6 +150,46 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getIndividualClient().updateAcl(commandOptions.members, commandOptions.action, individualAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Individuals command line"); + + IndividualsCommandOptions.AggregationStatsCommandOptions commandOptions = individualsCommandOptions.aggregationStatsCommandOptions; + + 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("father", commandOptions.father); + queryParams.putIfNotEmpty("mother", commandOptions.mother); + queryParams.putIfNotEmpty("samples", commandOptions.samples); + queryParams.putIfNotEmpty("familyIds", commandOptions.familyIds); + queryParams.putIfNotEmpty("sex", commandOptions.sex); + queryParams.putIfNotEmpty("dateOfBirth", commandOptions.dateOfBirth); + queryParams.putIfNotEmpty("ethnicity", commandOptions.ethnicity); + queryParams.putIfNotEmpty("disorders", commandOptions.disorders); + queryParams.putIfNotEmpty("phenotypes", commandOptions.phenotypes); + queryParams.putIfNotEmpty("populationName", commandOptions.populationName); + queryParams.putIfNotEmpty("populationSubpopulation", commandOptions.populationSubpopulation); + queryParams.putIfNotEmpty("karyotypicSex", commandOptions.karyotypicSex); + queryParams.putIfNotEmpty("lifeStatus", commandOptions.lifeStatus); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotEmpty("annotation", commandOptions.annotation); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotEmpty("release", commandOptions.release); + queryParams.putIfNotNull("snapshot", commandOptions.snapshot); + queryParams.putIfNotEmpty("field", commandOptions.field); + if (queryParams.get("study") == null && OpencgaMain.isShellMode()) { + queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy()); + } + + return openCGAClient.getIndividualClient().aggregationStats(queryParams); + } + private RestResponse loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Individuals command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java index ffc4c7a61a..a5bf0d1b55 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/JobsCommandExecutor.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -70,6 +71,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "create": queryResponse = create(); break; @@ -147,6 +151,39 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getJobClient().updateAcl(commandOptions.members, commandOptions.action, jobAclUpdateParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Jobs command line"); + + JobsCommandOptions.AggregationStatsCommandOptions commandOptions = jobsCommandOptions.aggregationStatsCommandOptions; + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("study", commandOptions.study); + queryParams.putIfNotNull("otherStudies", commandOptions.otherStudies); + queryParams.putIfNotEmpty("id", commandOptions.id); + queryParams.putIfNotEmpty("uuid", commandOptions.uuid); + queryParams.putIfNotEmpty("toolId", commandOptions.toolId); + queryParams.putIfNotEmpty("toolType", commandOptions.toolType); + queryParams.putIfNotEmpty("userId", commandOptions.userId); + queryParams.putIfNotEmpty("priority", commandOptions.priority); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotNull("visited", commandOptions.visited); + queryParams.putIfNotEmpty("tags", commandOptions.tags); + queryParams.putIfNotEmpty("input", commandOptions.input); + queryParams.putIfNotEmpty("output", commandOptions.output); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotEmpty("release", commandOptions.release); + 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.getJobClient().aggregationStats(queryParams); + } + private RestResponse create() throws Exception { logger.debug("Executing create in Jobs command line"); diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java index c8e02456a4..75b1de8bd0 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/SamplesCommandExecutor.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import org.opencb.biodata.models.core.OntologyTermAnnotation; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.utils.PrintUtils; import org.opencb.opencga.app.cli.main.*; @@ -71,6 +72,9 @@ public void execute() throws Exception { case "acl-update": queryResponse = updateAcl(); break; + case "aggregationstats": + queryResponse = aggregationStats(); + break; case "annotation-sets-load": queryResponse = loadAnnotationSets(); break; @@ -147,6 +151,58 @@ private RestResponse updateAcl() throws Exception { return openCGAClient.getSampleClient().updateAcl(commandOptions.members, commandOptions.action, sampleAclUpdateParams, queryParams); } + private RestResponse aggregationStats() throws Exception { + logger.debug("Executing aggregationStats in Samples command line"); + + SamplesCommandOptions.AggregationStatsCommandOptions commandOptions = samplesCommandOptions.aggregationStatsCommandOptions; + + ObjectMap queryParams = new ObjectMap(); + queryParams.putIfNotEmpty("study", commandOptions.study); + queryParams.putIfNotEmpty("id", commandOptions.id); + queryParams.putIfNotEmpty("uuid", commandOptions.uuid); + queryParams.putIfNotNull("somatic", commandOptions.somatic); + queryParams.putIfNotEmpty("individualId", commandOptions.individualId); + queryParams.putIfNotEmpty("fileIds", commandOptions.fileIds); + queryParams.putIfNotEmpty("cohortIds", commandOptions.cohortIds); + queryParams.putIfNotEmpty("creationDate", commandOptions.creationDate); + queryParams.putIfNotEmpty("modificationDate", commandOptions.modificationDate); + queryParams.putIfNotEmpty("internalStatus", commandOptions.internalStatus); + queryParams.putIfNotEmpty("status", commandOptions.status); + queryParams.putIfNotEmpty("processingProduct", commandOptions.processingProduct); + queryParams.putIfNotEmpty("processingPreparationMethod", commandOptions.processingPreparationMethod); + queryParams.putIfNotEmpty("processingExtractionMethod", commandOptions.processingExtractionMethod); + queryParams.putIfNotEmpty("processingLabSampleId", commandOptions.processingLabSampleId); + queryParams.putIfNotEmpty("collectionFrom", commandOptions.collectionFrom); + queryParams.putIfNotEmpty("collectionType", commandOptions.collectionType); + queryParams.putIfNotEmpty("collectionMethod", commandOptions.collectionMethod); + queryParams.putIfNotEmpty("phenotypes", commandOptions.phenotypes); + queryParams.putIfNotEmpty("annotation", commandOptions.annotation); + queryParams.putIfNotEmpty("acl", commandOptions.acl); + queryParams.putIfNotNull("internalRgaStatus", commandOptions.internalRgaStatus); + queryParams.putIfNotEmpty("release", commandOptions.release); + queryParams.putIfNotNull("snapshot", commandOptions.snapshot); + queryParams.putIfNotNull("deleted", commandOptions.deleted); + queryParams.putIfNotEmpty("statsId", commandOptions.statsId); + queryParams.putIfNotEmpty("statsVariantCount", commandOptions.statsVariantCount); + queryParams.putIfNotEmpty("statsChromosomeCount", commandOptions.statsChromosomeCount); + queryParams.putIfNotEmpty("statsTypeCount", commandOptions.statsTypeCount); + queryParams.putIfNotEmpty("statsGenotypeCount", commandOptions.statsGenotypeCount); + queryParams.putIfNotEmpty("statsTiTvRatio", commandOptions.statsTiTvRatio); + queryParams.putIfNotEmpty("statsQualityAvg", commandOptions.statsQualityAvg); + queryParams.putIfNotEmpty("statsQualityStdDev", commandOptions.statsQualityStdDev); + queryParams.putIfNotEmpty("statsHeterozygosityRate", commandOptions.statsHeterozygosityRate); + queryParams.putIfNotEmpty("statsDepthCount", commandOptions.statsDepthCount); + queryParams.putIfNotEmpty("statsBiotypeCount", commandOptions.statsBiotypeCount); + queryParams.putIfNotEmpty("statsClinicalSignificanceCount", commandOptions.statsClinicalSignificanceCount); + queryParams.putIfNotEmpty("statsConsequenceTypeCount", commandOptions.statsConsequenceTypeCount); + queryParams.putIfNotEmpty("field", commandOptions.field); + if (queryParams.get("study") == null && OpencgaMain.isShellMode()) { + queryParams.putIfNotEmpty("study", sessionManager.getSession().getCurrentStudy()); + } + + return openCGAClient.getSampleClient().aggregationStats(queryParams); + } + private RestResponse loadAnnotationSets() throws Exception { logger.debug("Executing loadAnnotationSets in Samples command line"); 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 64a5edcbf8..b06b7df241 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 @@ -34,10 +34,12 @@ public class AnalysisClinicalCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public UpdateClinicalConfigurationCommandOptions updateClinicalConfigurationCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; + public AggregationStatsInterpretationCommandOptions aggregationStatsInterpretationCommandOptions; public DistinctInterpretationCommandOptions distinctInterpretationCommandOptions; public SearchInterpretationCommandOptions searchInterpretationCommandOptions; public InfoInterpretationCommandOptions infoInterpretationCommandOptions; @@ -75,10 +77,12 @@ public AnalysisClinicalCommandOptions(CommonCommandOptions commonCommandOptions, this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.updateClinicalConfigurationCommandOptions = new UpdateClinicalConfigurationCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); + this.aggregationStatsInterpretationCommandOptions = new AggregationStatsInterpretationCommandOptions(); this.distinctInterpretationCommandOptions = new DistinctInterpretationCommandOptions(); this.searchInterpretationCommandOptions = new SearchInterpretationCommandOptions(); this.infoInterpretationCommandOptions = new InfoInterpretationCommandOptions(); @@ -144,6 +148,101 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog clinical analysis aggregation stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list of Clinical Analysis IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list of Clinical Analysis UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--type"}, description = "Clinical Analysis type", required = false, arity = 1) + public String type; + + @Parameter(names = {"--disorder"}, description = "Clinical Analysis disorder. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String disorder; + + @Parameter(names = {"--files"}, description = "Clinical Analysis files", required = false, arity = 1) + public String files; + + @Parameter(names = {"--sample"}, description = "Sample associated to the proband or any member of a family", required = false, arity = 1) + public String sample; + + @Parameter(names = {"--individual"}, description = "Proband or any member of a family", required = false, arity = 1) + public String individual; + + @Parameter(names = {"--proband"}, description = "Clinical Analysis proband", required = false, arity = 1) + public String proband; + + @Parameter(names = {"--proband-samples"}, description = "Clinical Analysis proband samples", required = false, arity = 1) + public String probandSamples; + + @Parameter(names = {"--family"}, description = "Clinical Analysis family", required = false, arity = 1) + public String family; + + @Parameter(names = {"--family-members"}, description = "Clinical Analysis family members", required = false, arity = 1) + public String familyMembers; + + @Parameter(names = {"--family-member-samples"}, description = "Clinical Analysis family members samples", required = false, arity = 1) + public String familyMemberSamples; + + @Parameter(names = {"--panels"}, description = "Clinical Analysis panels", required = false, arity = 1) + public String panels; + + @Parameter(names = {"--locked"}, description = "Locked Clinical Analyses", required = false, arity = 1) + public Boolean locked; + + @Parameter(names = {"--analyst-id"}, description = "Clinical Analysis analyst id", required = false, arity = 1) + public String analystId; + + @Parameter(names = {"--priority"}, description = "Clinical Analysis priority", required = false, arity = 1) + public String priority; + + @Parameter(names = {"--flags"}, description = "Clinical Analysis flags", required = false, arity = 1) + public String flags; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Clinical Analysis Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Clinical Analysis Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--due-date"}, description = "Clinical Analysis due date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String dueDate; + + @Parameter(names = {"--quality-control-summary"}, description = "Clinical Analysis quality control summary", required = false, arity = 1) + public String qualityControlSummary; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1) + public Integer snapshot; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--annotation"}, description = "Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { @@ -446,6 +545,62 @@ public class DistinctCommandOptions { } + @Parameters(commandNames = {"interpretation-aggregation-stats"}, commandDescription ="Fetch catalog interpretation aggregation stats") + public class AggregationStatsInterpretationCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list of Interpretation IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list of Interpretation UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list of Interpretation names up to a maximum of 100", required = false, arity = 1) + public String name; + + @Parameter(names = {"--clinical-analysis-id"}, description = "Clinical Analysis id", required = false, arity = 1) + public String clinicalAnalysisId; + + @Parameter(names = {"--analyst-id"}, description = "Analyst ID", required = false, arity = 1) + public String analystId; + + @Parameter(names = {"--method-name"}, description = "Interpretation method name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String methodName; + + @Parameter(names = {"--panels"}, description = "Interpretation panels", required = false, arity = 1) + public String panels; + + @Parameter(names = {"--primary-findings"}, description = "Interpretation primary findings", required = false, arity = 1) + public String primaryFindings; + + @Parameter(names = {"--secondary-findings"}, description = "Interpretation secondary findings", required = false, arity = 1) + public String secondaryFindings; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Interpretation Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Interpretation Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"interpretation-distinct"}, commandDescription ="Interpretation distinct method") public class DistinctInterpretationCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/CohortsCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/CohortsCommandOptions.java index 632b7eaa1b..985bb5087f 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/CohortsCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/CohortsCommandOptions.java @@ -34,6 +34,7 @@ public class CohortsCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; @@ -51,6 +52,7 @@ public CohortsCommandOptions(CommonCommandOptions commonCommandOptions, JCommand this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); @@ -93,6 +95,62 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog cohort stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list of cohort IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list of cohort names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String name; + + @Parameter(names = {"--uuid"}, description = "Comma separated list of cohort IDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--type"}, description = "Cohort type", required = false, arity = 1) + public String type; + + @Parameter(names = {"--creation-date", "--cd"}, description = "creationDate", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "modificationDate", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--deleted"}, description = "deleted", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--status"}, description = "status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--internal-status"}, description = "internalStatus", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--annotation"}, description = "Cohort annotation", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--acl"}, description = "acl", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--samples"}, description = "Cohort sample IDs", required = false, arity = 1) + public String samples; + + @Parameter(names = {"--num-samples"}, description = "Number of samples", required = false, arity = 1) + public String numSamples; + + @Parameter(names = {"--release"}, description = "release", required = false, arity = 1) + public String release; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/DiseasePanelsCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/DiseasePanelsCommandOptions.java index d69121d7c2..eecdc1444e 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/DiseasePanelsCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/DiseasePanelsCommandOptions.java @@ -34,6 +34,7 @@ public class DiseasePanelsCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; public ImportCommandOptions importCommandOptions; @@ -49,6 +50,7 @@ public DiseasePanelsCommandOptions(CommonCommandOptions commonCommandOptions, JC this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); this.importCommandOptions = new ImportCommandOptions(); @@ -89,6 +91,74 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog panel stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list of panel IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list of panel UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list of panel names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String name; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--disorders"}, description = "Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String disorders; + + @Parameter(names = {"--variants"}, description = "Comma separated list of variant ids. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String variants; + + @Parameter(names = {"--genes"}, description = "Comma separated list of gene ids. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String genes; + + @Parameter(names = {"--source"}, description = "Comma separated list of source ids or names.", required = false, arity = 1) + public String source; + + @Parameter(names = {"--regions"}, description = "Comma separated list of regions. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String regions; + + @Parameter(names = {"--categories"}, description = "Comma separated list of category names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String categories; + + @Parameter(names = {"--tags"}, description = "Panel tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String tags; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1) + public Integer snapshot; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"create"}, commandDescription ="Create a panel") public class CreateCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FamiliesCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FamiliesCommandOptions.java index 0fc4c466ae..93fd2661ed 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FamiliesCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FamiliesCommandOptions.java @@ -34,6 +34,7 @@ public class FamiliesCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; @@ -50,6 +51,7 @@ public FamiliesCommandOptions(CommonCommandOptions commonCommandOptions, JComman this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); @@ -100,6 +102,71 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog family stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list family IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list family names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String name; + + @Parameter(names = {"--uuid"}, description = "Comma separated list family UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--members"}, description = "Comma separated list of family members", required = false, arity = 1) + public String members; + + @Parameter(names = {"--expected-size"}, description = "Expected size of the family (number of members)", required = false, arity = 1) + public Integer expectedSize; + + @Parameter(names = {"--samples"}, description = "Comma separated list of member's samples", required = false, arity = 1) + public String samples; + + @Parameter(names = {"--phenotypes"}, description = "Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String phenotypes; + + @Parameter(names = {"--disorders"}, description = "Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String disorders; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--annotation"}, description = "Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1) + public Integer snapshot; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FilesCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FilesCommandOptions.java index dfbd2cb0e5..5450718c34 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FilesCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/FilesCommandOptions.java @@ -34,6 +34,7 @@ public class FilesCommandOptions extends CustomFilesCommandOptions { public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public BioformatsCommandOptions bioformatsCommandOptions; public CreateCommandOptions createCommandOptions; @@ -66,6 +67,7 @@ public FilesCommandOptions(CommonCommandOptions commonCommandOptions, JCommander super(commonCommandOptions,jCommander); this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.bioformatsCommandOptions = new BioformatsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); @@ -127,6 +129,95 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog file stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list of file IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list file UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list of file names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String name; + + @Parameter(names = {"--path"}, description = "Comma separated list of paths. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String path; + + @Parameter(names = {"--uri", "--input", "-i"}, description = "Comma separated list of uris. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String uri; + + @Parameter(names = {"--type"}, description = "File type, either FILE or DIRECTORY", required = false, arity = 1) + public String type; + + @Parameter(names = {"--bioformat"}, description = "Comma separated Bioformat values. For existing Bioformats see files/bioformats", required = false, arity = 1) + public String bioformat; + + @Parameter(names = {"--format"}, description = "Comma separated Format values. For existing Formats see files/formats", required = false, arity = 1) + public String format; + + @Parameter(names = {"--external"}, description = "Boolean field indicating whether to filter by external or non external files", required = false, arity = 1) + public Boolean external; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--internal-variant-index-status"}, description = "Filter by internal variant index status", required = false, arity = 1) + public String internalVariantIndexStatus; + + @Parameter(names = {"--software-name"}, description = "Software name", required = false, arity = 1) + public String softwareName; + + @Parameter(names = {"--directory"}, description = "Directory under which we want to look for files or folders", required = false, arity = 1) + public String directory; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--description"}, description = "Description", required = false, arity = 1) + public String description; + + @Parameter(names = {"--tags"}, description = "Tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String tags; + + @Parameter(names = {"--size"}, description = "File size", required = false, arity = 1) + public String size; + + @Parameter(names = {"--sample-ids"}, description = "Comma separated list sample IDs or UUIDs up to a maximum of 100", required = false, arity = 1) + public String sampleIds; + + @Parameter(names = {"--job-id"}, description = "Job ID that created the file(s) or folder(s)", required = false, arity = 1) + public String jobId; + + @Parameter(names = {"--annotation"}, description = "Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/IndividualsCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/IndividualsCommandOptions.java index 139e2d4ab6..345f20c2ef 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/IndividualsCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/IndividualsCommandOptions.java @@ -34,6 +34,7 @@ public class IndividualsCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; @@ -51,6 +52,7 @@ public IndividualsCommandOptions(CommonCommandOptions commonCommandOptions, JCom this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); @@ -99,6 +101,95 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog individual stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list individual IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list individual UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--name", "-n"}, description = "Comma separated list individual names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String name; + + @Parameter(names = {"--father"}, description = "Father ID, name or UUID", required = false, arity = 1) + public String father; + + @Parameter(names = {"--mother"}, description = "Mother ID, name or UUID", required = false, arity = 1) + public String mother; + + @Parameter(names = {"--samples"}, description = "Sample ID, name or UUID", required = false, arity = 1) + public String samples; + + @Parameter(names = {"--family-ids"}, description = "Comma separated list of family ids the individuals may belong to.", required = false, arity = 1) + public String familyIds; + + @Parameter(names = {"--sex"}, description = "Individual sex", required = false, arity = 1) + public String sex; + + @Parameter(names = {"--date-of-birth"}, description = "Individual date of birth", required = false, arity = 1) + public String dateOfBirth; + + @Parameter(names = {"--ethnicity"}, description = "Individual ethnicity. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String ethnicity; + + @Parameter(names = {"--disorders"}, description = "Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String disorders; + + @Parameter(names = {"--phenotypes"}, description = "Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String phenotypes; + + @Parameter(names = {"--population-name"}, description = "Population name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String populationName; + + @Parameter(names = {"--population-subpopulation"}, description = "Subpopulation name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String populationSubpopulation; + + @Parameter(names = {"--karyotypic-sex"}, description = "Individual karyotypic sex", required = false, arity = 1) + public String karyotypicSex; + + @Parameter(names = {"--life-status"}, description = "Individual life status", required = false, arity = 1) + public String lifeStatus; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--annotation"}, description = "Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1) + public Integer snapshot; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/JobsCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/JobsCommandOptions.java index 327d9487df..eb1a5e57ee 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/JobsCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/JobsCommandOptions.java @@ -34,6 +34,7 @@ public class JobsCommandOptions extends CustomJobsCommandOptions { public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; public RetryCommandOptions retryCommandOptions; @@ -52,6 +53,7 @@ public JobsCommandOptions(CommonCommandOptions commonCommandOptions, JCommander super(commonCommandOptions,jCommander); this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); this.retryCommandOptions = new RetryCommandOptions(); @@ -93,6 +95,74 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog job stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--other-studies"}, description = "Flag indicating the entries being queried can belong to any related study, not just the primary one.", required = false, help = true, arity = 0) + public boolean otherStudies = false; + + @Parameter(names = {"--id"}, description = "Comma separated list of job IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list of job UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--tool-id"}, description = "Tool ID executed by the job. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String toolId; + + @Parameter(names = {"--tool-type"}, description = "Tool type executed by the job [OPERATION, ANALYSIS]", required = false, arity = 1) + public String toolType; + + @Parameter(names = {"--user-id"}, description = "User that created the job", required = false, arity = 1) + public String userId; + + @Parameter(names = {"--priority"}, description = "Priority of the job", required = false, arity = 1) + public String priority; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--visited"}, description = "Visited status of job", required = false, arity = 1) + public Boolean visited; + + @Parameter(names = {"--tags"}, description = "Job tags", required = false, arity = 1) + public String tags; + + @Parameter(names = {"--input"}, description = "Comma separated list of file IDs used as input.", required = false, arity = 1) + public String input; + + @Parameter(names = {"--output"}, description = "Comma separated list of file IDs used as output.", required = false, arity = 1) + public String output; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"create"}, commandDescription ="Register an executed job with POST method") public class CreateCommandOptions { diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/SamplesCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/SamplesCommandOptions.java index 885e3cabd5..ef16e0c8a0 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/SamplesCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/SamplesCommandOptions.java @@ -34,6 +34,7 @@ public class SamplesCommandOptions { public CommonCommandOptions commonCommandOptions; public UpdateAclCommandOptions updateAclCommandOptions; + public AggregationStatsCommandOptions aggregationStatsCommandOptions; public LoadAnnotationSetsCommandOptions loadAnnotationSetsCommandOptions; public CreateCommandOptions createCommandOptions; public DistinctCommandOptions distinctCommandOptions; @@ -51,6 +52,7 @@ public SamplesCommandOptions(CommonCommandOptions commonCommandOptions, JCommand this.jCommander = jCommander; this.commonCommandOptions = commonCommandOptions; this.updateAclCommandOptions = new UpdateAclCommandOptions(); + this.aggregationStatsCommandOptions = new AggregationStatsCommandOptions(); this.loadAnnotationSetsCommandOptions = new LoadAnnotationSetsCommandOptions(); this.createCommandOptions = new CreateCommandOptions(); this.distinctCommandOptions = new DistinctCommandOptions(); @@ -105,6 +107,131 @@ public class UpdateAclCommandOptions { } + @Parameters(commandNames = {"aggregationstats"}, commandDescription ="Fetch catalog sample stats") + public class AggregationStatsCommandOptions { + + @ParametersDelegate + public CommonCommandOptions commonOptions = commonCommandOptions; + + @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 = {"--id"}, description = "Comma separated list sample IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String id; + + @Parameter(names = {"--uuid"}, description = "Comma separated list sample UUIDs up to a maximum of 100", required = false, arity = 1) + public String uuid; + + @Parameter(names = {"--somatic"}, description = "Somatic sample", required = false, arity = 1) + public Boolean somatic; + + @Parameter(names = {"--individual-id"}, description = "Individual ID or UUID", required = false, arity = 1) + public String individualId; + + @Parameter(names = {"--file-ids"}, description = "Comma separated list of file IDs, paths or UUIDs", required = false, arity = 1) + public String fileIds; + + @Parameter(names = {"--cohort-ids"}, description = "Comma separated list of cohort IDs", required = false, arity = 1) + public String cohortIds; + + @Parameter(names = {"--creation-date", "--cd"}, description = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String creationDate; + + @Parameter(names = {"--modification-date", "--md"}, description = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805", required = false, arity = 1) + public String modificationDate; + + @Parameter(names = {"--internal-status"}, description = "Filter by internal status", required = false, arity = 1) + public String internalStatus; + + @Parameter(names = {"--status"}, description = "Filter by status", required = false, arity = 1) + public String status; + + @Parameter(names = {"--processing-product"}, description = "Processing product", required = false, arity = 1) + public String processingProduct; + + @Parameter(names = {"--processing-preparation-method"}, description = "Processing preparation method", required = false, arity = 1) + public String processingPreparationMethod; + + @Parameter(names = {"--processing-extraction-method"}, description = "Processing extraction method", required = false, arity = 1) + public String processingExtractionMethod; + + @Parameter(names = {"--processing-lab-sample-id"}, description = "Processing lab sample id", required = false, arity = 1) + public String processingLabSampleId; + + @Parameter(names = {"--collection-from"}, description = "Collection from", required = false, arity = 1) + public String collectionFrom; + + @Parameter(names = {"--collection-type"}, description = "Collection type", required = false, arity = 1) + public String collectionType; + + @Parameter(names = {"--collection-method"}, description = "Collection method", required = false, arity = 1) + public String collectionMethod; + + @Parameter(names = {"--phenotypes"}, description = "Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.", required = false, arity = 1) + public String phenotypes; + + @Parameter(names = {"--annotation"}, description = "Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0", required = false, arity = 1) + public String annotation; + + @Parameter(names = {"--acl"}, description = "Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. ", required = false, arity = 1) + public String acl; + + @Parameter(names = {"--internal-rga-status"}, description = "Index status of the sample for the Recessive Gene Analysis", required = false, arity = 1) + public String internalRgaStatus; + + @Parameter(names = {"--release"}, description = "Release when it was created", required = false, arity = 1) + public String release; + + @Parameter(names = {"--snapshot"}, description = "Snapshot value (Latest version of the entry in the specified release)", required = false, arity = 1) + public Integer snapshot; + + @Parameter(names = {"--deleted"}, description = "Boolean to retrieve deleted entries", required = false, help = true, arity = 0) + public boolean deleted = false; + + @Parameter(names = {"--stats-id"}, description = "Sample variant stats Id. If this field is not provided and the user filters by other stats fields, it will automatically be set to ALL", required = false, arity = 1) + public String statsId; + + @Parameter(names = {"--stats-variant-count"}, description = "Sample variant stats VariantCount", required = false, arity = 1) + public String statsVariantCount; + + @Parameter(names = {"--stats-chromosome-count"}, description = "Sample variant stats ChromosomeCount", required = false, arity = 1) + public String statsChromosomeCount; + + @Parameter(names = {"--stats-type-count"}, description = "Sample variant stats TypeCount", required = false, arity = 1) + public String statsTypeCount; + + @Parameter(names = {"--stats-genotype-count"}, description = "Sample variant stats GenotypeCount", required = false, arity = 1) + public String statsGenotypeCount; + + @Parameter(names = {"--stats-ti-tv-ratio"}, description = "Sample variant stats TiTvRatio", required = false, arity = 1) + public String statsTiTvRatio; + + @Parameter(names = {"--stats-quality-avg"}, description = "Sample variant stats QualityAvg", required = false, arity = 1) + public String statsQualityAvg; + + @Parameter(names = {"--stats-quality-std-dev"}, description = "Sample variant stats QualityStdDev", required = false, arity = 1) + public String statsQualityStdDev; + + @Parameter(names = {"--stats-heterozygosity-rate"}, description = "Sample variant stats HeterozygosityRate", required = false, arity = 1) + public String statsHeterozygosityRate; + + @Parameter(names = {"--stats-depth-count"}, description = "Sample variant stats DepthCount", required = false, arity = 1) + public String statsDepthCount; + + @Parameter(names = {"--stats-biotype-count"}, description = "Sample variant stats BiotypeCount", required = false, arity = 1) + public String statsBiotypeCount; + + @Parameter(names = {"--stats-clinical-significance-count"}, description = "Sample variant stats ClinicalSignificanceCount", required = false, arity = 1) + public String statsClinicalSignificanceCount; + + @Parameter(names = {"--stats-consequence-type-count"}, description = "Sample variant stats ConsequenceTypeCount", required = false, arity = 1) + public String statsConsequenceTypeCount; + + @Parameter(names = {"--field"}, description = "Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size)", required = false, arity = 1) + public String field; + + } + @Parameters(commandNames = {"annotation-sets-load"}, commandDescription ="Load annotation sets from a TSV file") public class LoadAnnotationSetsCommandOptions { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/CoreDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/CoreDBAdaptor.java index ba3db9c7bb..7845ace2e0 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/CoreDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/api/CoreDBAdaptor.java @@ -1,5 +1,6 @@ package org.opencb.opencga.catalog.db.api; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.Query; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.catalog.exceptions.CatalogAuthorizationException; @@ -38,4 +39,7 @@ OpenCGAResult distinct(long studyUid, String field, Query query, String userI OpenCGAResult distinct(long studyUid, List fields, Query query, String userId) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException; + + OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException; } 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 7a359e5a7e..405b03bf1b 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 @@ -1002,6 +1002,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(clinicalCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/CohortMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/CohortMongoDBAdaptor.java index 6b948a722b..6e76a0b888 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/CohortMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/CohortMongoDBAdaptor.java @@ -839,6 +839,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(cohortCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FamilyMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FamilyMongoDBAdaptor.java index 97bfd92a67..980bf51a99 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FamilyMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FamilyMongoDBAdaptor.java @@ -1072,6 +1072,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(familyCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FileMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FileMongoDBAdaptor.java index 896e20764a..dd17850b24 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FileMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/FileMongoDBAdaptor.java @@ -1694,6 +1694,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(fileCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/IndividualMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/IndividualMongoDBAdaptor.java index 03a6704af1..9de6aca6d8 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/IndividualMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/IndividualMongoDBAdaptor.java @@ -1373,6 +1373,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(individualCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/InterpretationMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/InterpretationMongoDBAdaptor.java index 0c833de52e..1d50cb4e50 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/InterpretationMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/InterpretationMongoDBAdaptor.java @@ -1054,6 +1054,12 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + return null; + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException { Objects.requireNonNull(action); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/JobMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/JobMongoDBAdaptor.java index b0b9aea3e4..ad51ec236b 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/JobMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/JobMongoDBAdaptor.java @@ -765,6 +765,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, QueryOptions.empty(), userId); + return facet(jobCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/MongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/MongoDBAdaptor.java index 32c10c362f..cc2aec1531 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/MongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/MongoDBAdaptor.java @@ -19,11 +19,13 @@ import com.mongodb.MongoException; import com.mongodb.client.ClientSession; import com.mongodb.client.model.*; +import org.apache.commons.lang3.StringUtils; import org.bson.Document; import org.bson.conversions.Bson; import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.mongodb.GenericDocumentComplexConverter; import org.opencb.commons.datastore.mongodb.MongoDBCollection; +import org.opencb.commons.datastore.mongodb.MongoDBDocumentToFacetFieldsConverter; import org.opencb.commons.datastore.mongodb.MongoDBQueryUtils; import org.opencb.opencga.catalog.db.AbstractDBAdaptor; import org.opencb.opencga.catalog.db.api.StudyDBAdaptor; @@ -42,6 +44,8 @@ import java.util.function.Consumer; import java.util.function.Function; +import static org.opencb.commons.datastore.core.QueryOptions.COUNT; +import static org.opencb.opencga.catalog.db.mongodb.MongoDBUtils.TO_REPLACE_DOTS; import static org.opencb.opencga.catalog.db.mongodb.MongoDBUtils.getMongoDBDocument; /** @@ -323,6 +327,30 @@ protected OpenCGAResult rank(MongoDBCollection collection, Bson query, List facet(MongoDBCollection collection, Bson query, String facet) throws CatalogDBException { + if (StringUtils.isEmpty(facet)) { + throw new CatalogDBException("The aggregation stats field is empty."); + } + MongoDBDocumentToFacetFieldsConverter converter = new MongoDBDocumentToFacetFieldsConverter(); + List facets = MongoDBQueryUtils.createFacet(query, facet); + logger.info("facet; input = {}", facets); + DataResult> aggregate = collection.aggregate(facets, converter, null); + logger.info("facet; output = {}", aggregate.getResults()); + + // Replace "." by . + List facetFields = aggregate.getResults().get(0); + for (FacetField facetField : facetFields) { + if (StringUtils.isNotEmpty(facetField.getName())) { + facetField.setName(facetField.getName().replace(TO_REPLACE_DOTS, ".")); + } + } + DataResult result = new DataResult<>(aggregate.getTime(), aggregate.getEvents(), facetFields.size(), facetFields, + facetFields.size()); + logger.info("facet; result = {}", result.getResults()); + + return new OpenCGAResult<>(result); + } + protected OpenCGAResult groupBy(MongoDBCollection collection, Bson query, String groupByField, String idField, QueryOptions options) { if (groupByField == null || groupByField.isEmpty()) { return new OpenCGAResult(); @@ -364,8 +392,8 @@ protected OpenCGAResult groupBy(MongoDBCollection collection, Bson query, List distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(panelCollection, bson, facet); + } + @Override public void forEach(Query query, Consumer action, QueryOptions options) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/SampleMongoDBAdaptor.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/SampleMongoDBAdaptor.java index ff0189056d..e79d3ce21d 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/SampleMongoDBAdaptor.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/db/mongodb/SampleMongoDBAdaptor.java @@ -1204,6 +1204,13 @@ public OpenCGAResult distinct(long studyUid, List fields, Query query new ArrayList<>(results), -1); } + @Override + public OpenCGAResult facet(long studyUid, Query query, String facet, String userId) + throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { + Bson bson = parseQuery(query, userId); + return facet(sampleCollection, bson, facet); + } + private MongoDBIterator getMongoCursor(ClientSession clientSession, Query query, QueryOptions options, String user) throws CatalogDBException, CatalogParameterException, CatalogAuthorizationException { Query finalQuery = new Query(query); 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 20b228aeed..ddd801c934 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 @@ -25,10 +25,7 @@ import org.opencb.biodata.models.clinical.ClinicalAudit; import org.opencb.biodata.models.clinical.ClinicalComment; import org.opencb.biodata.models.clinical.Disorder; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.FileUtils; import org.opencb.commons.utils.ListUtils; @@ -234,6 +231,23 @@ public DBIterator iterator(String studyStr, Query query, Query return getClinicalAnalysisDBAdaptor(organizationId).iterator(study.getUid(), query, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(organizationId, study, query, userId, token); + query.append(ClinicalAnalysisDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getClinicalAnalysisDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult create(String studyStr, ClinicalAnalysis clinicalAnalysis, QueryOptions options, String token) throws CatalogException { diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/CohortManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/CohortManager.java index b7971c7610..df373bfbe6 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/CohortManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/CohortManager.java @@ -22,10 +22,7 @@ import org.apache.commons.lang3.time.StopWatch; import org.opencb.biodata.models.common.Status; import org.opencb.biodata.models.variant.StudyEntry; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; @@ -472,6 +469,24 @@ public DBIterator iterator(String studyStr, Query query, QueryOptions op return getCohortDBAdaptor(organizationId).iterator(study.getUid(), finalQuery, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + Query finalQuery = new Query(query); + fixQueryObject(organizationId, study, finalQuery, userId); + finalQuery.append(CohortDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getCohortDBAdaptor(organizationId).facet(study.getUid(), finalQuery, facet, userId); + } + @Override public OpenCGAResult search(String studyId, Query query, QueryOptions options, String token) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FamilyManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FamilyManager.java index 0cfa9018ef..dca60a47e2 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FamilyManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FamilyManager.java @@ -30,10 +30,7 @@ import org.opencb.biodata.models.core.SexOntologyTermAnnotation; import org.opencb.biodata.models.pedigree.IndividualProperty; import org.opencb.biodata.tools.pedigree.ModeOfInheritance; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; @@ -223,6 +220,24 @@ public DBIterator iterator(String studyStr, Query query, QueryOptions op return getFamilyDBAdaptor(organizationId).iterator(study.getUid(), finalQuery, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + Query finalQuery = new Query(query); + fixQueryObject(organizationId, study, query, tokenPayload); + query.append(FamilyDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getFamilyDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult create(String studyStr, Family family, QueryOptions options, String token) throws CatalogException { return create(studyStr, family, null, options, token); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FileManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FileManager.java index fcbb16c4e9..e215450c60 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FileManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/FileManager.java @@ -24,10 +24,7 @@ import org.opencb.biodata.models.common.Status; import org.opencb.biodata.models.variant.VariantFileMetadata; import org.opencb.biodata.models.variant.metadata.VariantSetStats; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.FileUtils; import org.opencb.commons.utils.ListUtils; @@ -1423,6 +1420,23 @@ public DBIterator iterator(String studyStr, Query query, QueryOptions opti return getFileDBAdaptor(organizationId).iterator(study.getUid(), query, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(study, query, userId); + query.append(FileDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getFileDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult search(String studyId, Query query, QueryOptions options, String token) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/IndividualManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/IndividualManager.java index cfe73a2788..1aeaac35e2 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/IndividualManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/IndividualManager.java @@ -23,10 +23,7 @@ import org.opencb.biodata.models.core.OntologyTermAnnotation; import org.opencb.biodata.models.core.SexOntologyTermAnnotation; import org.opencb.biodata.models.pedigree.IndividualProperty; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; @@ -405,6 +402,24 @@ public DBIterator iterator(String studyStr, Query query, QueryOption return getIndividualDBAdaptor(organizationId).iterator(study.getUid(), finalQuery, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + Query finalQuery = new Query(query); + fixQuery(organizationId, study, finalQuery, userId); + finalQuery.append(IndividualDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getIndividualDBAdaptor(organizationId).facet(study.getUid(), finalQuery, facet, userId); + } + @Override public OpenCGAResult search(String studyId, Query query, QueryOptions options, String token) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/InterpretationManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/InterpretationManager.java index 417978cef1..35b09e6677 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/InterpretationManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/InterpretationManager.java @@ -27,10 +27,7 @@ import org.opencb.biodata.models.clinical.interpretation.DiseasePanel; import org.opencb.biodata.models.clinical.interpretation.InterpretationMethod; import org.opencb.biodata.models.clinical.interpretation.InterpretationStats; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; import org.opencb.opencga.catalog.db.DBAdaptorFactory; @@ -1268,6 +1265,23 @@ public DBIterator iterator(String studyStr, Query query, QueryOp return null; } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(organizationId, study, query, userId); + query.append(InterpretationDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getInterpretationDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult search(String studyId, Query query, QueryOptions options, String token) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/JobManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/JobManager.java index dad603843e..f0c28612ee 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/JobManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/JobManager.java @@ -21,10 +21,7 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.StopWatch; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; @@ -923,6 +920,23 @@ public DBIterator iterator(String studyId, Query query, QueryOptions option return getJobDBAdaptor(organizationId).iterator(study.getUid(), query, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(organizationId, study, query, userId); + query.append(JobDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getJobDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + public OpenCGAResult countInOrganization(String organizationId, Query query, String token) throws CatalogException { JwtPayload jwtPayload = userManager.validateToken(token); authorizationManager.checkIsOpencgaAdministrator(jwtPayload); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/PanelManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/PanelManager.java index fddf86b32c..19e9f785fa 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/PanelManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/PanelManager.java @@ -20,18 +20,12 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.opencb.biodata.models.common.Status; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; import org.opencb.opencga.catalog.db.DBAdaptorFactory; -import org.opencb.opencga.catalog.db.api.DBIterator; -import org.opencb.opencga.catalog.db.api.FamilyDBAdaptor; -import org.opencb.opencga.catalog.db.api.PanelDBAdaptor; -import org.opencb.opencga.catalog.db.api.StudyDBAdaptor; +import org.opencb.opencga.catalog.db.api.*; import org.opencb.opencga.catalog.exceptions.CatalogAuthorizationException; import org.opencb.opencga.catalog.exceptions.CatalogException; import org.opencb.opencga.catalog.exceptions.CatalogParameterException; @@ -597,6 +591,23 @@ public DBIterator iterator(String studyStr, Query query, QueryOptions opt return getPanelDBAdaptor(organizationId).iterator(study.getUid(), query, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(query); + query.append(PanelDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getPanelDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult search(String studyId, Query query, QueryOptions options, String token) throws CatalogException { query = ParamUtils.defaultObject(query, Query::new); diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ResourceManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ResourceManager.java index 8c271faaf7..4eb2bc2fd8 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ResourceManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ResourceManager.java @@ -17,10 +17,7 @@ package org.opencb.opencga.catalog.managers; import org.apache.commons.lang3.StringUtils; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; import org.opencb.opencga.catalog.db.DBAdaptorFactory; @@ -209,6 +206,8 @@ public OpenCGAResult get(String studyId, List entryList, Query query, public abstract DBIterator iterator(String studyStr, Query query, QueryOptions options, String token) throws CatalogException; + public abstract OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException; + /** * Search of entries in catalog. * diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/SampleManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/SampleManager.java index bc216fc708..b2d60e43c9 100644 --- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/SampleManager.java +++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/SampleManager.java @@ -23,10 +23,7 @@ import org.opencb.biodata.models.common.Status; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.metadata.SampleVariantStats; -import org.opencb.commons.datastore.core.Event; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.commons.datastore.core.result.Error; import org.opencb.commons.utils.ListUtils; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; @@ -284,6 +281,23 @@ public DBIterator iterator(String studyStr, Query query, QueryOptions op return getSampleDBAdaptor(organizationId).iterator(study.getUid(), finalQuery, options, userId); } + @Override + public OpenCGAResult facet(String studyStr, Query query, String facet, String token) throws CatalogException { + query = ParamUtils.defaultObject(query, Query::new); + + JwtPayload tokenPayload = catalogManager.getUserManager().validateToken(token); + CatalogFqn studyFqn = CatalogFqn.extractFqnFromStudy(studyStr, tokenPayload); + String organizationId = studyFqn.getOrganizationId(); + String userId = tokenPayload.getUserId(organizationId); + + Study study = catalogManager.getStudyManager().resolveId(studyFqn, StudyManager.INCLUDE_VARIABLE_SET, tokenPayload); + + fixQueryObject(organizationId, study, query, userId); + query.append(SampleDBAdaptor.QueryParams.STUDY_UID.key(), study.getUid()); + + return getSampleDBAdaptor(organizationId).facet(study.getUid(), query, facet, userId); + } + @Override public OpenCGAResult search(String studyStr, Query query, QueryOptions options, String token) throws CatalogException { diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/CatalogManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/CatalogManagerTest.java index 4145af76dd..f301cc06de 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/CatalogManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/CatalogManagerTest.java @@ -20,15 +20,13 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.StopWatch; +import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; import org.mockito.Mockito; import org.opencb.biodata.models.common.Status; import org.opencb.biodata.models.pedigree.IndividualProperty; -import org.opencb.commons.datastore.core.DataResult; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.opencga.TestParamConstants; import org.opencb.opencga.catalog.auth.authorization.AuthorizationManager; import org.opencb.opencga.catalog.db.api.*; @@ -972,6 +970,48 @@ public void visitJob() throws CatalogException { } @Test + public void testJobsFacet() throws CatalogException { + Query query = new Query(); + String studyId = catalogManager.getStudyManager().searchInOrganization(organizationId, query, null, ownerToken).first().getId(); + +// catalogManager.getJobManager().create(studyId, new Job().setId("myErrorJob"), null, ownerToken); +// +// QueryOptions options = new QueryOptions(QueryOptions.COUNT, true); +// DataResult allJobs = catalogManager.getJobManager().search(studyId, null, options, ownerToken); + + int numJobs = 88; + for (int i = numJobs; i > 0; i--) { + ToolInfo toolInfo = new ToolInfo(); + toolInfo.setId("tool-" + (i % 5) + Integer.valueOf(RandomStringUtils.randomNumeric(1))); + Job job = new Job().setId("myJob-" + i).setTool(toolInfo); + catalogManager.getJobManager().create(studyId, job, null, ownerToken); + } + + Map toolIdCounter = new HashMap<>(); + QueryOptions options = new QueryOptions(QueryOptions.COUNT, true); + DataResult allJobs = catalogManager.getJobManager().search(studyId, null, options, ownerToken); + for (Job job : allJobs.getResults()) { + String toolId = job.getTool().getId(); + if (!toolIdCounter.containsKey(toolId)) { + toolIdCounter.put(toolId, 0); + } + toolIdCounter.put(toolId, 1 + toolIdCounter.get(toolId)); + } + + for (Map.Entry entry : toolIdCounter.entrySet()) { + System.out.println(entry.getKey() + " --> " + entry.getValue()); + } + + String field = "tool.id"; + FacetField facetField = catalogManager.getJobManager().facet(studyId, new Query(), field, ownerToken).first(); + Assert.assertEquals(field, facetField.getName()); + Assert.assertEquals(numJobs, facetField.getCount(), 0.001); + for (FacetField.Bucket bucket : facetField.getBuckets()) { + Assert.assertTrue(toolIdCounter.containsKey(bucket.getValue())); + Assert.assertEquals(toolIdCounter.get(bucket.getValue()), bucket.getCount(), 0.001); + } + } + public void testJobQuotaLimit() throws CatalogException { // Submit a dummy job. This shouldn't raise any error catalogManager.getJobManager().submit(studyId, "command-subcommand", null, Collections.emptyMap(), ownerToken); diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FamilyManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FamilyManagerTest.java index c7b57488fa..26609f5a1f 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FamilyManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FamilyManagerTest.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -26,6 +27,7 @@ import org.opencb.biodata.models.clinical.Phenotype; import org.opencb.biodata.models.core.SexOntologyTermAnnotation; import org.opencb.commons.datastore.core.DataResult; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.Query; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.TestParamConstants; @@ -58,6 +60,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.*; +import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.max; /** * Created by pfurio on 11/05/17. @@ -249,7 +252,7 @@ public void updateFamilyReferencesInIndividualTest() throws CatalogException { createDummyFamily("Other-Family-Name", false); individualList = catalogManager.getIndividualManager().get(studyFqn, Arrays.asList("john", "father", "mother", "child1", "child2", - "child3"), QueryOptions.empty(), ownerToken).getResults(); + "child3"), QueryOptions.empty(), ownerToken).getResults(); for (Individual individual : individualList) { switch (individual.getId()) { case "john": @@ -1434,4 +1437,27 @@ public void updateFamilyMembers() throws CatalogException { )); catalogManager.getFamilyManager().update(studyFqn, family.getId(), updateParams, QueryOptions.empty(), ownerToken); } + + @Test + public void testFacet() throws CatalogException { + createDummyFamily("Other-Family-Name-1", true); + + OpenCGAResult results = catalogManager.getFamilyManager().search(studyFqn, new Query(), QueryOptions.empty(), ownerToken); + System.out.println("results.getResults() = " + results.getResults()); + OpenCGAResult facets = catalogManager.getFamilyManager().facet(studyFqn, new Query(), "max(version)", normalToken1); + + long maxValue = 0; + for (Family result : results.getResults()) { + if (result.getVersion() > maxValue) { + maxValue = result.getVersion(); + } + } + + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(max.name(), result.getAggregationName()); + Assert.assertEquals(1, result.getAggregationValues().size()); + Assert.assertEquals(maxValue, result.getAggregationValues().get(0), 0.0001); + } + } } diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FileManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FileManagerTest.java index 81c28e9daa..6b24a5e643 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FileManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/FileManagerTest.java @@ -19,14 +19,12 @@ import com.fasterxml.jackson.core.JsonProcessingException; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.opencb.biodata.models.clinical.interpretation.Software; -import org.opencb.commons.datastore.core.DataResult; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.opencga.TestParamConstants; import org.opencb.opencga.catalog.db.api.FileDBAdaptor; import org.opencb.opencga.catalog.db.api.SampleDBAdaptor; @@ -75,6 +73,7 @@ import static org.hamcrest.CoreMatchers.hasItem; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.*; +import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.SEPARATOR; /** * Created by pfurio on 24/08/16. @@ -84,6 +83,22 @@ public class FileManagerTest extends AbstractManagerTest { private FileManager fileManager; + private static final Map MONTH_MAP = new HashMap<>(); + + static { + MONTH_MAP.put("01", "Jan"); + MONTH_MAP.put("02", "Feb"); + MONTH_MAP.put("03", "Mar"); + MONTH_MAP.put("04", "Apr"); + MONTH_MAP.put("05", "May"); + MONTH_MAP.put("06", "Jun"); + MONTH_MAP.put("07", "Jul"); + MONTH_MAP.put("08", "Aug"); + MONTH_MAP.put("09", "Sep"); + MONTH_MAP.put("10", "Oct"); + MONTH_MAP.put("11", "Nov"); + MONTH_MAP.put("12", "Dec"); + } @Before public void setUp() throws Exception { super.setUp(); @@ -468,7 +483,7 @@ public void associateAlignmentFilesTest() throws CatalogException { fileManager.unlink(studyFqn, baiFile.getPath(), ownerToken); bamFile = fileManager.get(studyFqn, bamFile.getPath(), QueryOptions.empty(), ownerToken).first(); assertNotNull(bamFile.getInternal().getAlignment().getIndex()); - assertNull(bamFile.getInternal().getAlignment().getIndex().getFileId()); + assertTrue(StringUtils.isEmpty(bamFile.getInternal().getAlignment().getIndex().getFileId())); assertEquals(FileStatus.DELETED, bamFile.getInternal().getAlignment().getIndex().getStatus().getId()); } @@ -2442,7 +2457,245 @@ public void testMoveAndRegister() throws URISyntaxException, CatalogException, I assertTrue(result.first().isExternal()); } -// @Test + @Test + public void testFacet() throws CatalogException { + OpenCGAResult results = fileManager.search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + System.out.println("results.getResults() = " + results.getResults()); + OpenCGAResult facets = fileManager.facet(studyFqn, new Query(), "format", normalToken1); + + long totalCount = 0; + Map formatMap = new HashMap<>(); + for (File result : results.getResults()) { + String key; + if (result.getFormat() == null) { + key = "null"; + } else { + key = result.getFormat().name(); + } + if (!formatMap.containsKey(key)) { + formatMap.put(key, 0); + } + formatMap.put(key, 1 + formatMap.get(key)); + totalCount++; + } + + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(totalCount, result.getCount()); + Assert.assertEquals(formatMap.size(), result.getBuckets().size()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertEquals(1L * formatMap.get(bucket.getValue()), bucket.getCount()); + } + } + } + + + @Test + public void testFacetDotNotation() throws CatalogException { + OpenCGAResult results = fileManager.search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + System.out.println("results.getResults() = " + results.getResults()); + String facetName = "internal.status.id"; + OpenCGAResult facets = fileManager.facet(studyFqn, new Query(), facetName, normalToken1); + + long totalCount = 0; + Map internalStatusIdMap = new HashMap<>(); + for (File result : results.getResults()) { + String key; + if (result.getInternal() == null || result.getInternal().getStatus() == null || result.getInternal().getStatus().getId() == null) { + key = "null"; + } else { + key = result.getInternal().getStatus().getId(); + } + if (!internalStatusIdMap.containsKey(key)) { + internalStatusIdMap.put(key, 0); + } + internalStatusIdMap.put(key, 1 + internalStatusIdMap.get(key)); + totalCount++; + } + + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(totalCount, result.getCount()); + Assert.assertEquals(internalStatusIdMap.size(), result.getBuckets().size()); + Assert.assertEquals(facetName, result.getName()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertEquals(1L * internalStatusIdMap.get(bucket.getValue()), bucket.getCount()); + } + } + } + + @Test + public void testMultipleFacets() throws CatalogException { + OpenCGAResult results = fileManager.search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + long totalCount = 0; + + Map formatMap = new HashMap<>(); + Map bioformatMap = new HashMap<>(); + for (File result : results.getResults()) { + String key; + if (result.getFormat() == null) { + key = "null"; + } else { + key = result.getFormat().name(); + } + if (!formatMap.containsKey(key)) { + formatMap.put(key, 0); + } + formatMap.put(key, 1 + formatMap.get(key)); + + if (result.getBioformat() == null) { + key = "null"; + } else { + key = result.getBioformat().name(); + } + if (!bioformatMap.containsKey(key)) { + bioformatMap.put(key, 0); + } + bioformatMap.put(key, 1 + bioformatMap.get(key)); + + totalCount++; + } + + OpenCGAResult facets = fileManager.facet(studyFqn, new Query(), "format;bioformat", normalToken1); + System.out.println("facets = " + facets); + + Assert.assertEquals(2, facets.getNumResults()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(totalCount, result.getCount()); + Map map = null; + if (result.getName().equals("format")) { + map = formatMap; + } else if (result.getName().equals("bioformat")) { + map = bioformatMap; + } else { + fail(); + } + Assert.assertEquals(map.size(), result.getBuckets().size()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertEquals(1L * map.get(bucket.getValue()), bucket.getCount()); + } + } + } + + @Test + public void testCombineFacets() throws CatalogException { + OpenCGAResult results = fileManager.search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + long totalCount = 0; + + Map map = new HashMap<>(); + for (File result : results.getResults()) { + String key = result.getFormat() + SEPARATOR + result.getBioformat(); + if (!map.containsKey(key)) { + map.put(key, 0); + } + map.put(key, 1 + map.get(key)); + + totalCount++; + } + + OpenCGAResult facets = fileManager.facet(studyFqn, new Query(), "format,bioformat", normalToken1); + System.out.println("facets = " + facets); + + Assert.assertEquals(1, facets.getNumResults()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(totalCount, result.getCount()); + Assert.assertEquals(map.size(), result.getBuckets().size()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertTrue(map.containsKey(bucket.getValue())); + Assert.assertEquals(1L * map.get(bucket.getValue()), bucket.getCount()); + } + } + } + + @Test + public void testCreationDate() throws CatalogException { + OpenCGAResult results = fileManager.search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + + Map yearCounter = new HashMap<>(); + Map monthCounter = new HashMap<>(); + Map dayCounter = new HashMap<>(); + + String yearKey = ""; + String monthKey = ""; + String dayKey = ""; + + for (File file : results.getResults()) { + String year = file.getCreationDate().substring(0, 4); + String month = file.getCreationDate().substring(4, 6); + String day = file.getCreationDate().substring(6, 8); + + yearKey = year; + if (!yearCounter.containsKey(yearKey)) { + yearCounter.put(yearKey, 0); + } + yearCounter.put(yearKey, 1 + yearCounter.get(yearKey)); + + monthKey = MONTH_MAP.get(month) + " " + yearKey; + if (!monthCounter.containsKey(monthKey)) { + monthCounter.put(monthKey, 0); + } + monthCounter.put(monthKey, 1 + monthCounter.get(monthKey)); + + dayKey = day + " " + monthKey; + if (!dayCounter.containsKey(dayKey)) { + dayCounter.put(dayKey, 0); + } + dayCounter.put(dayKey, 1 + dayCounter.get(dayKey)); + } + + OpenCGAResult facets = fileManager.facet(studyFqn, new Query(), "creationDate[YEAR]", normalToken1); + System.out.println("facets.first().toString() = " + facets.first().toString()); + System.out.println("yearCounter.toString() = " + yearCounter.toString()); + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals("creationDate", result.getName()); + Assert.assertEquals(yearCounter.values().stream() + .mapToInt(Integer::intValue) + .sum(), result.getCount()); + Assert.assertEquals(yearCounter.size(), result.getBuckets().size()); + Assert.assertEquals("year", result.getAggregationName()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertTrue(yearCounter.containsKey(bucket.getValue())); + Assert.assertEquals(1L * yearCounter.get(bucket.getValue()), bucket.getCount()); + } + } + + facets = fileManager.facet(studyFqn, new Query(), "creationDate[MONTH]", normalToken1); + System.out.println("facets.first().toString() = " + facets.first().toString()); + System.out.println("monthCounter.toString() = " + monthCounter.toString()); + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals("creationDate", result.getName()); + Assert.assertEquals(monthCounter.values().stream() + .mapToInt(Integer::intValue) + .sum(), result.getCount()); + Assert.assertEquals(monthCounter.size(), result.getBuckets().size()); + Assert.assertEquals("year" + SEPARATOR + "month", result.getAggregationName()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertTrue(monthCounter.containsKey(bucket.getValue())); + Assert.assertEquals(1L * monthCounter.get(bucket.getValue()), bucket.getCount()); + } + } + + facets = fileManager.facet(studyFqn, new Query(), "creationDate[DAY]", normalToken1); + System.out.println("facets.first().toString() = " + facets.first().toString()); + System.out.println("dayCounter.toString() = " + dayCounter.toString()); + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals("creationDate", result.getName()); + Assert.assertEquals(dayCounter.values().stream() + .mapToInt(Integer::intValue) + .sum(), result.getCount()); + Assert.assertEquals(dayCounter.size(), result.getBuckets().size()); + Assert.assertEquals("year" + SEPARATOR + "month" + SEPARATOR + "day", result.getAggregationName()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertTrue(dayCounter.containsKey(bucket.getValue())); + Assert.assertEquals(1L * dayCounter.get(bucket.getValue()), bucket.getCount()); + } + } + } + + // @Test // public void testIndex() throws Exception { // URI uri = getClass().getResource("/biofiles/variant-test-file.vcf.gz").toURI(); // File file = fileManager.link(studyFqn, uri, "", null, sessionIdUser).first(); diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/IndividualManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/IndividualManagerTest.java index 2b1de95a45..3f7e616fde 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/IndividualManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/IndividualManagerTest.java @@ -1,6 +1,7 @@ package org.opencb.opencga.catalog.managers; import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Assert; import org.junit.Test; import org.junit.experimental.categories.Category; import org.opencb.biodata.models.clinical.ClinicalComment; @@ -8,10 +9,7 @@ import org.opencb.biodata.models.clinical.Phenotype; import org.opencb.biodata.models.core.SexOntologyTermAnnotation; import org.opencb.biodata.models.pedigree.IndividualProperty; -import org.opencb.commons.datastore.core.DataResult; -import org.opencb.commons.datastore.core.ObjectMap; -import org.opencb.commons.datastore.core.Query; -import org.opencb.commons.datastore.core.QueryOptions; +import org.opencb.commons.datastore.core.*; import org.opencb.opencga.catalog.db.api.IndividualDBAdaptor; import org.opencb.opencga.catalog.db.api.SampleDBAdaptor; import org.opencb.opencga.catalog.exceptions.CatalogException; @@ -1141,4 +1139,61 @@ public void viewSampleFilesFromIndividualTest() throws CatalogException { assertTrue(Arrays.asList("variant-test-file.vcf.gz", "NA19600.chrom20.small.bam").containsAll(individual.getSamples().get(0).getFileIds())); } + @Test + public void testFacet() throws CatalogException { + OpenCGAResult results = catalogManager.getIndividualManager().search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + System.out.println("results.getResults() = " + results.getResults()); + OpenCGAResult facets = catalogManager.getIndividualManager().facet(studyFqn, new Query(), "karyotypicSex", normalToken1); + + long totalCount = 0; + Map map = new HashMap<>(); + for (Individual result : results.getResults()) { + String key; + if (result.getKaryotypicSex() == null) { + key = "null"; + } else { + key = result.getKaryotypicSex().name(); + } + if (!map.containsKey(key)) { + map.put(key, 0); + } + map.put(key, 1 + map.get(key)); + totalCount++; + } + + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(totalCount, result.getCount()); + Assert.assertEquals(map.size(), result.getBuckets().size()); + for (FacetField.Bucket bucket : result.getBuckets()) { + Assert.assertEquals(1L * map.get(bucket.getValue()), bucket.getCount()); + } + } + } + + @Test + public void testFacetMaxDotNotation() throws CatalogException { + OpenCGAResult results = catalogManager.getIndividualManager().search(studyFqn, new Query(), QueryOptions.empty(), normalToken1); + System.out.println("results.getResults() = " + results.getResults()); + String accumulator = "max"; + String facetName = "samples.version"; + OpenCGAResult facets = catalogManager.getIndividualManager().facet(studyFqn, new Query(), accumulator + "(" + facetName + ")", normalToken1); + + int maxVersion = 0; + for (Individual result : results.getResults()) { + for (Sample sample : result.getSamples()) { + if (sample.getVersion() > maxVersion) { + maxVersion = sample.getVersion(); + } + } + } + + Assert.assertEquals(1, facets.getResults().size()); + for (FacetField result : facets.getResults()) { + Assert.assertEquals(facetName, result.getName()); + Assert.assertEquals(accumulator, result.getAggregationName()); + Assert.assertEquals(1, result.getAggregationValues().size()); + Assert.assertEquals(maxVersion, result.getAggregationValues().get(0), 0.0001); + } + } } diff --git a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/SampleManagerTest.java b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/SampleManagerTest.java index af44b05cc1..b9f9ea1d64 100644 --- a/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/SampleManagerTest.java +++ b/opencga-catalog/src/test/java/org/opencb/opencga/catalog/managers/SampleManagerTest.java @@ -74,6 +74,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.*; +import static org.opencb.commons.datastore.core.QueryOptions.COUNT; import static org.opencb.opencga.catalog.db.api.SampleDBAdaptor.QueryParams.ANNOTATION; import static org.opencb.opencga.catalog.utils.ParamUtils.AclAction.ADD; import static org.opencb.opencga.catalog.utils.ParamUtils.AclAction.SET; @@ -2194,7 +2195,7 @@ public void testGetSampleAndIndividualWithPermissionsChecked() throws CatalogExc assertEquals(sampleId1, sample.getId()); sample = catalogManager.getSampleManager().search(studyFqn, new Query(SampleDBAdaptor.QueryParams.INDIVIDUAL_ID.key(), - "Individual1"), new QueryOptions(SAMPLE_INCLUDE_INDIVIDUAL_PARAM, true), normalToken2).first(); + "Individual1"), new QueryOptions(SAMPLE_INCLUDE_INDIVIDUAL_PARAM, true), normalToken2).first(); assertEquals(individualId, ((Individual) sample.getAttributes().get("OPENCGA_INDIVIDUAL")).getId()); assertEquals(sampleId1, sample.getId()); } @@ -2773,5 +2774,51 @@ public void deleteInUseInCATest() throws CatalogException { } } + @Test(expected = CatalogDBException.class) + public void testFacetEmptyParameter() throws Exception { + DataResult queryResult = catalogManager.getSampleManager().facet(studyFqn, new Query(), null, ownerToken); + } + + @Test + public void testFacet() throws Exception { + OpenCGAResult searchResult = catalogManager.getSampleManager().search(studyFqn, new Query(), QueryOptions.empty(), + ownerToken); + for (Sample result : searchResult.getResults()) { + System.out.println("result = " + result); + } + System.out.println("searchResult.getNumResults() = " + searchResult.getNumResults()); + +// Query query = new Query(ParamConstants.ID, "s_5"); + Query query = new Query(); + String facet = "version"; +// String facet = "id;somatic;version,release;version[1:5]:1;internal.status.id"; + DataResult queryResult = catalogManager.getSampleManager().facet(studyFqn, query, facet, ownerToken); + + +// QueryOptions options = new QueryOptions(QueryOptions.FACET, "individualId"); +// DataResult queryResult = catalogManager.getSampleManager().facet(studyFqn, new Query(), options, ownerToken); + System.out.println("queryResult.getResults() = " + queryResult.getResults()); + + // assertEquals(3, queryResult.getNumResults()); +// for (Document document : (List) queryResult.getResults()) { +// Document id = (Document) document.get("_id"); +// List value = ((ArrayList) id.values().iterator().next()); +// +// List items = (List) document.get("items"); +// +// if (value.isEmpty()) { +// assertEquals(4, items.size()); +// assertTrue(items.containsAll(Arrays.asList("s_6", "s_7", "s_8", "s_9"))); +// } else if ("CONTROL".equals(value.get(0))) { +// assertEquals(3, items.size()); +// assertTrue(items.containsAll(Arrays.asList("s_1", "s_3", "s_4"))); +// } else if ("CASE".equals(value.get(0))) { +// assertEquals(2, items.size()); +// assertTrue(items.containsAll(Arrays.asList("s_2", "s_5"))); +// } else { +// fail("It should not get into this condition"); +// } +// } + } } \ No newline at end of file diff --git a/opencga-client/src/main/R/R/Clinical-methods.R b/opencga-client/src/main/R/R/Clinical-methods.R index a1d34dba33..b244d67e00 100644 --- a/opencga-client/src/main/R/R/Clinical-methods.R +++ b/opencga-client/src/main/R/R/Clinical-methods.R @@ -20,10 +20,12 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/analysis/clinical/acl/{members}/update | study, members[*], action[*], propagate, body[*] | +#' | aggregationStats | /{apiVersion}/analysis/clinical/aggregationStats | study, id, uuid, type, disorder, files, sample, individual, proband, probandSamples, family, familyMembers, familyMemberSamples, panels, locked, analystId, priority, flags, creationDate, modificationDate, dueDate, qualityControlSummary, release, snapshot, status, internalStatus, annotation, deleted, field | #' | loadAnnotationSets | /{apiVersion}/analysis/clinical/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | updateClinicalConfiguration | /{apiVersion}/analysis/clinical/clinical/configuration/update | study, body | #' | create | /{apiVersion}/analysis/clinical/create | include, exclude, study, skipCreateDefaultInterpretation, includeResult, body[*] | #' | distinct | /{apiVersion}/analysis/clinical/distinct | study, id, uuid, type, disorder, files, sample, individual, proband, probandSamples, family, familyMembers, familyMemberSamples, panels, locked, analystId, priority, flags, creationDate, modificationDate, dueDate, qualityControlSummary, release, snapshot, status, internalStatus, annotation, deleted, field[*] | +#' | aggregationStatsInterpretation | /{apiVersion}/analysis/clinical/interpretation/aggregationStats | study, id, uuid, name, clinicalAnalysisId, analystId, methodName, panels, primaryFindings, secondaryFindings, creationDate, modificationDate, status, internalStatus, release, field | #' | distinctInterpretation | /{apiVersion}/analysis/clinical/interpretation/distinct | study, id, uuid, name, clinicalAnalysisId, analystId, methodName, panels, primaryFindings, secondaryFindings, creationDate, modificationDate, status, internalStatus, release, field[*] | #' | searchInterpretation | /{apiVersion}/analysis/clinical/interpretation/search | include, exclude, limit, skip, sort, study, id, uuid, name, clinicalAnalysisId, analystId, methodName, panels, primaryFindings, secondaryFindings, creationDate, modificationDate, status, internalStatus, release | #' | infoInterpretation | /{apiVersion}/analysis/clinical/interpretation/{interpretations}/info | include, exclude, interpretations[*], study, version, deleted | @@ -75,6 +77,41 @@ setMethod("clinicalClient", "OpencgaR", function(OpencgaR, annotationSet, clinic subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/analysis/clinical/aggregationStats: + #' Fetch catalog clinical analysis aggregation stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list of Clinical Analysis IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list of Clinical Analysis UUIDs up to a maximum of 100. + #' @param type Clinical Analysis type. + #' @param disorder Clinical Analysis disorder. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param files Clinical Analysis files. + #' @param sample Sample associated to the proband or any member of a family. + #' @param individual Proband or any member of a family. + #' @param proband Clinical Analysis proband. + #' @param probandSamples Clinical Analysis proband samples. + #' @param family Clinical Analysis family. + #' @param familyMembers Clinical Analysis family members. + #' @param familyMemberSamples Clinical Analysis family members samples. + #' @param panels Clinical Analysis panels. + #' @param locked Locked Clinical Analyses. + #' @param analystId Clinical Analysis analyst id. + #' @param priority Clinical Analysis priority. + #' @param flags Clinical Analysis flags. + #' @param creationDate Clinical Analysis Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Clinical Analysis Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param dueDate Clinical Analysis due date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param qualityControlSummary Clinical Analysis quality control summary. + #' @param release Release when it was created. + #' @param snapshot Snapshot value (Latest version of the entry in the specified release). + #' @param status Filter by status. + #' @param internalStatus Filter by internal status. + #' @param annotation Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + #' @param deleted Boolean to retrieve deleted entries. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="analysis", categoryId=NULL, subcategory="clinical", + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/analysis/clinical/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. @@ -140,6 +177,28 @@ setMethod("clinicalClient", "OpencgaR", function(OpencgaR, annotationSet, clinic distinct=fetchOpenCGA(object=OpencgaR, category="analysis", categoryId=NULL, subcategory="clinical", subcategoryId=NULL, action="distinct", params=params, httpMethod="GET", as.queryParam=c("field"), ...), + #' @section Endpoint /{apiVersion}/analysis/clinical/interpretation/aggregationStats: + #' Fetch catalog interpretation aggregation stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list of Interpretation IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list of Interpretation UUIDs up to a maximum of 100. + #' @param name Comma separated list of Interpretation names up to a maximum of 100. + #' @param clinicalAnalysisId Clinical Analysis id. + #' @param analystId Analyst ID. + #' @param methodName Interpretation method name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param panels Interpretation panels. + #' @param primaryFindings Interpretation primary findings. + #' @param secondaryFindings Interpretation secondary findings. + #' @param creationDate Interpretation Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Interpretation Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param status Filter by status. + #' @param internalStatus Filter by internal status. + #' @param release Release when it was created. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStatsInterpretation=fetchOpenCGA(object=OpencgaR, category="analysis", categoryId=NULL, + subcategory="clinical/interpretation", subcategoryId=NULL, action="aggregationStats", params=params, + httpMethod="GET", as.queryParam=NULL, ...), + #' @section Endpoint /{apiVersion}/analysis/clinical/interpretation/distinct: #' Interpretation distinct method. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/Cohort-methods.R b/opencga-client/src/main/R/R/Cohort-methods.R index e510a05eba..f4c1b43a59 100644 --- a/opencga-client/src/main/R/R/Cohort-methods.R +++ b/opencga-client/src/main/R/R/Cohort-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/cohorts/acl/{members}/update | study, members[*], action[*], body[*] | +#' | aggregationStats | /{apiVersion}/cohorts/aggregationStats | study, id, name, uuid, type, creationDate, modificationDate, deleted, status, internalStatus, annotation, acl, samples, numSamples, release, field | #' | loadAnnotationSets | /{apiVersion}/cohorts/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | create | /{apiVersion}/cohorts/create | include, exclude, study, variableSet, variable, includeResult, body[*] | #' | distinct | /{apiVersion}/cohorts/distinct | study, id, name, uuid, type, creationDate, modificationDate, deleted, status, internalStatus, annotation, acl, samples, numSamples, release, field[*] | @@ -50,6 +51,28 @@ setMethod("cohortClient", "OpencgaR", function(OpencgaR, annotationSet, cohort, subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/cohorts/aggregationStats: + #' Fetch catalog cohort stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list of cohort IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param name Comma separated list of cohort names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list of cohort IDs up to a maximum of 100. + #' @param type Cohort type. + #' @param creationDate creationDate. + #' @param modificationDate modificationDate. + #' @param deleted deleted. + #' @param status status. + #' @param internalStatus internalStatus. + #' @param annotation Cohort annotation. + #' @param acl acl. + #' @param samples Cohort sample IDs. + #' @param numSamples Number of samples. + #' @param release release. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="cohorts", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/cohorts/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/Family-methods.R b/opencga-client/src/main/R/R/Family-methods.R index de04b21219..3532d52f2c 100644 --- a/opencga-client/src/main/R/R/Family-methods.R +++ b/opencga-client/src/main/R/R/Family-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/families/acl/{members}/update | study, members[*], action[*], propagate, body[*] | +#' | aggregationStats | /{apiVersion}/families/aggregationStats | study, id, name, uuid, members, expectedSize, samples, phenotypes, disorders, creationDate, modificationDate, deleted, internalStatus, status, annotation, acl, release, snapshot, field | #' | loadAnnotationSets | /{apiVersion}/families/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | create | /{apiVersion}/families/create | include, exclude, study, members, includeResult, body[*] | #' | distinct | /{apiVersion}/families/distinct | study, id, name, uuid, members, expectedSize, samples, phenotypes, disorders, creationDate, modificationDate, deleted, internalStatus, status, annotation, acl, release, snapshot, field[*] | @@ -50,6 +51,31 @@ setMethod("familyClient", "OpencgaR", function(OpencgaR, annotationSet, families subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/families/aggregationStats: + #' Fetch catalog family stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list family IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param name Comma separated list family names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list family UUIDs up to a maximum of 100. + #' @param members Comma separated list of family members. + #' @param expectedSize Expected size of the family (number of members). + #' @param samples Comma separated list of member's samples. + #' @param phenotypes Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param disorders Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param deleted Boolean to retrieve deleted entries. + #' @param internalStatus Filter by internal status. + #' @param status Filter by status. + #' @param annotation Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param release Release when it was created. + #' @param snapshot Snapshot value (Latest version of the entry in the specified release). + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="families", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/families/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/File-methods.R b/opencga-client/src/main/R/R/File-methods.R index da3baba3e6..d1458fd1c4 100644 --- a/opencga-client/src/main/R/R/File-methods.R +++ b/opencga-client/src/main/R/R/File-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/files/acl/{members}/update | study, members[*], action[*], body[*] | +#' | aggregationStats | /{apiVersion}/files/aggregationStats | study, id, uuid, name, path, uri, type, bioformat, format, external, status, internalStatus, internalVariantIndexStatus, softwareName, directory, creationDate, modificationDate, description, tags, size, sampleIds, jobId, annotation, acl, deleted, release, field | #' | loadAnnotationSets | /{apiVersion}/files/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | bioformats | /{apiVersion}/files/bioformats | | #' | create | /{apiVersion}/files/create | study, parents, body[*] | @@ -66,6 +67,39 @@ setMethod("fileClient", "OpencgaR", function(OpencgaR, annotationSet, file, file subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/files/aggregationStats: + #' Fetch catalog file stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list of file IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list file UUIDs up to a maximum of 100. + #' @param name Comma separated list of file names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param path Comma separated list of paths. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uri Comma separated list of uris. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param type File type, either FILE or DIRECTORY. + #' @param bioformat Comma separated Bioformat values. For existing Bioformats see files/bioformats. + #' @param format Comma separated Format values. For existing Formats see files/formats. + #' @param external Boolean field indicating whether to filter by external or non external files. + #' @param status Filter by status. + #' @param internalStatus Filter by internal status. + #' @param internalVariantIndexStatus Filter by internal variant index status. + #' @param softwareName Software name. + #' @param directory Directory under which we want to look for files or folders. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param description Description. + #' @param tags Tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param size File size. + #' @param sampleIds Comma separated list sample IDs or UUIDs up to a maximum of 100. + #' @param jobId Job ID that created the file(s) or folder(s). + #' @param annotation Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param deleted Boolean to retrieve deleted entries. + #' @param release Release when it was created. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="files", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/files/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/Individual-methods.R b/opencga-client/src/main/R/R/Individual-methods.R index 9a3bc092ad..c9a227d7b3 100644 --- a/opencga-client/src/main/R/R/Individual-methods.R +++ b/opencga-client/src/main/R/R/Individual-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/individuals/acl/{members}/update | study, members[*], action[*], propagate, body[*] | +#' | aggregationStats | /{apiVersion}/individuals/aggregationStats | study, id, uuid, name, father, mother, samples, familyIds, sex, dateOfBirth, ethnicity, disorders, phenotypes, populationName, populationSubpopulation, karyotypicSex, lifeStatus, internalStatus, status, deleted, creationDate, modificationDate, annotation, acl, release, snapshot, field | #' | loadAnnotationSets | /{apiVersion}/individuals/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | create | /{apiVersion}/individuals/create | include, exclude, study, samples, includeResult, body[*] | #' | distinct | /{apiVersion}/individuals/distinct | study, id, uuid, name, familyIds, father, mother, samples, sex, ethnicity, dateOfBirth, disorders, phenotypes, populationName, populationSubpopulation, karyotypicSex, lifeStatus, internalStatus, status, deleted, creationDate, modificationDate, annotation, acl, release, snapshot, field[*] | @@ -51,6 +52,39 @@ setMethod("individualClient", "OpencgaR", function(OpencgaR, annotationSet, indi subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/individuals/aggregationStats: + #' Fetch catalog individual stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list individual IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list individual UUIDs up to a maximum of 100. + #' @param name Comma separated list individual names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param father Father ID, name or UUID. + #' @param mother Mother ID, name or UUID. + #' @param samples Sample ID, name or UUID. + #' @param familyIds Comma separated list of family ids the individuals may belong to. + #' @param sex Individual sex. + #' @param dateOfBirth Individual date of birth. + #' @param ethnicity Individual ethnicity. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param disorders Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param phenotypes Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param populationName Population name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param populationSubpopulation Subpopulation name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param karyotypicSex Individual karyotypic sex. + #' @param lifeStatus Individual life status. + #' @param internalStatus Filter by internal status. + #' @param status Filter by status. + #' @param deleted Boolean to retrieve deleted entries. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param annotation Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param release Release when it was created. + #' @param snapshot Snapshot value (Latest version of the entry in the specified release). + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="individuals", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/individuals/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/Job-methods.R b/opencga-client/src/main/R/R/Job-methods.R index 32df3f0650..bcb13aabe2 100644 --- a/opencga-client/src/main/R/R/Job-methods.R +++ b/opencga-client/src/main/R/R/Job-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/jobs/acl/{members}/update | members[*], action[*], body[*] | +#' | aggregationStats | /{apiVersion}/jobs/aggregationStats | study, otherStudies, id, uuid, toolId, toolType, userId, priority, status, internalStatus, creationDate, modificationDate, visited, tags, input, output, acl, release, deleted, field | #' | create | /{apiVersion}/jobs/create | study, body[*] | #' | distinct | /{apiVersion}/jobs/distinct | study, otherStudies, id, uuid, toolId, toolType, userId, priority, status, internalStatus, creationDate, modificationDate, visited, tags, input, output, acl, release, deleted, field[*] | #' | retry | /{apiVersion}/jobs/retry | jobId, jobDescription, jobDependsOn, jobTags, jobScheduledStartTime, study, body[*] | @@ -51,6 +52,32 @@ setMethod("jobClient", "OpencgaR", function(OpencgaR, job, jobs, members, endpoi subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/jobs/aggregationStats: + #' Fetch catalog job stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param otherStudies Flag indicating the entries being queried can belong to any related study, not just the primary one. + #' @param id Comma separated list of job IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list of job UUIDs up to a maximum of 100. + #' @param toolId Tool ID executed by the job. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param toolType Tool type executed by the job [OPERATION, ANALYSIS]. + #' @param userId User that created the job. + #' @param priority Priority of the job. + #' @param status Filter by status. + #' @param internalStatus Filter by internal status. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param visited Visited status of job. + #' @param tags Job tags. + #' @param input Comma separated list of file IDs used as input. + #' @param output Comma separated list of file IDs used as output. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param release Release when it was created. + #' @param deleted Boolean to retrieve deleted entries. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="jobs", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/jobs/create: #' Register an executed job with POST method. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. diff --git a/opencga-client/src/main/R/R/Panel-methods.R b/opencga-client/src/main/R/R/Panel-methods.R index 36c512a86f..72d230dff4 100644 --- a/opencga-client/src/main/R/R/Panel-methods.R +++ b/opencga-client/src/main/R/R/Panel-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/panels/acl/{members}/update | study, members[*], action[*], body[*] | +#' | aggregationStats | /{apiVersion}/panels/aggregationStats | study, id, uuid, name, internalStatus, disorders, variants, genes, source, regions, categories, tags, deleted, status, creationDate, modificationDate, acl, release, snapshot, field | #' | create | /{apiVersion}/panels/create | include, exclude, study, includeResult, body | #' | distinct | /{apiVersion}/panels/distinct | study, id, uuid, name, internalStatus, disorders, variants, genes, source, regions, categories, tags, deleted, status, creationDate, modificationDate, acl, release, snapshot, field[*] | #' | importPanels | /{apiVersion}/panels/import | study, jobId, jobDependsOn, jobDescription, jobTags, jobScheduledStartTime, jobPriority, jobDryRun, body | @@ -48,6 +49,32 @@ setMethod("panelClient", "OpencgaR", function(OpencgaR, members, panels, endpoin subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/panels/aggregationStats: + #' Fetch catalog panel stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list of panel IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list of panel UUIDs up to a maximum of 100. + #' @param name Comma separated list of panel names up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param internalStatus Filter by internal status. + #' @param disorders Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param variants Comma separated list of variant ids. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param genes Comma separated list of gene ids. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param source Comma separated list of source ids or names. + #' @param regions Comma separated list of regions. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param categories Comma separated list of category names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param tags Panel tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param deleted Boolean to retrieve deleted entries. + #' @param status Filter by status. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param release Release when it was created. + #' @param snapshot Snapshot value (Latest version of the entry in the specified release). + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="panels", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/panels/create: #' Create a panel. #' @param include Fields included in the response, whole JSON path must be provided. diff --git a/opencga-client/src/main/R/R/Sample-methods.R b/opencga-client/src/main/R/R/Sample-methods.R index a5434ddb45..0bb2941860 100644 --- a/opencga-client/src/main/R/R/Sample-methods.R +++ b/opencga-client/src/main/R/R/Sample-methods.R @@ -20,6 +20,7 @@ #' | endpointName | Endpoint WS | parameters accepted | #' | -- | :-- | --: | #' | updateAcl | /{apiVersion}/samples/acl/{members}/update | study, members[*], action[*], body[*] | +#' | aggregationStats | /{apiVersion}/samples/aggregationStats | study, id, uuid, somatic, individualId, fileIds, cohortIds, creationDate, modificationDate, internalStatus, status, processingProduct, processingPreparationMethod, processingExtractionMethod, processingLabSampleId, collectionFrom, collectionType, collectionMethod, phenotypes, annotation, acl, internalRgaStatus, release, snapshot, deleted, statsId, statsVariantCount, statsChromosomeCount, statsTypeCount, statsGenotypeCount, statsTiTvRatio, statsQualityAvg, statsQualityStdDev, statsHeterozygosityRate, statsDepthCount, statsBiotypeCount, statsClinicalSignificanceCount, statsConsequenceTypeCount, field | #' | loadAnnotationSets | /{apiVersion}/samples/annotationSets/load | study, variableSetId[*], path[*], parents, annotationSetId, body | #' | create | /{apiVersion}/samples/create | include, exclude, study, includeResult, body[*] | #' | distinct | /{apiVersion}/samples/distinct | study, id, uuid, somatic, individualId, fileIds, cohortIds, creationDate, modificationDate, internalStatus, status, processingProduct, processingPreparationMethod, processingExtractionMethod, processingLabSampleId, collectionFrom, collectionType, collectionMethod, phenotypes, annotation, acl, internalRgaStatus, release, snapshot, deleted, statsId, statsVariantCount, statsChromosomeCount, statsTypeCount, statsGenotypeCount, statsTiTvRatio, statsQualityAvg, statsQualityStdDev, statsHeterozygosityRate, statsDepthCount, statsBiotypeCount, statsClinicalSignificanceCount, statsConsequenceTypeCount, field[*] | @@ -50,6 +51,51 @@ setMethod("sampleClient", "OpencgaR", function(OpencgaR, annotationSet, members, subcategoryId=members, action="update", params=params, httpMethod="POST", as.queryParam=c("action"), ...), + #' @section Endpoint /{apiVersion}/samples/aggregationStats: + #' Fetch catalog sample stats. + #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. + #' @param id Comma separated list sample IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param uuid Comma separated list sample UUIDs up to a maximum of 100. + #' @param somatic Somatic sample. + #' @param individualId Individual ID or UUID. + #' @param fileIds Comma separated list of file IDs, paths or UUIDs. + #' @param cohortIds Comma separated list of cohort IDs. + #' @param creationDate Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param modificationDate Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + #' @param internalStatus Filter by internal status. + #' @param status Filter by status. + #' @param processingProduct Processing product. + #' @param processingPreparationMethod Processing preparation method. + #' @param processingExtractionMethod Processing extraction method. + #' @param processingLabSampleId Processing lab sample id. + #' @param collectionFrom Collection from. + #' @param collectionType Collection type. + #' @param collectionMethod Collection method. + #' @param phenotypes Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + #' @param annotation Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + #' @param acl Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS permissions. Only study owners or administrators can query by this field. . + #' @param internalRgaStatus Index status of the sample for the Recessive Gene Analysis. Allowed values: ['NOT_INDEXED INDEXED INVALID_PERMISSIONS INVALID_METADATA INVALID'] + #' @param release Release when it was created. + #' @param snapshot Snapshot value (Latest version of the entry in the specified release). + #' @param deleted Boolean to retrieve deleted entries. + #' @param statsId Sample variant stats Id. If this field is not provided and the user filters by other stats fields, it will automatically be set to ALL. + #' @param statsVariantCount Sample variant stats VariantCount. + #' @param statsChromosomeCount Sample variant stats ChromosomeCount. + #' @param statsTypeCount Sample variant stats TypeCount. + #' @param statsGenotypeCount Sample variant stats GenotypeCount. + #' @param statsTiTvRatio Sample variant stats TiTvRatio. + #' @param statsQualityAvg Sample variant stats QualityAvg. + #' @param statsQualityStdDev Sample variant stats QualityStdDev. + #' @param statsHeterozygosityRate Sample variant stats HeterozygosityRate. + #' @param statsDepthCount Sample variant stats DepthCount. + #' @param statsBiotypeCount Sample variant stats BiotypeCount. + #' @param statsClinicalSignificanceCount Sample variant stats ClinicalSignificanceCount. + #' @param statsConsequenceTypeCount Sample variant stats ConsequenceTypeCount. + #' @param field Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: studies;type;numSamples[0..10]:1;format:sum(size). + aggregationStats=fetchOpenCGA(object=OpencgaR, category="samples", categoryId=NULL, subcategory=NULL, + subcategoryId=NULL, action="aggregationStats", params=params, httpMethod="GET", as.queryParam=NULL, + ...), + #' @section Endpoint /{apiVersion}/samples/annotationSets/load: #' Load annotation sets from a TSV file. #' @param study Study [[organization@]project:]study where study and project can be either the ID or UUID. 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 76a835a531..eb9ceaf25d 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 @@ -90,6 +90,50 @@ public RestResponse updateAcl(String members, Stri return execute("analysis", null, "clinical/acl", members, "update", params, POST, ClinicalAnalysisAclEntryList.class); } + /** + * Fetch catalog clinical analysis aggregation stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list of Clinical Analysis IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list of Clinical Analysis UUIDs up to a maximum of 100. + * type: Clinical Analysis type. + * disorder: Clinical Analysis disorder. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * files: Clinical Analysis files. + * sample: Sample associated to the proband or any member of a family. + * individual: Proband or any member of a family. + * proband: Clinical Analysis proband. + * probandSamples: Clinical Analysis proband samples. + * family: Clinical Analysis family. + * familyMembers: Clinical Analysis family members. + * familyMemberSamples: Clinical Analysis family members samples. + * panels: Clinical Analysis panels. + * locked: Locked Clinical Analyses. + * analystId: Clinical Analysis analyst id. + * priority: Clinical Analysis priority. + * flags: Clinical Analysis flags. + * creationDate: Clinical Analysis Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Clinical Analysis Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * dueDate: Clinical Analysis due date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * qualityControlSummary: Clinical Analysis quality control summary. + * release: Release when it was created. + * snapshot: Snapshot value (Latest version of the entry in the specified release). + * status: Filter by status. + * internalStatus: Filter by internal status. + * annotation: Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * deleted: Boolean to retrieve deleted entries. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("analysis", null, "clinical", null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. @@ -190,6 +234,36 @@ public RestResponse distinct(String field, ObjectMap params) throws C return execute("analysis", null, "clinical", null, "distinct", params, GET, ObjectMap.class); } + /** + * Fetch catalog interpretation aggregation stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list of Interpretation IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list of Interpretation UUIDs up to a maximum of 100. + * name: Comma separated list of Interpretation names up to a maximum of 100. + * clinicalAnalysisId: Clinical Analysis id. + * analystId: Analyst ID. + * methodName: Interpretation method name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' + * e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * panels: Interpretation panels. + * primaryFindings: Interpretation primary findings. + * secondaryFindings: Interpretation secondary findings. + * creationDate: Interpretation Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Interpretation Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * status: Filter by status. + * internalStatus: Filter by internal status. + * release: Release when it was created. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStatsInterpretation(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("analysis", null, "clinical/interpretation", null, "aggregationStats", params, GET, FacetField.class); + } + /** * Interpretation distinct method. * @param field Comma separated list of fields for which to obtain the distinct values. 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 0bcb27158a..668b57784c 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -70,6 +71,36 @@ public RestResponse updateAcl(String members, String action, return execute("cohorts", null, "acl", members, "update", params, POST, CohortAclEntryList.class); } + /** + * Fetch catalog cohort stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list of cohort IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * name: Comma separated list of cohort names up to a maximum of 100. Also admits basic regular expressions using the operator + * '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list of cohort IDs up to a maximum of 100. + * type: Cohort type. + * creationDate: creationDate. + * modificationDate: modificationDate. + * deleted: deleted. + * status: status. + * internalStatus: internalStatus. + * annotation: Cohort annotation. + * acl: acl. + * samples: Cohort sample IDs. + * numSamples: Number of samples. + * release: release. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("cohorts", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. 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 15d71d9859..e133d57058 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -69,6 +70,50 @@ public RestResponse updateAcl(String members, String action, return execute("panels", null, "acl", members, "update", params, POST, PanelAclEntryList.class); } + /** + * Fetch catalog panel stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list of panel IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list of panel UUIDs up to a maximum of 100. + * name: Comma separated list of panel names up to a maximum of 100. Also admits basic regular expressions using the operator + * '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * internalStatus: Filter by internal status. + * disorders: Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.. Also admits basic regular + * expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case + * insensitive search. + * variants: Comma separated list of variant ids. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * genes: Comma separated list of gene ids. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' + * e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * source: Comma separated list of source ids or names. + * regions: Comma separated list of regions. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' + * e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * categories: Comma separated list of category names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * tags: Panel tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + * sensitive, '~/value/i' for case insensitive search. + * deleted: Boolean to retrieve deleted entries. + * status: Filter by status. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * release: Release when it was created. + * snapshot: Snapshot value (Latest version of the entry in the specified release). + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("panels", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Create a panel. * @param data Panel parameters. 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 368cf2eb4a..1fe814c7f5 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -70,6 +71,44 @@ public RestResponse updateAcl(String members, String action, return execute("families", null, "acl", members, "update", params, POST, FamilyAclEntryList.class); } + /** + * Fetch catalog family stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list family IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * name: Comma separated list family names up to a maximum of 100. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list family UUIDs up to a maximum of 100. + * members: Comma separated list of family members. + * expectedSize: Expected size of the family (number of members). + * samples: Comma separated list of member's samples. + * phenotypes: Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * disorders: Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * deleted: Boolean to retrieve deleted entries. + * internalStatus: Filter by internal status. + * status: Filter by status. + * annotation: Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * release: Release when it was created. + * snapshot: Snapshot value (Latest version of the entry in the specified release). + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("families", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. 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 dcf3ae18ef..6d50ea896a 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 @@ -18,6 +18,7 @@ import java.io.DataInputStream; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -77,6 +78,53 @@ public RestResponse updateAcl(String members, String action, F return execute("files", null, "acl", members, "update", params, POST, FileAclEntryList.class); } + /** + * Fetch catalog file stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list of file IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list file UUIDs up to a maximum of 100. + * name: Comma separated list of file names. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' + * e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * path: Comma separated list of paths. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * uri: Comma separated list of uris. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * type: File type, either FILE or DIRECTORY. + * bioformat: Comma separated Bioformat values. For existing Bioformats see files/bioformats. + * format: Comma separated Format values. For existing Formats see files/formats. + * external: Boolean field indicating whether to filter by external or non external files. + * status: Filter by status. + * internalStatus: Filter by internal status. + * internalVariantIndexStatus: Filter by internal variant index status. + * softwareName: Software name. + * directory: Directory under which we want to look for files or folders. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * description: Description. + * tags: Tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + * sensitive, '~/value/i' for case insensitive search. + * size: File size. + * sampleIds: Comma separated list sample IDs or UUIDs up to a maximum of 100. + * jobId: Job ID that created the file(s) or folder(s). + * annotation: Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * deleted: Boolean to retrieve deleted entries. + * release: Release when it was created. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("files", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. 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 571f7b8953..fb9f251433 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -71,6 +72,55 @@ public RestResponse updateAcl(String members, String act return execute("individuals", null, "acl", members, "update", params, POST, IndividualAclEntryList.class); } + /** + * Fetch catalog individual stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list individual IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list individual UUIDs up to a maximum of 100. + * name: Comma separated list individual names up to a maximum of 100. Also admits basic regular expressions using the operator + * '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * father: Father ID, name or UUID. + * mother: Mother ID, name or UUID. + * samples: Sample ID, name or UUID. + * familyIds: Comma separated list of family ids the individuals may belong to. + * sex: Individual sex. + * dateOfBirth: Individual date of birth. + * ethnicity: Individual ethnicity. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * disorders: Comma separated list of disorder ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * phenotypes: Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * populationName: Population name. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * populationSubpopulation: Subpopulation name. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * karyotypicSex: Individual karyotypic sex. + * lifeStatus: Individual life status. + * internalStatus: Filter by internal status. + * status: Filter by status. + * deleted: Boolean to retrieve deleted entries. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * annotation: Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * release: Release when it was created. + * snapshot: Snapshot value (Latest version of the entry in the specified release). + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("individuals", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. 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 77c04be505..133a0304b2 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -67,6 +68,42 @@ public RestResponse updateAcl(String members, String action, Jo return execute("jobs", null, "acl", members, "update", params, POST, JobAclEntryList.class); } + /** + * Fetch catalog job stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * otherStudies: Flag indicating the entries being queried can belong to any related study, not just the primary one. + * id: Comma separated list of job IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list of job UUIDs up to a maximum of 100. + * toolId: Tool ID executed by the job. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * toolType: Tool type executed by the job [OPERATION, ANALYSIS]. + * userId: User that created the job. + * priority: Priority of the job. + * status: Filter by status. + * internalStatus: Filter by internal status. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * visited: Visited status of job. + * tags: Job tags. + * input: Comma separated list of file IDs used as input. + * output: Comma separated list of file IDs used as output. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * release: Release when it was created. + * deleted: Boolean to retrieve deleted entries. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("jobs", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Register an executed job with POST method. * @param data job. 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 811dcbfe08..03cae6de62 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 @@ -17,6 +17,7 @@ package org.opencb.opencga.client.rest.clients; import java.lang.Object; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.opencga.client.config.ClientConfiguration; import org.opencb.opencga.client.exceptions.ClientException; @@ -70,6 +71,63 @@ public RestResponse updateAcl(String members, String action, return execute("samples", null, "acl", members, "update", params, POST, SampleAclEntryList.class); } + /** + * Fetch catalog sample stats. + * @param params Map containing any of the following optional parameters. + * study: Study [[organization@]project:]study where study and project can be either the ID or UUID. + * id: Comma separated list sample IDs up to a maximum of 100. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * uuid: Comma separated list sample UUIDs up to a maximum of 100. + * somatic: Somatic sample. + * individualId: Individual ID or UUID. + * fileIds: Comma separated list of file IDs, paths or UUIDs. + * cohortIds: Comma separated list of cohort IDs. + * creationDate: Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * modificationDate: Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * internalStatus: Filter by internal status. + * status: Filter by status. + * processingProduct: Processing product. + * processingPreparationMethod: Processing preparation method. + * processingExtractionMethod: Processing extraction method. + * processingLabSampleId: Processing lab sample id. + * collectionFrom: Collection from. + * collectionType: Collection type. + * collectionMethod: Collection method. + * phenotypes: Comma separated list of phenotype ids or names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * annotation: Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * acl: Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. Example: + * acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * internalRgaStatus: Index status of the sample for the Recessive Gene Analysis. + * release: Release when it was created. + * snapshot: Snapshot value (Latest version of the entry in the specified release). + * deleted: Boolean to retrieve deleted entries. + * statsId: Sample variant stats Id. If this field is not provided and the user filters by other stats fields, it will + * automatically be set to ALL. + * statsVariantCount: Sample variant stats VariantCount. + * statsChromosomeCount: Sample variant stats ChromosomeCount. + * statsTypeCount: Sample variant stats TypeCount. + * statsGenotypeCount: Sample variant stats GenotypeCount. + * statsTiTvRatio: Sample variant stats TiTvRatio. + * statsQualityAvg: Sample variant stats QualityAvg. + * statsQualityStdDev: Sample variant stats QualityStdDev. + * statsHeterozygosityRate: Sample variant stats HeterozygosityRate. + * statsDepthCount: Sample variant stats DepthCount. + * statsBiotypeCount: Sample variant stats BiotypeCount. + * statsClinicalSignificanceCount: Sample variant stats ClinicalSignificanceCount. + * statsConsequenceTypeCount: Sample variant stats ConsequenceTypeCount. + * field: Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @return a RestResponse object. + * @throws ClientException ClientException if there is any server error. + */ + public RestResponse aggregationStats(ObjectMap params) throws ClientException { + params = params != null ? params : new ObjectMap(); + return execute("samples", null, null, null, "aggregationStats", params, GET, FacetField.class); + } + /** * Load annotation sets from a TSV file. * @param variableSetId Variable set ID or name. diff --git a/opencga-client/src/main/javascript/ClinicalAnalysis.js b/opencga-client/src/main/javascript/ClinicalAnalysis.js index 8c13ed5715..c90087a9dc 100644 --- a/opencga-client/src/main/javascript/ClinicalAnalysis.js +++ b/opencga-client/src/main/javascript/ClinicalAnalysis.js @@ -48,6 +48,48 @@ export default class ClinicalAnalysis extends OpenCGAParentClass { return this._post("analysis", null, "clinical/acl", members, "update", data, {action, ...params}); } + /** Fetch catalog clinical analysis aggregation stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]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. Also admits basic regular + * expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @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. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @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 {Number} [params.snapshot] - Snapshot value (Latest version of the entry in the specified release). + * @param {String} [params.status] - Filter by status. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.annotation] - Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * @param {Boolean} [params.deleted] - Boolean to retrieve deleted entries. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("analysis", null, "clinical", null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. @@ -130,6 +172,34 @@ export default class ClinicalAnalysis extends OpenCGAParentClass { return this._get("analysis", null, "clinical", null, "distinct", {field, ...params}); } + /** Fetch catalog interpretation aggregation stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]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. Also admits basic regular expressions + * using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list of Interpretation UUIDs up to a maximum of 100. + * @param {String} [params.name] - Comma separated list of Interpretation names 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. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @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. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStatsInterpretation(params) { + return this._get("analysis", null, "clinical/interpretation", null, "aggregationStats", params); + } + /** Interpretation distinct method * @param {String} field - Comma separated list of fields for which to obtain the distinct values. * @param {Object} [params] - The Object containing the following optional parameters: diff --git a/opencga-client/src/main/javascript/Cohort.js b/opencga-client/src/main/javascript/Cohort.js index dcd44092cc..5f2e79902b 100644 --- a/opencga-client/src/main/javascript/Cohort.js +++ b/opencga-client/src/main/javascript/Cohort.js @@ -46,6 +46,33 @@ export default class Cohort extends OpenCGAParentClass { return this._post("cohorts", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog cohort stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list of cohort IDs up to a maximum of 100. Also admits basic regular expressions using + * the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.name] - Comma separated list of cohort names up to a maximum of 100. Also admits basic regular expressions + * using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list of cohort IDs up to a maximum of 100. + * @param {String} [params.type] - Cohort type. + * @param {String} [params.creationDate] - creationDate. + * @param {String} [params.modificationDate] - modificationDate. + * @param {Boolean} [params.deleted] - deleted. + * @param {String} [params.status] - status. + * @param {String} [params.internalStatus] - internalStatus. + * @param {String} [params.annotation] - Cohort annotation. + * @param {String} [params.acl] - acl. + * @param {String} [params.samples] - Cohort sample IDs. + * @param {String} [params.numSamples] - Number of samples. + * @param {String} [params.release] - release. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("cohorts", null, null, null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. diff --git a/opencga-client/src/main/javascript/DiseasePanel.js b/opencga-client/src/main/javascript/DiseasePanel.js index 1aca2e4ef5..948afdecd0 100644 --- a/opencga-client/src/main/javascript/DiseasePanel.js +++ b/opencga-client/src/main/javascript/DiseasePanel.js @@ -46,6 +46,47 @@ export default class DiseasePanel extends OpenCGAParentClass { return this._post("panels", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog panel stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list of panel IDs up to a maximum of 100. Also admits basic regular expressions using + * the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list of panel UUIDs up to a maximum of 100. + * @param {String} [params.name] - Comma separated list of panel names up to a maximum of 100. Also admits basic regular expressions + * using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.disorders] - Comma separated list of disorder ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search.. Also admits basic + * regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive + * search. + * @param {String} [params.variants] - Comma separated list of variant ids. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.genes] - Comma separated list of gene ids. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.source] - Comma separated list of source ids or names. + * @param {String} [params.regions] - Comma separated list of regions. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.categories] - Comma separated list of category names. Also admits basic regular expressions using the operator + * '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.tags] - Panel tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. + * '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.status] - Filter by status. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {String} [params.release] - Release when it was created. + * @param {Number} [params.snapshot] - Snapshot value (Latest version of the entry in the specified release). + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("panels", null, null, null, "aggregationStats", params); + } + /** Create a panel * @param {Object} [data] - Panel parameters. * @param {Object} [params] - The Object containing the following optional parameters: diff --git a/opencga-client/src/main/javascript/Family.js b/opencga-client/src/main/javascript/Family.js index 55a5ac0caf..115c32403a 100644 --- a/opencga-client/src/main/javascript/Family.js +++ b/opencga-client/src/main/javascript/Family.js @@ -48,6 +48,41 @@ export default class Family extends OpenCGAParentClass { return this._post("families", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog family stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list family IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.name] - Comma separated list family names up to a maximum of 100. Also admits basic regular expressions using + * the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list family UUIDs up to a maximum of 100. + * @param {String} [params.members] - Comma separated list of family members. + * @param {Number} [params.expectedSize] - Expected size of the family (number of members). + * @param {String} [params.samples] - Comma separated list of member's samples. + * @param {String} [params.phenotypes] - Comma separated list of phenotype ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.disorders] - Comma separated list of disorder ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.status] - Filter by status. + * @param {String} [params.annotation] - Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {String} [params.release] - Release when it was created. + * @param {Number} [params.snapshot] - Snapshot value (Latest version of the entry in the specified release). + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("families", null, null, null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. diff --git a/opencga-client/src/main/javascript/File.js b/opencga-client/src/main/javascript/File.js index cfedee4d93..a5d114d3eb 100644 --- a/opencga-client/src/main/javascript/File.js +++ b/opencga-client/src/main/javascript/File.js @@ -46,6 +46,50 @@ export default class File extends OpenCGAParentClass { return this._post("files", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog file stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list of file IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list file UUIDs up to a maximum of 100. + * @param {String} [params.name] - Comma separated list of file names. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.path] - Comma separated list of paths. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uri] - Comma separated list of uris. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.type] - File type, either FILE or DIRECTORY. + * @param {String} [params.bioformat] - Comma separated Bioformat values. For existing Bioformats see files/bioformats. + * @param {String} [params.format] - Comma separated Format values. For existing Formats see files/formats. + * @param {Boolean} [params.external] - Boolean field indicating whether to filter by external or non external files. + * @param {String} [params.status] - Filter by status. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.internalVariantIndexStatus] - Filter by internal variant index status. + * @param {String} [params.softwareName] - Software name. + * @param {String} [params.directory] - Directory under which we want to look for files or folders. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.description] - Description. + * @param {String} [params.tags] - Tags. Also admits basic regular expressions using the operator '~', i.e. '~{perl-regex}' e.g. '~value' + * for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.size] - File size. + * @param {String} [params.sampleIds] - Comma separated list sample IDs or UUIDs up to a maximum of 100. + * @param {String} [params.jobId] - Job ID that created the file(s) or folder(s). + * @param {String} [params.annotation] - Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.release] - Release when it was created. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("files", null, null, null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. diff --git a/opencga-client/src/main/javascript/Individual.js b/opencga-client/src/main/javascript/Individual.js index fb33520e6d..fc36c9cd0c 100644 --- a/opencga-client/src/main/javascript/Individual.js +++ b/opencga-client/src/main/javascript/Individual.js @@ -48,6 +48,52 @@ export default class Individual extends OpenCGAParentClass { return this._post("individuals", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog individual stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list individual IDs up to a maximum of 100. Also admits basic regular expressions using + * the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list individual UUIDs up to a maximum of 100. + * @param {String} [params.name] - Comma separated list individual names up to a maximum of 100. Also admits basic regular expressions + * using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.father] - Father ID, name or UUID. + * @param {String} [params.mother] - Mother ID, name or UUID. + * @param {String} [params.samples] - Sample ID, name or UUID. + * @param {String} [params.familyIds] - Comma separated list of family ids the individuals may belong to. + * @param {String} [params.sex] - Individual sex. + * @param {String} [params.dateOfBirth] - Individual date of birth. + * @param {String} [params.ethnicity] - Individual ethnicity. Also admits basic regular expressions using the operator '~', i.e. '~{perl- + * regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.disorders] - Comma separated list of disorder ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.phenotypes] - Comma separated list of phenotype ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.populationName] - Population name. Also admits basic regular expressions using the operator '~', i.e. '~{perl- + * regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.populationSubpopulation] - Subpopulation name. Also admits basic regular expressions using the operator '~', + * i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.karyotypicSex] - Individual karyotypic sex. + * @param {String} [params.lifeStatus] - Individual life status. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.status] - Filter by status. + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.annotation] - Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {String} [params.release] - Release when it was created. + * @param {Number} [params.snapshot] - Snapshot value (Latest version of the entry in the specified release). + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("individuals", null, null, null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. diff --git a/opencga-client/src/main/javascript/Job.js b/opencga-client/src/main/javascript/Job.js index bb88f18dd7..73d92b4e37 100644 --- a/opencga-client/src/main/javascript/Job.js +++ b/opencga-client/src/main/javascript/Job.js @@ -44,6 +44,40 @@ export default class Job extends OpenCGAParentClass { return this._post("jobs", null, "acl", members, "update", data, action); } + /** Fetch catalog job stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {Boolean} [params.otherStudies = "false"] - Flag indicating the entries being queried can belong to any related study, not just + * the primary one. The default value is false. + * @param {String} [params.id] - Comma separated list of job IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list of job UUIDs up to a maximum of 100. + * @param {String} [params.toolId] - Tool ID executed by the job. Also admits basic regular expressions using the operator '~', i.e. + * '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.toolType] - Tool type executed by the job [OPERATION, ANALYSIS]. + * @param {String} [params.userId] - User that created the job. + * @param {String} [params.priority] - Priority of the job. + * @param {String} [params.status] - Filter by status. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {Boolean} [params.visited] - Visited status of job. + * @param {String} [params.tags] - Job tags. + * @param {String} [params.input] - Comma separated list of file IDs used as input. + * @param {String} [params.output] - Comma separated list of file IDs used as output. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {String} [params.release] - Release when it was created. + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("jobs", null, null, null, "aggregationStats", params); + } + /** Register an executed job with POST method * @param {Object} data - job. * @param {Object} [params] - The Object containing the following optional parameters: diff --git a/opencga-client/src/main/javascript/Sample.js b/opencga-client/src/main/javascript/Sample.js index 48edf930fc..be238fbd16 100644 --- a/opencga-client/src/main/javascript/Sample.js +++ b/opencga-client/src/main/javascript/Sample.js @@ -47,6 +47,61 @@ export default class Sample extends OpenCGAParentClass { return this._post("samples", null, "acl", members, "update", data, {action, ...params}); } + /** Fetch catalog sample stats + * @param {Object} [params] - The Object containing the following optional parameters: + * @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID. + * @param {String} [params.id] - Comma separated list sample IDs up to a maximum of 100. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.uuid] - Comma separated list sample UUIDs up to a maximum of 100. + * @param {Boolean} [params.somatic] - Somatic sample. + * @param {String} [params.individualId] - Individual ID or UUID. + * @param {String} [params.fileIds] - Comma separated list of file IDs, paths or UUIDs. + * @param {String} [params.cohortIds] - Comma separated list of cohort IDs. + * @param {String} [params.creationDate] - Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.modificationDate] - Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + * @param {String} [params.internalStatus] - Filter by internal status. + * @param {String} [params.status] - Filter by status. + * @param {String} [params.processingProduct] - Processing product. + * @param {String} [params.processingPreparationMethod] - Processing preparation method. + * @param {String} [params.processingExtractionMethod] - Processing extraction method. + * @param {String} [params.processingLabSampleId] - Processing lab sample id. + * @param {String} [params.collectionFrom] - Collection from. + * @param {String} [params.collectionType] - Collection type. + * @param {String} [params.collectionMethod] - Collection method. + * @param {String} [params.phenotypes] - Comma separated list of phenotype ids or names. Also admits basic regular expressions using the + * operator '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for case insensitive search. + * @param {String} [params.annotation] - Annotation filters. Example: age>30;gender=FEMALE. For more information, please visit + * http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + * @param {String} [params.acl] - Filter entries for which a user has the provided permissions. Format: acl={user}:{permissions}. + * Example: acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which user john has both WRITE and WRITE_ANNOTATIONS + * permissions. Only study owners or administrators can query by this field. . + * @param {"NOT_INDEXED INDEXED INVALID_PERMISSIONS INVALID_METADATA INVALID"} [params.internalRgaStatus] - Index status of the sample + * for the Recessive Gene Analysis. + * @param {String} [params.release] - Release when it was created. + * @param {Number} [params.snapshot] - Snapshot value (Latest version of the entry in the specified release). + * @param {Boolean} [params.deleted = "false"] - Boolean to retrieve deleted entries. The default value is false. + * @param {String} [params.statsId] - Sample variant stats Id. If this field is not provided and the user filters by other stats fields, + * it will automatically be set to ALL. + * @param {String} [params.statsVariantCount] - Sample variant stats VariantCount. + * @param {String} [params.statsChromosomeCount] - Sample variant stats ChromosomeCount. + * @param {String} [params.statsTypeCount] - Sample variant stats TypeCount. + * @param {String} [params.statsGenotypeCount] - Sample variant stats GenotypeCount. + * @param {String} [params.statsTiTvRatio] - Sample variant stats TiTvRatio. + * @param {String} [params.statsQualityAvg] - Sample variant stats QualityAvg. + * @param {String} [params.statsQualityStdDev] - Sample variant stats QualityStdDev. + * @param {String} [params.statsHeterozygosityRate] - Sample variant stats HeterozygosityRate. + * @param {String} [params.statsDepthCount] - Sample variant stats DepthCount. + * @param {String} [params.statsBiotypeCount] - Sample variant stats BiotypeCount. + * @param {String} [params.statsClinicalSignificanceCount] - Sample variant stats ClinicalSignificanceCount. + * @param {String} [params.statsConsequenceTypeCount] - Sample variant stats ConsequenceTypeCount. + * @param {String} [params.field] - Field to apply aggregation statistics to (or a list of fields separated by semicolons), e.g.: + * studies;type;numSamples[0..10]:1;format:sum(size). + * @returns {Promise} Promise object in the form of RestResponse instance. + */ + aggregationStats(params) { + return this._get("samples", null, null, null, "aggregationStats", params); + } + /** Load annotation sets from a TSV file * @param {Object} [data] - JSON containing the 'content' of the TSV file if this has not yet been registered into OpenCGA. * @param {String} variableSetId - Variable set ID or name. 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 b9dd0a007e..46cf3ac16e 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 @@ -39,6 +39,63 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='analysis', resource='update', subcategory='clinical/acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog clinical analysis aggregation stats. + PATH: /{apiVersion}/analysis/clinical/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list of Clinical Analysis IDs up to a + maximum of 100. Also admits basic regular expressions using the + operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + sensitive, '~/value/i' for case insensitive search. + :param str uuid: Comma separated list of Clinical Analysis UUIDs up to + a maximum of 100. + :param str type: Clinical Analysis type. + :param str disorder: Clinical Analysis disorder. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str files: Clinical Analysis files. + :param str sample: Sample associated to the proband or any member of a + family. + :param str individual: Proband or any member of a family. + :param str proband: Clinical Analysis proband. + :param str proband_samples: Clinical Analysis proband samples. + :param str family: Clinical Analysis family. + :param str family_members: Clinical Analysis family members. + :param str family_member_samples: Clinical Analysis family members + samples. + :param str panels: Clinical Analysis panels. + :param bool locked: Locked Clinical Analyses. + :param str analyst_id: Clinical Analysis analyst id. + :param str priority: Clinical Analysis priority. + :param str flags: Clinical Analysis flags. + :param str creation_date: Clinical Analysis Creation date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str modification_date: Clinical Analysis Modification date. + Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str due_date: Clinical Analysis due date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str quality_control_summary: Clinical Analysis quality control + summary. + :param str release: Release when it was created. + :param int snapshot: Snapshot value (Latest version of the entry in + the specified release). + :param str status: Filter by status. + :param str internal_status: Filter by internal status. + :param str annotation: Annotation filters. Example: + age>30;gender=FEMALE. For more information, please visit + http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + :param bool deleted: Boolean to retrieve deleted entries. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='analysis', resource='aggregationStats', subcategory='clinical', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. @@ -154,6 +211,44 @@ def distinct(self, field, **options): options['field'] = field return self._get(category='analysis', resource='distinct', subcategory='clinical', **options) + def aggregation_stats_interpretation(self, **options): + """ + Fetch catalog interpretation aggregation stats. + PATH: /{apiVersion}/analysis/clinical/interpretation/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list of Interpretation IDs up to a + maximum of 100. Also admits basic regular expressions using the + operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + sensitive, '~/value/i' for case insensitive search. + :param str uuid: Comma separated list of Interpretation UUIDs up to a + maximum of 100. + :param str name: Comma separated list of Interpretation names up to a + maximum of 100. + :param str clinical_analysis_id: Clinical Analysis id. + :param str analyst_id: Analyst ID. + :param str method_name: Interpretation method name. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str panels: Interpretation panels. + :param str primary_findings: Interpretation primary findings. + :param str secondary_findings: Interpretation secondary findings. + :param str creation_date: Interpretation Creation date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str modification_date: Interpretation Modification date. + Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str status: Filter by status. + :param str internal_status: Filter by internal status. + :param str release: Release when it was created. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='analysis', resource='aggregationStats', subcategory='clinical/interpretation', **options) + def distinct_interpretation(self, field, **options): """ Interpretation distinct method. 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 f38109debe..b591172302 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 @@ -37,6 +37,41 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='cohorts', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog cohort stats. + PATH: /{apiVersion}/cohorts/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list of cohort IDs up to a maximum of + 100. Also admits basic regular expressions using the operator '~', + i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' + for case insensitive search. + :param str name: Comma separated list of cohort names up to a maximum + of 100. Also admits basic regular expressions using the operator + '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, + '~/value/i' for case insensitive search. + :param str uuid: Comma separated list of cohort IDs up to a maximum of + 100. + :param str type: Cohort type. + :param str creation_date: creationDate. + :param str modification_date: modificationDate. + :param bool deleted: deleted. + :param str status: status. + :param str internal_status: internalStatus. + :param str annotation: Cohort annotation. + :param str acl: acl. + :param str samples: Cohort sample IDs. + :param str num_samples: Number of samples. + :param str release: release. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='cohorts', resource='aggregationStats', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. 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 8634c983e2..c1ce54f5ea 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 @@ -37,6 +37,71 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='panels', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog panel stats. + PATH: /{apiVersion}/panels/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list of panel IDs up to a maximum of + 100. Also admits basic regular expressions using the operator '~', + i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' + for case insensitive search. + :param str uuid: Comma separated list of panel UUIDs up to a maximum + of 100. + :param str name: Comma separated list of panel names up to a maximum + of 100. Also admits basic regular expressions using the operator + '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, + '~/value/i' for case insensitive search. + :param str internal_status: Filter by internal status. + :param str disorders: Comma separated list of disorder ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search.. Also admits basic regular expressions + using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + sensitive, '~/value/i' for case insensitive search. + :param str variants: Comma separated list of variant ids. Also admits + basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str genes: Comma separated list of gene ids. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str source: Comma separated list of source ids or names. + :param str regions: Comma separated list of regions. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str categories: Comma separated list of category names. Also + admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str tags: Panel tags. Also admits basic regular expressions + using the operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + sensitive, '~/value/i' for case insensitive search. + :param bool deleted: Boolean to retrieve deleted entries. + :param str status: Filter by status. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param str release: Release when it was created. + :param int snapshot: Snapshot value (Latest version of the entry in + the specified release). + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='panels', resource='aggregationStats', **options) + def create(self, data=None, **options): """ Create a panel. 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 278c306bfe..1c529e3ab5 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 @@ -40,6 +40,60 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='families', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog family stats. + PATH: /{apiVersion}/families/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list family IDs up to a maximum of 100. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str name: Comma separated list family names up to a maximum of + 100. Also admits basic regular expressions using the operator '~', + i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' + for case insensitive search. + :param str uuid: Comma separated list family UUIDs up to a maximum of + 100. + :param str members: Comma separated list of family members. + :param int expected_size: Expected size of the family (number of + members). + :param str samples: Comma separated list of member's samples. + :param str phenotypes: Comma separated list of phenotype ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str disorders: Comma separated list of disorder ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param bool deleted: Boolean to retrieve deleted entries. + :param str internal_status: Filter by internal status. + :param str status: Filter by status. + :param str annotation: Annotation filters. Example: + age>30;gender=FEMALE. For more information, please visit + http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param str release: Release when it was created. + :param int snapshot: Snapshot value (Latest version of the entry in + the specified release). + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='families', resource='aggregationStats', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. 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 505d21464b..bb9d0804e6 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 @@ -37,6 +37,74 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='files', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog file stats. + PATH: /{apiVersion}/files/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list of file IDs up to a maximum of + 100. Also admits basic regular expressions using the operator '~', + i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' + for case insensitive search. + :param str uuid: Comma separated list file UUIDs up to a maximum of + 100. + :param str name: Comma separated list of file names. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str path: Comma separated list of paths. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str uri: Comma separated list of uris. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str type: File type, either FILE or DIRECTORY. + :param str bioformat: Comma separated Bioformat values. For existing + Bioformats see files/bioformats. + :param str format: Comma separated Format values. For existing Formats + see files/formats. + :param bool external: Boolean field indicating whether to filter by + external or non external files. + :param str status: Filter by status. + :param str internal_status: Filter by internal status. + :param str internal_variant_index_status: Filter by internal variant + index status. + :param str software_name: Software name. + :param str directory: Directory under which we want to look for files + or folders. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str description: Description. + :param str tags: Tags. Also admits basic regular expressions using the + operator '~', i.e. '~{perl-regex}' e.g. '~value' for case + sensitive, '~/value/i' for case insensitive search. + :param str size: File size. + :param str sample_ids: Comma separated list sample IDs or UUIDs up to + a maximum of 100. + :param str job_id: Job ID that created the file(s) or folder(s). + :param str annotation: Annotation filters. Example: + age>30;gender=FEMALE. For more information, please visit + http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param bool deleted: Boolean to retrieve deleted entries. + :param str release: Release when it was created. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='files', resource='aggregationStats', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. 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 515ca12ca0..0db380c21b 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 @@ -41,6 +41,77 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='individuals', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog individual stats. + PATH: /{apiVersion}/individuals/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list individual IDs up to a maximum of + 100. Also admits basic regular expressions using the operator '~', + i.e. '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' + for case insensitive search. + :param str uuid: Comma separated list individual UUIDs up to a maximum + of 100. + :param str name: Comma separated list individual names up to a maximum + of 100. Also admits basic regular expressions using the operator + '~', i.e. '~{perl-regex}' e.g. '~value' for case sensitive, + '~/value/i' for case insensitive search. + :param str father: Father ID, name or UUID. + :param str mother: Mother ID, name or UUID. + :param str samples: Sample ID, name or UUID. + :param str family_ids: Comma separated list of family ids the + individuals may belong to. + :param str sex: Individual sex. + :param str date_of_birth: Individual date of birth. + :param str ethnicity: Individual ethnicity. Also admits basic regular + expressions using the operator '~', i.e. '~{perl-regex}' e.g. + '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str disorders: Comma separated list of disorder ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str phenotypes: Comma separated list of phenotype ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str population_name: Population name. Also admits basic regular + expressions using the operator '~', i.e. '~{perl-regex}' e.g. + '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str population_subpopulation: Subpopulation name. Also admits + basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str karyotypic_sex: Individual karyotypic sex. + :param str life_status: Individual life status. + :param str internal_status: Filter by internal status. + :param str status: Filter by status. + :param bool deleted: Boolean to retrieve deleted entries. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str annotation: Annotation filters. Example: + age>30;gender=FEMALE. For more information, please visit + http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param str release: Release when it was created. + :param int snapshot: Snapshot value (Latest version of the entry in + the specified release). + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='individuals', resource='aggregationStats', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. 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 c8425b16e6..92d93099ec 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 @@ -35,6 +35,53 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='jobs', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog job stats. + PATH: /{apiVersion}/jobs/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param bool other_studies: Flag indicating the entries being queried + can belong to any related study, not just the primary one. + :param str id: Comma separated list of job IDs up to a maximum of 100. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str uuid: Comma separated list of job UUIDs up to a maximum of + 100. + :param str tool_id: Tool ID executed by the job. Also admits basic + regular expressions using the operator '~', i.e. '~{perl-regex}' + e.g. '~value' for case sensitive, '~/value/i' for case insensitive + search. + :param str tool_type: Tool type executed by the job [OPERATION, + ANALYSIS]. + :param str user_id: User that created the job. + :param str priority: Priority of the job. + :param str status: Filter by status. + :param str internal_status: Filter by internal status. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param bool visited: Visited status of job. + :param str tags: Job tags. + :param str input: Comma separated list of file IDs used as input. + :param str output: Comma separated list of file IDs used as output. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param str release: Release when it was created. + :param bool deleted: Boolean to retrieve deleted entries. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='jobs', resource='aggregationStats', **options) + def create(self, data=None, **options): """ Register an executed job with POST method. 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 6b10aac717..f11c25af8f 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 @@ -39,6 +39,82 @@ def update_acl(self, members, action, data=None, **options): options['action'] = action return self._post(category='samples', resource='update', subcategory='acl', second_query_id=members, data=data, **options) + def aggregation_stats(self, **options): + """ + Fetch catalog sample stats. + PATH: /{apiVersion}/samples/aggregationStats + + :param str study: Study [[organization@]project:]study where study and + project can be either the ID or UUID. + :param str id: Comma separated list sample IDs up to a maximum of 100. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str uuid: Comma separated list sample UUIDs up to a maximum of + 100. + :param bool somatic: Somatic sample. + :param str individual_id: Individual ID or UUID. + :param str file_ids: Comma separated list of file IDs, paths or UUIDs. + :param str cohort_ids: Comma separated list of cohort IDs. + :param str creation_date: Creation date. Format: yyyyMMddHHmmss. + Examples: >2018, 2017-2018, <201805. + :param str modification_date: Modification date. Format: + yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805. + :param str internal_status: Filter by internal status. + :param str status: Filter by status. + :param str processing_product: Processing product. + :param str processing_preparation_method: Processing preparation + method. + :param str processing_extraction_method: Processing extraction method. + :param str processing_lab_sample_id: Processing lab sample id. + :param str collection_from: Collection from. + :param str collection_type: Collection type. + :param str collection_method: Collection method. + :param str phenotypes: Comma separated list of phenotype ids or names. + Also admits basic regular expressions using the operator '~', i.e. + '~{perl-regex}' e.g. '~value' for case sensitive, '~/value/i' for + case insensitive search. + :param str annotation: Annotation filters. Example: + age>30;gender=FEMALE. For more information, please visit + http://docs.opencb.org/display/opencga/AnnotationSets+1.4.0. + :param str acl: Filter entries for which a user has the provided + permissions. Format: acl={user}:{permissions}. Example: + acl=john:WRITE,WRITE_ANNOTATIONS will return all entries for which + user john has both WRITE and WRITE_ANNOTATIONS permissions. Only + study owners or administrators can query by this field. . + :param str internal_rga_status: Index status of the sample for the + Recessive Gene Analysis. Allowed values: ['NOT_INDEXED INDEXED + INVALID_PERMISSIONS INVALID_METADATA INVALID'] + :param str release: Release when it was created. + :param int snapshot: Snapshot value (Latest version of the entry in + the specified release). + :param bool deleted: Boolean to retrieve deleted entries. + :param str stats_id: Sample variant stats Id. If this field is not + provided and the user filters by other stats fields, it will + automatically be set to ALL. + :param str stats_variant_count: Sample variant stats VariantCount. + :param str stats_chromosome_count: Sample variant stats + ChromosomeCount. + :param str stats_type_count: Sample variant stats TypeCount. + :param str stats_genotype_count: Sample variant stats GenotypeCount. + :param str stats_ti_tv_ratio: Sample variant stats TiTvRatio. + :param str stats_quality_avg: Sample variant stats QualityAvg. + :param str stats_quality_std_dev: Sample variant stats QualityStdDev. + :param str stats_heterozygosity_rate: Sample variant stats + HeterozygosityRate. + :param str stats_depth_count: Sample variant stats DepthCount. + :param str stats_biotype_count: Sample variant stats BiotypeCount. + :param str stats_clinical_significance_count: Sample variant stats + ClinicalSignificanceCount. + :param str stats_consequence_type_count: Sample variant stats + ConsequenceTypeCount. + :param str field: Field to apply aggregation statistics to (or a list + of fields separated by semicolons), e.g.: + studies;type;numSamples[0..10]:1;format:sum(size). + """ + + return self._get(category='samples', resource='aggregationStats', **options) + def load_annotation_sets(self, variable_set_id, path, data=None, **options): """ Load annotation sets from a TSV file. 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 765a1c5cf2..67f713e0d4 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 @@ -29,6 +29,9 @@ public class ParamConstants { public static final String LIMIT_DESCRIPTION = "Number of results to be returned"; public static final String SKIP_DESCRIPTION = "Number of results to skip"; public static final String COUNT_DESCRIPTION = "Get the total number of results matching the query. Deactivated by default."; + public static final String FACET_PARAM = "field"; + public static final String FACET_DESCRIPTION = "Field to apply aggregation statistics to (or a list of fields separated by semicolons)" + + ", e.g.: studies;type;numSamples[0..10]:1;format:sum(size)"; public static final String CREATION_DATE_DESCRIPTION = "Creation date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, <201805"; public static final String CREATION_DATE_PARAM = "creationDate"; public static final String MODIFICATION_DATE_DESCRIPTION = "Modification date. Format: yyyyMMddHHmmss. Examples: >2018, 2017-2018, " + @@ -493,7 +496,7 @@ public class ParamConstants { public static final String INTERPRETATION_CREATION_DATE_DESCRIPTION = "Interpretation " + CREATION_DATE_DESCRIPTION; public static final String INCLUDE_INTERPRETATION = "includeInterpretation"; public static final String INCLUDE_INTERPRETATION_DESCRIPTION = "Interpretation ID to include the fields related to this" - + " interpretation"; + + " interpretation"; // --------------------------------------------- public static final String INTERPRETATION_MODIFICATION_DATE_DESCRIPTION = "Interpretation " + MODIFICATION_DATE_DESCRIPTION; public static final String INTERPRETATION_STATUS_DESCRIPTION = STATUS_DESCRIPTION; @@ -833,7 +836,7 @@ public class ParamConstants { public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_ID = "The body web service id parameter"; public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_NAME = "The body web service name parameter"; public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_CATEGORY = "The body web service category parameter"; -// public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_TYPE = "The body web service type parameter"; + // public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_TYPE = "The body web service type parameter"; public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_DEFAULTVALUE = "The body web service defaultValue parameter"; public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_REQUIRED = "The body web service required parameter"; public static final String STUDIES_VARIABLESET_VARIABLES_UPDATE_MULTIVALUE = "The body web service multiValue parameter"; @@ -859,7 +862,7 @@ public class ParamConstants { public static final String FILES_UPDATE_MODIFICATIONDATE = "The body web service modificationDate parameter"; public static final String FILES_UPDATE_SAMPLEIDS = "The body web service sampleIds parameter"; public static final String FILES_UPDATE_CHECKSUM = "The body web service checksum parameter"; -// public static final String FILES_UPDATE_FORMAT = "The body web service format parameter"; + // public static final String FILES_UPDATE_FORMAT = "The body web service format parameter"; // public static final String FILES_UPDATE_BIOFORMAT = "The body web service bioformat parameter"; public static final String FILES_UPDATE_SOFTWARE = "The body web service software parameter"; public static final String FILES_UPDATE_EXPERIMENT = "The body web service experiment parameter"; @@ -1013,7 +1016,7 @@ public class ParamConstants { public static final String FAMILIES_CREATE_ATTRIBUTES = "The body web service attributes parameter"; public static final String FAMILIES_CREATE_ANNOTATIONSETS = "The body web service annotationSets parameter"; public static final String COHORTS_UPDATE_ID = "The body web service id parameter"; -// public static final String COHORTS_UPDATE_TYPE = "The body web service type parameter"; + // public static final String COHORTS_UPDATE_TYPE = "The body web service type parameter"; public static final String COHORTS_UPDATE_DESCRIPTION = "The body web service description parameter"; public static final String COHORTS_UPDATE_CREATIONDATE = "The body web service creationDate parameter"; public static final String COHORTS_UPDATE_MODIFICATIONDATE = "The body web service modificationDate parameter"; @@ -1024,7 +1027,7 @@ public class ParamConstants { public static final String COHORTS_ANNOTATIONSETS_LOAD_CONTENT = "The body web service content parameter"; public static final String COHORTS_UPDATE_COHORT = "The body web service cohort parameter"; public static final String COHORTS_CREATE_ID = "The body web service id parameter"; -// public static final String COHORTS_CREATE_TYPE = "The body web service type parameter"; + // public static final String COHORTS_CREATE_TYPE = "The body web service type parameter"; public static final String COHORTS_CREATE_DESCRIPTION = "The body web service description parameter"; public static final String COHORTS_CREATE_CREATIONDATE = "The body web service creationDate parameter"; public static final String COHORTS_CREATE_MODIFICATIONDATE = "The body web service modificationDate parameter"; @@ -1033,7 +1036,7 @@ public class ParamConstants { public static final String COHORTS_CREATE_ATTRIBUTES = "The body web service attributes parameter"; public static final String COHORTS_CREATE_STATUS = "The body web service status parameter"; public static final String COHORTS_GENERATE_ID = "The body web service id parameter"; -// public static final String COHORTS_GENERATE_TYPE = "The body web service type parameter"; + // public static final String COHORTS_GENERATE_TYPE = "The body web service type parameter"; public static final String COHORTS_GENERATE_DESCRIPTION = "The body web service description parameter"; public static final String COHORTS_GENERATE_CREATIONDATE = "The body web service creationDate parameter"; public static final String COHORTS_GENERATE_MODIFICATIONDATE = "The body web service modificationDate parameter"; @@ -1259,7 +1262,7 @@ public class ParamConstants { public static final String ANALYSIS_VARIANT_CIRCOS_RUN_OUTDIR = "The body web service outdir parameter"; public static final String ANALYSIS_CLINICAL_UPDATE_ID = "The body web service id parameter"; public static final String ANALYSIS_CLINICAL_UPDATE_DESCRIPTION = "The body web service description parameter"; -// public static final String ANALYSIS_CLINICAL_UPDATE_TYPE = "The body web service type parameter"; + // public static final String ANALYSIS_CLINICAL_UPDATE_TYPE = "The body web service type parameter"; public static final String ANALYSIS_CLINICAL_UPDATE_DISORDER = "The body web service disorder parameter"; public static final String ANALYSIS_CLINICAL_UPDATE_FILES = "The body web service files parameter"; public static final String ANALYSIS_CLINICAL_UPDATE_PANELS = "The body web service panels parameter"; @@ -1294,7 +1297,7 @@ public class ParamConstants { public static final String ANALYSIS_CLINICAL_INTERPRETATION_CREATE_ATTRIBUTES = "The body web service attributes parameter"; public static final String ANALYSIS_CLINICAL_CREATE_ID = "The body web service id parameter"; public static final String ANALYSIS_CLINICAL_CREATE_DESCRIPTION = "The body web service description parameter"; -// public static final String ANALYSIS_CLINICAL_CREATE_TYPE = "The body web service type parameter"; + // public static final String ANALYSIS_CLINICAL_CREATE_TYPE = "The body web service type parameter"; public static final String ANALYSIS_CLINICAL_CREATE_DISORDER = "The body web service disorder parameter"; public static final String ANALYSIS_CLINICAL_CREATE_FILES = "The body web service files parameter"; public static final String ANALYSIS_CLINICAL_CREATE_PROBAND = "The body web service proband parameter"; @@ -1480,13 +1483,13 @@ public class ParamConstants { public static final String OPERATIONS_VARIANT_STORAGE_VARIANT_SAMPLE_INDEX_BUILDINDEX = "The body web service buildIndex parameter"; public static final String OPERATIONS_VARIANT_STORAGE_VARIANT_SAMPLE_INDEX_ANNOTATE = "The body web service annotate parameter"; public static final String OPERATIONS_VARIANT_STORAGE_VARIANT_SAMPLE_INDEX_OVERWRITE = "The body web service overwrite parameter"; -// public static final String ADMIN_USERS_CREATE_TYPE = "The body web service type parameter"; + // public static final String ADMIN_USERS_CREATE_TYPE = "The body web service type parameter"; public static final String ADMIN_USERS_SYNC_AUTHENTICATIONORIGINID = "The body web service authenticationOriginId parameter"; public static final String ADMIN_USERS_SYNC_FROM = "The body web service from parameter"; public static final String ADMIN_USERS_SYNC_TO = "The body web service to parameter"; public static final String ADMIN_USERS_SYNC_STUDY = "The body web service study parameter"; public static final String ADMIN_USERS_SYNC_SYNCALL = "The body web service syncAll parameter"; -// public static final String ADMIN_USERS_SYNC_TYPE = "The body web service type parameter"; + // public static final String ADMIN_USERS_SYNC_TYPE = "The body web service type parameter"; public static final String ADMIN_USERS_SYNC_FORCE = "The body web service force parameter"; public static final String ADMIN_USERS_IMPORT_AUTHENTICATIONORIGINID = "The body web service authenticationOriginId parameter"; public static final String ADMIN_USERS_IMPORT_ID = "The body web service id parameter"; diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/CohortWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/CohortWSServer.java index e64e01e9ad..3641096c04 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/CohortWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/CohortWSServer.java @@ -394,36 +394,33 @@ public Response updateAcl( } } -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog cohort stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) -// @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Type") @QueryParam("type") String type, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Number of samples") @QueryParam("numSamples") String numSamples, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, -// -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getCohortManager().facet(studyStr, query, queryOptions, defaultStats, -// token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog cohort stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.COHORT_IDS_DESCRIPTION) @QueryParam(ParamConstants.COHORT_ID_PARAM) String id, + @ApiParam(value = ParamConstants.COHORT_NAMES_DESCRIPTION) @QueryParam(ParamConstants.COHORT_NAME_PARAM) String name, + @ApiParam(value = ParamConstants.COHORT_UUIDS_DESCRIPTION) @QueryParam(ParamConstants.COHORT_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.COHORT_TYPE_DESCRIPTION) @QueryParam(ParamConstants.COHORT_TYPE_PARAM) String type, + @ApiParam(value = ParamConstants.COHORT_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.COHORT_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.COHORT_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.COHORT_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.COHORT_DELETED_DESCRIPTION) @QueryParam(ParamConstants.COHORT_DELETED_PARAM) boolean deleted, + @ApiParam(value = ParamConstants.COHORT_STATUS_DESCRIPTION) @QueryParam(ParamConstants.COHORT_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.COHORT_INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.COHORT_INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.COHORT_ANNOTATION_DESCRIPTION) @QueryParam(ParamConstants.COHORT_ANNOTATION_PARAM) String annotation, + @ApiParam(value = ParamConstants.COHORT_ACL_DESCRIPTION) @QueryParam(ParamConstants.COHORT_ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.COHORT_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.COHORT_SAMPLES_PARAM) String samplesStr, + @ApiParam(value = ParamConstants.COHORT_NUMBER_OF_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.COHORT_NUMBER_OF_SAMPLES_PARAM) String numSamples, + @ApiParam(value = ParamConstants.COHORT_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.COHORT_RELEASE_PARAM) String release, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getCohortManager().facet(studyStr, query, facet, token); + }); + } } diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/FamilyWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/FamilyWSServer.java index 38be27971c..7455762fa2 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/FamilyWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/FamilyWSServer.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.opencb.commons.datastore.core.DataResult; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.family.FamilyTsvAnnotationLoader; @@ -350,38 +351,35 @@ public Response updateAcl( } } -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog family stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) -// @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Phenotypes") @QueryParam("phenotypes") String phenotypes, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = "Version") @QueryParam("version") String version, -// @ApiParam(value = "Number of members") @QueryParam("numMembers") String numMembers, -// @ApiParam(value = "Expected size") @QueryParam("expectedSize") String expectedSize, -// @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, -// -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getFamilyManager().facet(studyStr, query, queryOptions, defaultStats, -// token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog family stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.FAMILY_ID_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_ID_PARAM) String id, + @ApiParam(value = ParamConstants.FAMILY_NAME_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_NAME_PARAM) String name, + @ApiParam(value = ParamConstants.FAMILY_UUID_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.FAMILY_MEMBERS_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_MEMBERS_PARAM) String members, + @ApiParam(value = ParamConstants.FAMILY_EXPECTED_SIZE_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_EXPECTED_SIZE_PARAM) Integer expectedSize, + @ApiParam(value = ParamConstants.FAMILY_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_SAMPLES_PARAM) String samples, + @ApiParam(value = ParamConstants.FAMILY_PHENOTYPES_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_PHENOTYPES_PARAM) String phenotypes, + @ApiParam(value = ParamConstants.FAMILY_DISORDERS_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_DISORDERS_PARAM) String disorders, + @ApiParam(value = ParamConstants.FAMILY_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.FAMILY_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.FAMILY_DELETED_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.FAMILY_DELETED_PARAM) boolean deleted, + @ApiParam(value = ParamConstants.FAMILY_INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.FAMILY_STATUS_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.FAMILY_ANNOTATION_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_ANNOTATION_PARAM) String annotation, + @ApiParam(value = ParamConstants.FAMILY_ACL_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.FAMILY_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.FAMILY_SNAPSHOT_DESCRIPTION) @QueryParam(ParamConstants.FAMILY_SNAPSHOT_PARAM) Integer snapshot, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getFamilyManager().facet(studyStr, query, facet, token); + }); + } } diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/FileWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/FileWSServer.java index 01be67e5a1..74d0cdf4c7 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/FileWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/FileWSServer.java @@ -1024,44 +1024,43 @@ public Response updateAcl( // } // } -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog file stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) -// @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Name") @QueryParam("name") String name, -// @ApiParam(value = "Type") @QueryParam("type") String type, -// @ApiParam(value = "Format") @QueryParam("format") String format, -// @ApiParam(value = "Bioformat") @QueryParam("bioformat") String bioformat, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = "External") @QueryParam("external") Boolean external, -// @ApiParam(value = "Size") @QueryParam("size") String size, -// @ApiParam(value = "Software") @QueryParam("software") String software, -// @ApiParam(value = "Experiment") @QueryParam("experiment") String experiment, -// @ApiParam(value = "Number of samples") @QueryParam("numSamples") String numSamples, -// @ApiParam(value = "Number of related files") @QueryParam("numRelatedFiles") String numRelatedFiles, -// @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, -// -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: " + -// "studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getFileManager().facet(studyStr, query, queryOptions, defaultStats, token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog file stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.FILES_ID_DESCRIPTION) @QueryParam("id") String id, + @ApiParam(value = ParamConstants.FILES_UUID_DESCRIPTION) @QueryParam("uuid") String uuid, + @ApiParam(value = ParamConstants.FILE_NAMES_DESCRIPTION) @QueryParam("name") String name, + @ApiParam(value = ParamConstants.FILE_PATHS_DESCRIPTION) @QueryParam("path") String path, + @ApiParam(value = ParamConstants.FILE_URIS_DESCRIPTION) @QueryParam("uri") String uri, + @ApiParam(value = ParamConstants.FILE_TYPE_DESCRIPTION) @QueryParam("type") String type, + @ApiParam(value = ParamConstants.FILE_BIOFORMAT_DESCRIPTION) @QueryParam("bioformat") String bioformat, + @ApiParam(value = ParamConstants.FILE_FORMAT_DESCRIPTION) @QueryParam("format") String formats, + @ApiParam(value = ParamConstants.FILE_EXTERNAL_DESCRIPTION) @QueryParam("external") Boolean external, + @ApiParam(value = ParamConstants.STATUS_DESCRIPTION) @QueryParam(ParamConstants.STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.INTERNAL_VARIANT_INDEX_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERNAL_VARIANT_INDEX_STATUS_PARAM) String internalVariantIndexStatus, + @ApiParam(value = ParamConstants.FILE_SOFTWARE_NAME_DESCRIPTION) @QueryParam(ParamConstants.FILE_SOFTWARE_NAME_PARAM) String softwareName, + @ApiParam(value = ParamConstants.FILE_DIRECTORY_DESCRIPTION) @QueryParam("directory") String directory, + @ApiParam(value = ParamConstants.CREATION_DATE_DESCRIPTION) @QueryParam("creationDate") String creationDate, + @ApiParam(value = ParamConstants.MODIFICATION_DATE_DESCRIPTION) @QueryParam("modificationDate") String modificationDate, + @ApiParam(value = ParamConstants.FILE_DESCRIPTION_DESCRIPTION) @QueryParam("description") String description, + @ApiParam(value = ParamConstants.FILE_TAGS_DESCRIPTION) @QueryParam("tags") String tags, + @ApiParam(value = ParamConstants.FILE_SIZE_DESCRIPTION) @QueryParam("size") String size, + @ApiParam(value = ParamConstants.SAMPLES_DESCRIPTION) @QueryParam("sampleIds") String samples, + @ApiParam(value = ParamConstants.FILE_JOB_ID_DESCRIPTION) @QueryParam("jobId") String jobId, + @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, + @ApiParam(value = ParamConstants.ACL_DESCRIPTION) @QueryParam(ParamConstants.ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.DELETED_DESCRIPTION, defaultValue = "false") @QueryParam("deleted") boolean deleted, + @ApiParam(value = ParamConstants.RELEASE_DESCRIPTION) @QueryParam("release") String release, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getFileManager().facet(studyStr, query, facet, token); + }); + } } diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/IndividualWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/IndividualWSServer.java index 089e671937..f710d73113 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/IndividualWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/IndividualWSServer.java @@ -19,6 +19,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.opencb.commons.datastore.core.DataResult; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.individual.IndividualTsvAnnotationLoader; @@ -438,45 +439,43 @@ public Response updateAcl( } } -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog individual stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) -// @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Has father") @QueryParam("hasFather") Boolean hasFather, -// @ApiParam(value = "Has mother") @QueryParam("hasMother") Boolean hasMother, -// @ApiParam(value = "Sex") @QueryParam("sex") String sex, -// @ApiParam(value = "Karyotypic sex") @QueryParam("karyotypicSex") String karyotypicSex, -// @ApiParam(value = "Ethnicity") @QueryParam("ethnicity") String ethnicity, -// @ApiParam(value = "Population") @QueryParam("population") String population, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Life status") @QueryParam("lifeStatus") String lifeStatus, -// @ApiParam(value = "Phenotypes") @QueryParam("phenotypes") String phenotypes, -// @ApiParam(value = "Number of samples") @QueryParam("numSamples") String numSamples, -// @ApiParam(value = "Parental consanguinity") @QueryParam("parentalConsanguinity") Boolean parentalConsanguinity, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = "Version") @QueryParam("version") String version, -// @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, -// -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getIndividualManager().facet(studyStr, query, queryOptions, defaultStats, -// token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog individual stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.INDIVIDUALS_ID_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_ID_PARAM) String id, + @ApiParam(value = ParamConstants.INDIVIDUAL_UUID_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.INDIVIDUAL_NAME_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_NAME_PARAM) String name, + @ApiParam(value = ParamConstants.INDIVIDUAL_FATHER_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_FATHER_PARAM) String father, + @ApiParam(value = ParamConstants.INDIVIDUAL_MOTHER_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_MOTHER_PARAM) String mother, + @ApiParam(value = ParamConstants.INDIVIDUAL_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_SAMPLES_PARAM) String samples, + @ApiParam(value = ParamConstants.INDIVIDUAL_FAMILY_IDS_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_FAMILY_IDS_PARAM) String familyIds, + @ApiParam(value = ParamConstants.INDIVIDUAL_SEX_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_SEX_PARAM) String sex, + @ApiParam(value = ParamConstants.INDIVIDUAL_DATE_OF_BIRTH_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_DATE_OF_BIRTH_PARAM) String dateOfBirth, + @ApiParam(value = ParamConstants.INDIVIDUAL_ETHNICITY_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_ETHNICITY_PARAM) String ethnicity, + @ApiParam(value = ParamConstants.INDIVIDUAL_DISORDERS_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_DISORDERS_PARAM) String disorders, + @ApiParam(value = ParamConstants.INDIVIDUAL_PHENOTYPES_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_PHENOTYPES_PARAM) String phenotypes, + @ApiParam(value = ParamConstants.INDIVIDUAL_POPULATION_NAME_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_POPULATION_NAME_PARAM) String populationName, + @ApiParam(value = ParamConstants.INDIVIDUAL_POPULATION_SUBPOPULATION_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_POPULATION_SUBPOPULATION_PARAM) String populationSubpopulation, + @ApiParam(value = ParamConstants.INDIVIDUAL_KARYOTYPIC_SEX_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_KARYOTYPIC_SEX_PARAM) String karyotypicSex, + @ApiParam(value = ParamConstants.INDIVIDUAL_LIFE_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_LIFE_STATUS_PARAM) String lifeStatus, + @ApiParam(value = ParamConstants.INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.STATUS_DESCRIPTION) @QueryParam(ParamConstants.STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.INDIVIDUAL_DELETED_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.INDIVIDUAL_DELETED_PARAM) boolean deleted, + @ApiParam(value = ParamConstants.INDIVIDUAL_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.INDIVIDUAL_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam(Constants.ANNOTATION) String annotation, + @ApiParam(value = ParamConstants.ACL_DESCRIPTION) @QueryParam(ParamConstants.ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.INDIVIDUAL_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.INDIVIDUAL_SNAPSHOT_DESCRIPTION) @QueryParam(ParamConstants.INDIVIDUAL_SNAPSHOT_PARAM) int snapshot, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getIndividualManager().facet(studyStr, query, facet, token); + }); + } } diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/JobWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/JobWSServer.java index 536d692099..dfd0c0d2b5 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/JobWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/JobWSServer.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.Query; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.catalog.db.api.JobDBAdaptor; @@ -365,40 +366,36 @@ public Response updateAcl( } } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog job stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.OTHER_STUDIES_FLAG_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.OTHER_STUDIES_FLAG) boolean others, + @ApiParam(value = ParamConstants.JOB_IDS_DESCRIPTION) @QueryParam(ParamConstants.JOB_ID_PARAM) String id, + @ApiParam(value = ParamConstants.JOB_UUIDS_DESCRIPTION) @QueryParam(ParamConstants.JOB_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.JOB_TOOL_ID_DESCRIPTION) @QueryParam(ParamConstants.JOB_TOOL_ID_PARAM) String toolId, + @ApiParam(value = ParamConstants.JOB_TOOL_TYPE_DESCRIPTION) @QueryParam(ParamConstants.JOB_TOOL_TYPE_PARAM) String toolType, + @ApiParam(value = ParamConstants.JOB_USER_DESCRIPTION) @QueryParam(ParamConstants.JOB_USER_PARAM) String user, + @ApiParam(value = ParamConstants.JOB_PRIORITY_DESCRIPTION) @QueryParam(ParamConstants.JOB_PRIORITY_PARAM) String priority, + @ApiParam(value = ParamConstants.JOB_STATUS_DESCRIPTION) @QueryParam(ParamConstants.JOB_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.JOB_INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.JOB_INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.JOB_VISITED_DESCRIPTION) @DefaultValue("") @QueryParam(ParamConstants.JOB_VISITED_PARAM) Boolean visited, + @ApiParam(value = ParamConstants.JOB_TAGS_DESCRIPTION) @QueryParam(ParamConstants.JOB_TAGS_PARAM) String tags, + @ApiParam(value = ParamConstants.JOB_INPUT_FILES_DESCRIPTION) @QueryParam(ParamConstants.JOB_INPUT_FILES_PARAM) String input, + @ApiParam(value = ParamConstants.JOB_OUTPUT_FILES_DESCRIPTION) @QueryParam(ParamConstants.JOB_OUTPUT_FILES_PARAM) String output, + @ApiParam(value = ParamConstants.ACL_DESCRIPTION) @QueryParam(ParamConstants.ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.RELEASE_DESCRIPTION) @QueryParam(ParamConstants.RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.DELETED_DESCRIPTION, defaultValue = "false") @QueryParam("deleted") boolean deleted, -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog job stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Tool id") @QueryParam("toolId") String toolId, -// @ApiParam(value = "Tool scope") @QueryParam("toolScope") String toolScope, -// @ApiParam(value = "Tool type") @QueryParam("toolType") String toolType, -// @ApiParam(value = "Tool resource") @QueryParam("toolResource") String toolResource, -// @ApiParam(value = "User id") @QueryParam("userId") String userId, -// @ApiParam(value = "Priority") @QueryParam("priority") String priority, -// @ApiParam(value = "Tags") @QueryParam("tags") String tags, -// @ApiParam(value = "Executor id") @QueryParam("executorId") String executorId, -// @ApiParam(value = "Executor framework") @QueryParam("executorFramework") String executorFramework, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getJobManager().facet(studyStr, query, queryOptions, defaultStats, -// token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getJobManager().facet(studyStr, query, facet, token); + }); + } } \ No newline at end of file diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/PanelWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/PanelWSServer.java index 7d36dec438..0c9955d134 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/PanelWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/PanelWSServer.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.opencb.commons.datastore.core.DataResult; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.panel.PanelImportTask; import org.opencb.opencga.catalog.managers.PanelManager; @@ -36,6 +37,7 @@ import java.io.IOException; import java.util.List; +import static org.opencb.opencga.core.api.ParamConstants.FACET_PARAM; import static org.opencb.opencga.core.api.ParamConstants.JOB_DEPENDS_ON; @Path("/{apiVersion}/panels") @@ -291,4 +293,38 @@ public Response updateAcl( } } + // TODO: Add panel fields to aggregation stats + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog panel stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.PANEL_ID_DESCRIPTION) @QueryParam(ParamConstants.PANEL_ID_PARAM) String id, + @ApiParam(value = ParamConstants.PANEL_UUID_DESCRIPTION) @QueryParam(ParamConstants.PANEL_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.PANEL_NAME_DESCRIPTION) @QueryParam(ParamConstants.PANEL_NAME_PARAM) String name, + @ApiParam(value = ParamConstants.INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.PANEL_DISORDERS_DESCRIPTION) @QueryParam(ParamConstants.PANEL_DISORDERS_PARAM) String disorders, + @ApiParam(value = ParamConstants.PANEL_VARIANTS_DESCRIPTION) @QueryParam(ParamConstants.PANEL_VARIANTS_PARAM) String variants, + @ApiParam(value = ParamConstants.PANEL_GENES_DESCRIPTION) @QueryParam(ParamConstants.PANEL_GENES_PARAM) String genes, + @ApiParam(value = ParamConstants.PANEL_SOURCE_DESCRIPTION) @QueryParam(ParamConstants.PANEL_SOURCE_PARAM) String source, + @ApiParam(value = ParamConstants.PANEL_REGIONS_DESCRIPTION) @QueryParam(ParamConstants.PANEL_REGIONS_PARAM) String regions, + @ApiParam(value = ParamConstants.PANEL_CATEGORIES_DESCRIPTION) @QueryParam(ParamConstants.PANEL_CATEGORIES_PARAM) String categories, + @ApiParam(value = ParamConstants.PANEL_TAGS_DESCRIPTION) @QueryParam(ParamConstants.PANEL_TAGS_PARAM) String tags, + @ApiParam(value = ParamConstants.PANEL_DELETED_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.PANEL_DELETED_PARAM) boolean deleted, + @ApiParam(value = ParamConstants.PANEL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.PANEL_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.PANEL_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.PANEL_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.PANEL_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.PANEL_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.PANEL_ACL_DESCRIPTION) @QueryParam(ParamConstants.PANEL_ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.PANEL_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.PANEL_RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.PANEL_SNAPSHOT_DESCRIPTION) @QueryParam(ParamConstants.PANEL_SNAPSHOT_PARAM) int snapshot, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(FACET_PARAM); + return catalogManager.getPanelManager().facet(studyStr, query, facet, token); + }); + } + } diff --git a/opencga-server/src/main/java/org/opencb/opencga/server/rest/SampleWSServer.java b/opencga-server/src/main/java/org/opencb/opencga/server/rest/SampleWSServer.java index 0a329811db..efdde9a4f8 100644 --- a/opencga-server/src/main/java/org/opencb/opencga/server/rest/SampleWSServer.java +++ b/opencga-server/src/main/java/org/opencb/opencga/server/rest/SampleWSServer.java @@ -19,6 +19,7 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.opencb.commons.datastore.core.DataResult; +import org.opencb.commons.datastore.core.FacetField; import org.opencb.commons.datastore.core.ObjectMap; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.opencga.analysis.sample.SampleTsvAnnotationLoader; @@ -444,39 +445,57 @@ public Response updateAcl( } } -// @GET -// @Path("/aggregationStats") -// @ApiOperation(value = "Fetch catalog sample stats", response = FacetField.class) -// public Response getAggregationStats( -// @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, -// @ApiParam(value = "Source") @QueryParam("source") String source, -// @ApiParam(value = "Creation year") @QueryParam("creationYear") String creationYear, -// @ApiParam(value = "Creation month (JANUARY, FEBRUARY...)") @QueryParam("creationMonth") String creationMonth, -// @ApiParam(value = "Creation day") @QueryParam("creationDay") String creationDay, -// @ApiParam(value = "Creation day of week (MONDAY, TUESDAY...)") @QueryParam("creationDayOfWeek") String creationDayOfWeek, -// @ApiParam(value = "Status") @QueryParam("status") String status, -// @ApiParam(value = "Type") @QueryParam("type") String type, -// @ApiParam(value = "Phenotypes") @QueryParam("phenotypes") String phenotypes, -// @ApiParam(value = "Release") @QueryParam("release") String release, -// @ApiParam(value = "Version") @QueryParam("version") String version, -// @ApiParam(value = "Somatic") @QueryParam("somatic") Boolean somatic, -// @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam("annotation") String annotation, -// -// @ApiParam(value = "Calculate default stats", defaultValue = "false") @QueryParam("default") boolean defaultStats, -// -// @ApiParam(value = "List of fields separated by semicolons, e.g.: studies;type. For nested fields use >>, e.g.: " + -// "studies>>biotype;type;numSamples[0..10]:1") @QueryParam("field") String facet) { -// try { -// query.remove(ParamConstants.STUDY_PARAM); -// query.remove("field"); -// -// queryOptions.put(QueryOptions.FACET, facet); -// -// DataResult queryResult = catalogManager.getSampleManager().facet(studyStr, query, queryOptions, defaultStats, -// token); -// return createOkResponse(queryResult); -// } catch (Exception e) { -// return createErrorResponse(e); -// } -// } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog sample stats", response = FacetField.class) + public Response getAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.SAMPLES_ID_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_ID_PARAM) String id, + @ApiParam(value = ParamConstants.SAMPLES_UUID_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.SAMPLE_SOMATIC_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_SOMATIC_PARAM) Boolean somatic, + @ApiParam(value = ParamConstants.SAMPLE_INDIVIDUAL_ID_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_INDIVIDUAL_ID_PARAM) String individual, + @ApiParam(value = ParamConstants.SAMPLE_FILE_IDS_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_FILE_IDS_PARAM) String fileIds, + @ApiParam(value = ParamConstants.SAMPLE_COHORT_IDS_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_COHORT_IDS_PARAM) String cohortIds, + @ApiParam(value = ParamConstants.CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.STATUS_DESCRIPTION) @QueryParam(ParamConstants.STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.SAMPLE_PROCESSING_PRODUCT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_PROCESSING_PRODUCT_PARAM) String product, + @ApiParam(value = ParamConstants.SAMPLE_PROCESSING_PREPARATION_METHOD_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_PROCESSING_PREPARATION_METHOD_PARAM) String preparationMethod, + @ApiParam(value = ParamConstants.SAMPLE_PROCESSING_EXTRACTION_METHOD_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_PROCESSING_EXTRACTION_METHOD_PARAM) String extractionMethod, + @ApiParam(value = ParamConstants.SAMPLE_PROCESSING_LAB_SAMPLE_ID_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_PROCESSING_LAB_SAMPLE_ID_PARAM) String labSampleId, + @ApiParam(value = ParamConstants.SAMPLE_COLLECTION_FROM_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_COLLECTION_FROM_PARAM) String from, + @ApiParam(value = ParamConstants.SAMPLE_COLLECTION_TYPE_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_COLLECTION_TYPE_PARAM) String type, + @ApiParam(value = ParamConstants.SAMPLE_COLLECTION_METHOD_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_COLLECTION_METHOD_PARAM) String method, + @ApiParam(value = ParamConstants.PHENOTYPES_DESCRIPTION) @QueryParam(ParamConstants.PHENOTYPES_PARAM) String phenotypes, + @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam(Constants.ANNOTATION) String annotation, + @ApiParam(value = ParamConstants.ACL_DESCRIPTION) @QueryParam(ParamConstants.ACL_PARAM) String acl, + @ApiParam(value = ParamConstants.SAMPLE_RGA_STATUS_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_RGA_STATUS_PARAM) RgaIndex.Status rgaStatus, + @ApiParam(value = ParamConstants.RELEASE_DESCRIPTION) @QueryParam(ParamConstants.RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.SNAPSHOT_DESCRIPTION) @QueryParam(ParamConstants.SNAPSHOT_PARAM) int snapshot, + @ApiParam(value = ParamConstants.DELETED_DESCRIPTION, defaultValue = "false") @QueryParam(ParamConstants.DELETED_PARAM) boolean deleted, + + // Variants stats query params + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_ID_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_ID_PARAM) String statsId, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_COUNT_PARAM) String variantCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_CHROMOSOME_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_CHROMOSOME_COUNT_PARAM) String chromosomeCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_TYPE_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_TYPE_COUNT_PARAM) String typeCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_GENOTYPE_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_GENOTYPE_COUNT_PARAM) String genotypeCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_TI_TV_RATIO_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_TI_TV_RATIO_PARAM) String tiTvRatio, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_QUALITY_AVG_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_QUALITY_AVG_PARAM) String qualityAvg, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_QUALITY_STD_DEV_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_QUALITY_STD_DEV_PARAM) String qualityStdDev, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_HETEROZYGOSITY_RATE_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_HETEROZYGOSITY_RATE_PARAM) String heterozygosityRate, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_DEPTH_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_DEPTH_COUNT_PARAM) String depthCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_BIOTYPE_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_BIOTYPE_COUNT_PARAM) String biotypeCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_CLINICAL_SIGNIFICANCE_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_CLINICAL_SIGNIFICANCE_COUNT_PARAM) String clinicalSignificanceCount, + @ApiParam(value = ParamConstants.SAMPLE_VARIANT_STATS_CONSEQUENCE_TYPE_COUNT_DESCRIPTION) @QueryParam(ParamConstants.SAMPLE_VARIANT_STATS_CONSEQUENCE_TYPE_COUNT_PARAM) String consequenceTypeCount, + + // Facet field + @ApiParam(value = ParamConstants.FACET_DESCRIPTION) @QueryParam(ParamConstants.FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove(ParamConstants.FACET_PARAM); + return catalogManager.getSampleManager().facet(studyStr, query, facet, token); + }); + } } 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 ef46a69aab..9b07b97b09 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 @@ -61,9 +61,8 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicReference; +import static org.opencb.opencga.core.api.ParamConstants.*; import static org.opencb.opencga.core.models.variant.VariantQueryParams.SAVED_FILTER_DESCR; -import static org.opencb.opencga.core.api.ParamConstants.INCLUDE_INTERPRETATION; -import static org.opencb.opencga.core.api.ParamConstants.JOB_DEPENDS_ON; import static org.opencb.opencga.server.rest.analysis.VariantWebService.getVariantQuery; @Path("/{apiVersion}/analysis/clinical") @@ -507,6 +506,46 @@ public Response distinct( } } + @GET + @Path("/aggregationStats") + @ApiOperation(value = "Fetch catalog clinical analysis aggregation stats", response = FacetField.class) + public Response aggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.CLINICAL_ID_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_ID_PARAM) String id, + @ApiParam(value = ParamConstants.CLINICAL_UUID_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.CLINICAL_TYPE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_TYPE_PARAM) String type, + @ApiParam(value = ParamConstants.CLINICAL_DISORDER_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_DISORDER_PARAM) String disorder, + @ApiParam(value = ParamConstants.CLINICAL_FILES_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_FILES_PARAM) String files, + @ApiParam(value = ParamConstants.CLINICAL_SAMPLE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_SAMPLE_PARAM) String sample, + @ApiParam(value = ParamConstants.CLINICAL_INDIVIDUAL_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_INDIVIDUAL_PARAM) String individual, + @ApiParam(value = ParamConstants.CLINICAL_PROBAND_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_PROBAND_PARAM) String proband, + @ApiParam(value = ParamConstants.CLINICAL_PROBAND_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_PROBAND_SAMPLES_PARAM) String probandSamples, + @ApiParam(value = ParamConstants.CLINICAL_FAMILY_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_FAMILY_PARAM) String family, + @ApiParam(value = ParamConstants.CLINICAL_FAMILY_MEMBERS_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_FAMILY_MEMBERS_PARAM) String familyMembers, + @ApiParam(value = ParamConstants.CLINICAL_FAMILY_MEMBERS_SAMPLES_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_FAMILY_MEMBERS_SAMPLES_PARAM) String familyMembersSamples, + @ApiParam(value = ParamConstants.CLINICAL_PANELS_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_PANELS_PARAM) String panels, + @ApiParam(value = ParamConstants.CLINICAL_LOCKED_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_LOCKED_PARAM) Boolean locked, + @ApiParam(value = ParamConstants.CLINICAL_ANALYST_ID_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_ANALYST_ID_PARAM) String clinicalAnalystId, + @ApiParam(value = ParamConstants.CLINICAL_PRIORITY_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_PRIORITY_PARAM) String priority, + @ApiParam(value = ParamConstants.CLINICAL_FLAGS_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_FLAGS_PARAM) String flags, + @ApiParam(value = ParamConstants.CLINICAL_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.CLINICAL_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.CLINICAL_DUE_DATE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_DUE_DATE_PARAM) String dueDate, + @ApiParam(value = ParamConstants.CLINICAL_QUALITY_CONTROL_SUMMARY_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_QUALITY_CONTROL_SUMMARY_PARAM) String qualityControl, + @ApiParam(value = ParamConstants.CLINICAL_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_RELEASE_PARAM) String release, + @ApiParam(value = ParamConstants.SNAPSHOT_DESCRIPTION) @QueryParam(ParamConstants.SNAPSHOT_PARAM) int snapshot, + @ApiParam(value = ParamConstants.CLINICAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.CLINICAL_INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.CLINICAL_INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.ANNOTATION_DESCRIPTION) @QueryParam(Constants.ANNOTATION) String annotation, + @ApiParam(value = ParamConstants.DELETED_DESCRIPTION) @QueryParam(ParamConstants.DELETED_PARAM) boolean deleted, + @ApiParam(value = FACET_DESCRIPTION) @QueryParam(FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove("field"); + return catalogManager.getClinicalAnalysisManager().facet(studyStr, query, facet, token); + }); + } + @GET @Path("/{clinicalAnalyses}/acl") @ApiOperation(value = "Returns the acl of the clinical analyses. If member is provided, it will only return the acl for the member.", @@ -835,6 +874,36 @@ public Response interpretationDistinct( } } + @GET + @Path("/interpretation/aggregationStats") + @ApiOperation(value = "Fetch catalog interpretation aggregation stats", response = FacetField.class) + public Response interpretationAggregationStats( + @ApiParam(value = ParamConstants.STUDY_DESCRIPTION) @QueryParam(ParamConstants.STUDY_PARAM) String studyStr, + @ApiParam(value = ParamConstants.INTERPRETATION_ID_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_ID_PARAM) String id, + @ApiParam(value = ParamConstants.INTERPRETATION_UUID_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_UUID_PARAM) String uuid, + @ApiParam(value = ParamConstants.INTERPRETATION_NAME_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_NAME_PARAM) String name, + @ApiParam(value = ParamConstants.INTERPRETATION_CLINICAL_ANALYSIS_ID_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_CLINICAL_ANALYSIS_ID_PARAM) String clinicalAnalysisId, + @ApiParam(value = ParamConstants.INTERPRETATION_ANALYST_ID_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_ANALYST_ID_PARAM) String analystId, + @ApiParam(value = ParamConstants.INTERPRETATION_METHOD_NAME_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_METHOD_NAME_PARAM) String methodsName, + @ApiParam(value = ParamConstants.INTERPRETATION_PANELS_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_PANELS_PARAM) String panels, + @ApiParam(value = ParamConstants.INTERPRETATION_PRIMARY_FINDINGS_IDS_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_PRIMARY_FINDINGS_IDS_PARAM) String primaryFindings, + @ApiParam(value = ParamConstants.INTERPRETATION_SECONDARY_FINDINGS_IDS_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_SECONDARY_FINDINGS_IDS_PARAM) String secondaryFindings, + @ApiParam(value = ParamConstants.INTERPRETATION_CREATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_CREATION_DATE_PARAM) String creationDate, + @ApiParam(value = ParamConstants.INTERPRETATION_MODIFICATION_DATE_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_MODIFICATION_DATE_PARAM) String modificationDate, + @ApiParam(value = ParamConstants.INTERPRETATION_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_STATUS_PARAM) String status, + @ApiParam(value = ParamConstants.INTERPRETATION_INTERNAL_STATUS_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_INTERNAL_STATUS_PARAM) String internalStatus, + @ApiParam(value = ParamConstants.INTERPRETATION_RELEASE_DESCRIPTION) @QueryParam(ParamConstants.INTERPRETATION_RELEASE_PARAM) String release, + // The following variables were hid on version 2.1.0 + @ApiParam(value = "Clinical analyst ID", hidden = true) @QueryParam("analyst") String clinicalAnalyst, + @ApiParam(value = "Interpretation method name", hidden = true) @QueryParam("methods") String methods, + @ApiParam(value = FACET_DESCRIPTION) @QueryParam(FACET_PARAM) String facet) { + return run(() -> { + query.remove(ParamConstants.STUDY_PARAM); + query.remove("field"); + return catalogManager.getInterpretationManager().facet(studyStr, query, facet, token); + }); + } + //------------------------------------------------------------------------- // R E C E S S I V E G E N E A N A L Y S I S //------------------------------------------------------------------------- diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/ChromDensityVariantAggregationExecutor.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/ChromDensityVariantAggregationExecutor.java index 9606a74a85..b6c0aaf1e8 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/ChromDensityVariantAggregationExecutor.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/ChromDensityVariantAggregationExecutor.java @@ -8,13 +8,13 @@ import org.opencb.commons.datastore.core.Query; import org.opencb.commons.datastore.core.QueryOptions; import org.opencb.commons.datastore.solr.FacetQueryParser; -import org.opencb.opencga.storage.core.variant.query.VariantQueryResult; import org.opencb.opencga.storage.core.metadata.VariantStorageMetadataManager; import org.opencb.opencga.storage.core.variant.adaptors.VariantField; import org.opencb.opencga.storage.core.variant.adaptors.VariantIterable; import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException; import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam; import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator; +import org.opencb.opencga.storage.core.variant.query.VariantQueryResult; import org.opencb.opencga.storage.core.variant.query.executors.accumulators.FacetFieldAccumulator; import org.opencb.opencga.storage.core.variant.query.executors.accumulators.VariantChromDensityAccumulator; import org.opencb.opencga.storage.core.variant.query.executors.accumulators.VariantTypeAccumulator; @@ -141,7 +141,7 @@ protected VariantQueryResult aggregation(Query query, QueryOptions o FacetField field = new FacetField( CHROM_DENSITY, - regionBuckets.size(), + Long.valueOf(regionBuckets.size()), regionBuckets); return new VariantQueryResult<>((int) stopWatch.getTime(TimeUnit.MILLISECONDS), 1, numMatches, Collections.emptyList(), Collections.singletonList(field), null); diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/ChromDensityAccumulator.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/ChromDensityAccumulator.java index 4853b27e1d..b2f202e643 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/ChromDensityAccumulator.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/ChromDensityAccumulator.java @@ -60,7 +60,7 @@ public String getName() { @Override public FacetField createField() { - return new FacetField(VariantField.START.fieldName(), 0, + return new FacetField(VariantField.START.fieldName(), 0L, prepareBuckets()) .setStart(region.getStart()) .setEnd(region.getEnd()) diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/FacetFieldAccumulator.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/FacetFieldAccumulator.java index bdf6d88437..8a78007ac9 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/FacetFieldAccumulator.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/query/executors/accumulators/FacetFieldAccumulator.java @@ -28,7 +28,7 @@ public FacetFieldAccumulator setNestedFieldAccumulator(FacetFieldAccumulator< * @return predefined list of buckets. */ public FacetField createField() { - return new FacetField(getName(), 0, prepareBuckets()); + return new FacetField(getName(), 0L, prepareBuckets()); } /** diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/stats/SampleVariantStatsAggregationQuery.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/stats/SampleVariantStatsAggregationQuery.java index 3d48211e9c..13b09a7f72 100644 --- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/stats/SampleVariantStatsAggregationQuery.java +++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/stats/SampleVariantStatsAggregationQuery.java @@ -135,7 +135,7 @@ private void processSimpleResult(DataResult result, SampleVariantSta for (FacetField facetField : result.getResults()) { switch (facetField.getName()) { case "chromosome": - stats.setVariantCount(((int) facetField.getCount())); + stats.setVariantCount((int) facetField.getCount()); for (FacetField.Bucket bucket : facetField.getBuckets()) { stats.getChromosomeCount().put(bucket.getValue(), ((int) bucket.getCount())); }