diff --git a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java index d10d85d98c4..2a06b059d42 100644 --- a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java +++ b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java @@ -63,11 +63,7 @@ private CategorizedGenericAssayDataCountFilter extractGenericAssayDataCountFilte CategorizedGenericAssayDataCountFilter.Builder builder = CategorizedGenericAssayDataCountFilter.getBuilder(); - // TODO: Support patient level profiles and data filtering - List sampleCategoricalProfileTypes = genericAssayProfilesMap.get(DataSource.SAMPLE) - .stream().filter(profile -> profile.getDatatype().equals("CATEGORICAL") || profile.getDatatype().equals("BINARY")) - .map(profile -> profile.getStableId().replace(profile.getCancerStudyIdentifier() + "_", "")) - .toList(); + // TODO: Support data filtering List sampleNumericalProfileTypes = genericAssayProfilesMap.get(DataSource.SAMPLE) .stream().filter(profile -> profile.getDatatype().equals("LIMIT-VALUE")) .map(profile -> profile.getStableId().replace(profile.getCancerStudyIdentifier() + "_", "")) @@ -75,9 +71,21 @@ private CategorizedGenericAssayDataCountFilter extractGenericAssayDataCountFilte builder.setSampleNumericalGenericAssayDataFilters(studyViewFilter.getGenericAssayDataFilters().stream() .filter(genericAssayDataFilter -> sampleNumericalProfileTypes.contains(genericAssayDataFilter.getProfileType())) .toList()); + List sampleCategoricalProfileTypes = genericAssayProfilesMap.get(DataSource.SAMPLE) + .stream().filter(profile -> profile.getDatatype().equals("CATEGORICAL") || profile.getDatatype().equals("BINARY")) + .map(profile -> profile.getStableId().replace(profile.getCancerStudyIdentifier() + "_", "")) + .toList(); builder.setSampleCategoricalGenericAssayDataFilters(studyViewFilter.getGenericAssayDataFilters().stream() .filter(genericAssayDataFilter -> sampleCategoricalProfileTypes.contains(genericAssayDataFilter.getProfileType())) .toList()); + // Patient level profiles only have CATEGORICAL datatype for now + List patientCategoricalProfileTypes = genericAssayProfilesMap.get(DataSource.PATIENT) + .stream().filter(profile -> profile.getDatatype().equals("CATEGORICAL")) + .map(profile -> profile.getStableId().replace(profile.getCancerStudyIdentifier() + "_", "")) + .toList(); + builder.setPatientCategoricalGenericAssayDataFilters(studyViewFilter.getGenericAssayDataFilters().stream() + .filter(genericAssayDataFilter -> patientCategoricalProfileTypes.contains(genericAssayDataFilter.getProfileType())) + .toList()); return builder.build(); } diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml index f4388cf4260..09c20012147 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml @@ -138,7 +138,6 @@ - ( @@ -154,25 +153,9 @@ - - - ( - - - - - ) - - - - - - - - - - - + + + @@ -549,8 +532,39 @@ + + + + ( + + + + ) + + + + + ( + + + + ) + + + -- patient level profile only have categorical for now + + + ( + + + + ) + + + + - SELECT sample_unique_id, value, datatype + SELECT sample_unique_id, patient_unique_id, value, datatype FROM generic_assay_data_derived WHERE profile_type = #{genericAssayDataFilter.profileType} AND entity_stable_id = #{genericAssayDataFilter.stableId} @@ -647,10 +661,18 @@ - SELECT ${unique_id} + SELECT sample_unique_id FROM sample_derived sd - LEFT JOIN () AS generic_assay_query - ON sd.sample_unique_id = generic_assay_query.sample_unique_id + LEFT JOIN () AS generic_assay_query + ON + + + sd.sample_unique_id = generic_assay_query.sample_unique_id + + + sd.patient_unique_id = generic_assay_query.patient_unique_id + + datatype != 'LIMIT-VALUE' diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml index 632c280c88e..178074ec7a3 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml @@ -304,12 +304,17 @@