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 841fd4abf6a..f7d34a34b03 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,9 +532,61 @@ + + + + ( + + + + + ) + + + + + ( + + + + + ) + + + -- patient level profile only have category for now + + + ( + SELECT sample_unique_id + FROM sample_derived + WHERE patient_unique_id IN ( + + + + + ) + ) + + + + + ( + SELECT sample_unique_id + FROM sample_derived + WHERE patient_unique_id IN ( + + + + + ) + ) + + + + - SELECT sample_unique_id, value, datatype - FROM generic_assay_data_derived + SELECT sample_unique_id, patient_unique_id, value, datatype + FROM generic_assay_data_derived_patient WHERE profile_type = #{genericAssayDataFilter.profileType} AND entity_stable_id = #{genericAssayDataFilter.stableId} diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml index a06fe070b80..e851d1ac9f0 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml @@ -309,7 +309,7 @@ entity_stable_id AS stableId, value, cast(count(*) AS INTEGER) AS count - FROM generic_assay_data_derived + FROM generic_assay_data_derived_patient @@ -708,7 +708,7 @@ AS value, cast(count(value) as INTEGER) AS count - FROM generic_assay_data_derived + FROM generic_assay_data_derived_patient