From 569e010e8a03c99589af9547f3a689dcc1f96da2 Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Thu, 24 Oct 2024 16:03:09 -0400 Subject: [PATCH] change singleStudyUnfiltered to just unfiltered --- .../ClinicalDataDensityPlotServiceImpl.java | 2 +- .../impl/StudyViewColumnarServiceImpl.java | 36 +++++++++---------- .../service/impl/ViolinPlotServiceImpl.java | 2 +- .../web/util/StudyViewFilterUtil.java | 10 +++++- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/cbioportal/service/impl/ClinicalDataDensityPlotServiceImpl.java b/src/main/java/org/cbioportal/service/impl/ClinicalDataDensityPlotServiceImpl.java index 02441c0912d..e4abf2e631c 100644 --- a/src/main/java/org/cbioportal/service/impl/ClinicalDataDensityPlotServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/ClinicalDataDensityPlotServiceImpl.java @@ -26,7 +26,7 @@ public class ClinicalDataDensityPlotServiceImpl implements ClinicalDataDensityPl @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public DensityPlotData getDensityPlotData(List sampleClinicalData, DensityPlotParameters densityPlotParameters, StudyViewFilter studyViewFilter) { diff --git a/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java b/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java index b9d82902da0..5402ddc6584 100644 --- a/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java @@ -54,7 +54,7 @@ public StudyViewColumnarServiceImpl(StudyViewRepository studyViewRepository, Alt @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getFilteredSamples(StudyViewFilter studyViewFilter) { @@ -64,7 +64,7 @@ public List getFilteredSamples(StudyViewFilter studyViewFilter) { @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getMutatedGenes(StudyViewFilter studyViewFilter) throws StudyNotFoundException { @@ -73,7 +73,7 @@ public List getMutatedGenes(StudyViewFilter studyViewFilt @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getMolecularProfileSampleCounts(StudyViewFilter studyViewFilter) { @@ -82,7 +82,7 @@ public List getMolecularProfileSampleCounts(StudyViewFilter st @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getClinicalEventTypeCounts(StudyViewFilter studyViewFilter) { @@ -91,7 +91,7 @@ public List getClinicalEventTypeCounts(StudyViewFilter s @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public PatientTreatmentReport getPatientTreatmentReport(StudyViewFilter studyViewFilter) { @@ -100,7 +100,7 @@ public PatientTreatmentReport getPatientTreatmentReport(StudyViewFilter studyVie @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public SampleTreatmentReport getSampleTreatmentReport(StudyViewFilter studyViewFilter) { @@ -109,7 +109,7 @@ public SampleTreatmentReport getSampleTreatmentReport(StudyViewFilter studyViewF @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getGenomicDataBinCounts(StudyViewFilter studyViewFilter, List genomicDataBinFilters) { @@ -118,7 +118,7 @@ public List getGenomicDataBinCounts(StudyViewFilter study @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getGenericAssayDataBinCounts(StudyViewFilter studyViewFilter, List genericAssayDataBinFilters) { @@ -131,7 +131,7 @@ public List getCnaGenes(StudyViewFilter studyViewFilter) @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getStructuralVariantGenes(StudyViewFilter studyViewFilter) throws StudyNotFoundException { @@ -140,7 +140,7 @@ public List getStructuralVariantGenes(StudyViewFilter stu @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public Map getClinicalAttributeDatatypeMap() { @@ -149,7 +149,7 @@ public Map getClinicalAttributeDatatypeMap() { @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getClinicalDataCounts(StudyViewFilter studyViewFilter, List filteredAttributes) { @@ -168,7 +168,7 @@ public List getClinicalDataCounts(StudyViewFilter studyVi @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getCaseListDataCounts(StudyViewFilter studyViewFilter) { @@ -180,7 +180,7 @@ public List getCaseListDataCounts(StudyViewFilter studyViewFi @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getPatientClinicalData(StudyViewFilter studyViewFilter, List attributeIds) { @@ -189,7 +189,7 @@ public List getPatientClinicalData(StudyViewFilter studyViewFilter @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getSampleClinicalData(StudyViewFilter studyViewFilter, List attributeIds) { @@ -198,7 +198,7 @@ public List getSampleClinicalData(StudyViewFilter studyViewFilter, @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getCNACountsByGeneSpecific(StudyViewFilter studyViewFilter, List genomicDataFilters) { @@ -207,7 +207,7 @@ public List getCNACountsByGeneSpecific(StudyViewFilter stu @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getGenericAssayDataCounts(StudyViewFilter studyViewFilter, List genericAssayDataFilters) { @@ -216,7 +216,7 @@ public List getGenericAssayDataCounts(StudyViewFilter @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getMutationCountsByGeneSpecific(StudyViewFilter studyViewFilter, List genomicDataFilters) { @@ -237,7 +237,7 @@ public List getMutationCountsByGeneSpecific(StudyViewFilte @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) @Override public List getMutationTypeCountsByGeneSpecific(StudyViewFilter studyViewFilter, List genomicDataFilters) { diff --git a/src/main/java/org/cbioportal/service/impl/ViolinPlotServiceImpl.java b/src/main/java/org/cbioportal/service/impl/ViolinPlotServiceImpl.java index ede844907c8..e3da1e50019 100644 --- a/src/main/java/org/cbioportal/service/impl/ViolinPlotServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/ViolinPlotServiceImpl.java @@ -21,7 +21,7 @@ public class ViolinPlotServiceImpl implements ViolinPlotService { @Cacheable( cacheResolver = "staticRepositoryCacheOneResolver", - condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isSingleStudyUnfiltered(#studyViewFilter)" + condition = "@cacheEnabledConfig.getEnabledClickhouse() && @studyViewFilterUtil.isUnfiltered(#studyViewFilter)" ) public ClinicalViolinPlotData getClinicalViolinPlotData( List sampleClinicalDataForViolinPlot, diff --git a/src/main/java/org/cbioportal/web/util/StudyViewFilterUtil.java b/src/main/java/org/cbioportal/web/util/StudyViewFilterUtil.java index 3ebb8021d50..c91a7229b09 100644 --- a/src/main/java/org/cbioportal/web/util/StudyViewFilterUtil.java +++ b/src/main/java/org/cbioportal/web/util/StudyViewFilterUtil.java @@ -200,8 +200,16 @@ public List getClinicalDataCountsFromCustomData(Collectio } public boolean isSingleStudyUnfiltered(StudyViewFilter filter) { + return isSingleStudy(filter) && isUnfiltered(filter); + } + + public boolean isSingleStudy(StudyViewFilter filter) { + return filter.getStudyIds() != null && + filter.getStudyIds().size() == 1; + } + + public boolean isUnfiltered(StudyViewFilter filter) { return filter.getStudyIds() != null && - filter.getStudyIds().size() == 1 && (filter.getClinicalDataFilters() == null || filter.getClinicalDataFilters().isEmpty()) && (filter.getGeneFilters() == null || filter.getGeneFilters().isEmpty()) && (filter.getSampleTreatmentFilters() == null || filter.getSampleTreatmentFilters().getFilters().isEmpty()) &&