From 842a868657bdfa67adeb08e48d28ea86ad1306d4 Mon Sep 17 00:00:00 2001 From: Charles Haynes Date: Wed, 9 Oct 2024 14:42:19 -0400 Subject: [PATCH] Update GenericAssayFilter to support NA's --- .../StudyViewColumnStoreController.java | 2 +- .../StudyViewFilterMapper.xml | 54 ++++++++++++------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/cbioportal/web/columnar/StudyViewColumnStoreController.java b/src/main/java/org/cbioportal/web/columnar/StudyViewColumnStoreController.java index 60abed78812..e5ebbfecda0 100644 --- a/src/main/java/org/cbioportal/web/columnar/StudyViewColumnStoreController.java +++ b/src/main/java/org/cbioportal/web/columnar/StudyViewColumnStoreController.java @@ -403,7 +403,7 @@ public ResponseEntity> fetchGenomicDataCounts( } @PreAuthorize("hasPermission(#involvedCancerStudies, 'Collection', T(org.cbioportal.utils.security.AccessLevel).READ)") - @RequestMapping(value = "/column-store/generic-assay-data-counts/fetch", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + @PostMapping(value = "/column-store/generic-assay-data-counts/fetch", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @Operation(description = "Fetch generic assay data counts by study view filter") @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = GenericAssayDataCountItem.class)))) diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml index 1ff28729b63..4e4fb92d61b 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml @@ -442,6 +442,10 @@ empty(attribute_value) + OR + + + = 'NA' ( @@ -541,13 +545,11 @@ - - SELECT sample_unique_id, value + + SELECT sample_unique_id, value, datatype FROM generic_assay_data_derived WHERE profile_type = #{genericAssayDataFilter.profileType} AND entity_stable_id = #{genericAssayDataFilter.stableId} - - AND datatype = 'LIMIT-VALUE' @@ -569,8 +571,9 @@ SELECT DISTINCT sd.sample_unique_id FROM sample_derived sd - LEFT JOIN () AS generic_numerical_query ON sd.sample_unique_id = generic_numerical_query.sample_unique_id - WHERE value IS null OR + LEFT JOIN () AS generic_numerical_query ON sd.sample_unique_id = generic_numerical_query.sample_unique_id + WHERE datatype = 'LIMIT-VALUE' + AND value IS null OR = 'NA' @@ -582,8 +585,10 @@ SELECT DISTINCT sample_unique_id - FROM () AS generic_numerical_query + FROM () AS generic_numerical_query WHERE + datatype = 'LIMIT-VALUE' + AND != 'NA' @@ -639,18 +644,29 @@ SELECT ${unique_id} - FROM ${table_name} - WHERE entity_stable_id = '${genericAssayDataFilter.stableId}' AND - profile_type='${genericAssayDataFilter.profileType}' - - - AND ( - - - - ) ILIKE '${dataFilterValue.value}' - - + FROM sample_derived sd + LEFT JOIN () AS generic_assay_query + ON sd.sample_unique_id = generic_assay_query.sample_unique_id + + datatype != 'LIMIT-VALUE' + + + + value IS null OR + + + = 'NA' + + + ( + + + + ) ILIKE '${dataFilterValue.value}' + + + +