diff --git a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java index e783e684a82..2ee580f133f 100644 --- a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java +++ b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java @@ -55,7 +55,6 @@ public static StudyViewFilterHelper build(@Nullable StudyViewFilter studyViewFil private final StudyViewFilter studyViewFilter; private final CategorizedGenericAssayDataCountFilter categorizedGenericAssayDataCountFilter; private final List customDataSamples; - private final String[] filteredSampleIdentifiers; private final List involvedCancerStudies; private StudyViewFilterHelper(@NonNull StudyViewFilter studyViewFilter, @@ -66,13 +65,6 @@ private StudyViewFilterHelper(@NonNull StudyViewFilter studyViewFilter, this.categorizedGenericAssayDataCountFilter = extractGenericAssayDataCountFilters(studyViewFilter, genericAssayProfilesMap); this.customDataSamples = customDataSamples; this.involvedCancerStudies = involvedCancerStudies; - if (studyViewFilter != null && studyViewFilter.getSampleIdentifiers() != null) { - this.filteredSampleIdentifiers = studyViewFilter.getSampleIdentifiers().stream() - .map(sampleIdentifier -> sampleIdentifier.getStudyId() + "_" + sampleIdentifier.getSampleId()) - .toArray(String[]::new); - } else { - this.filteredSampleIdentifiers = new String[0]; - } } public StudyViewFilter studyViewFilter() { @@ -88,7 +80,13 @@ public List customDataSamples() { } public String[] filteredSampleIdentifiers() { - return this.filteredSampleIdentifiers; + if (studyViewFilter != null && studyViewFilter.getSampleIdentifiers() != null) { + return studyViewFilter.getSampleIdentifiers().stream() + .map(sampleIdentifier -> sampleIdentifier.getStudyId() + "_" + sampleIdentifier.getSampleId()) + .toArray(String[]::new); + } else { + return new String[0]; + } } public List involvedCancerStudies() { diff --git a/src/main/java/org/cbioportal/web/parameter/CustomSampleIdentifier.java b/src/main/java/org/cbioportal/web/parameter/CustomSampleIdentifier.java index 0eade688034..51692168fcb 100644 --- a/src/main/java/org/cbioportal/web/parameter/CustomSampleIdentifier.java +++ b/src/main/java/org/cbioportal/web/parameter/CustomSampleIdentifier.java @@ -6,7 +6,6 @@ public class CustomSampleIdentifier extends SampleIdentifier implements Serializ private boolean isFilteredOut = false; private String value; - private String uniqueSampleId; public boolean getIsFilteredOut() { @@ -32,6 +31,6 @@ public String getUniqueSampleId() { if (getStudyId() != null && getSampleId() != null) { return getStudyId() + "_" + getSampleId(); } - return null; // or return a default value if either studyId or sampleId is null + return null; // or return null if either studyId or sampleId is null } } diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml index 584f24e87a1..74eca303a81 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml @@ -60,14 +60,14 @@ ) - - + + INTERSECT SELECT sample_unique_id FROM sample_derived WHERE sample_unique_id IN ( - #{studyViewFilterHelper.filteredSampleIdentifiers, typeHandler=org.apache.ibatis.type.ArrayTypeHandler} + #{filteredSampleIdentifiers, typeHandler=org.apache.ibatis.type.ArrayTypeHandler} )