diff --git a/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java b/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java index 41e29c3e2ff..e1ead68865b 100644 --- a/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java +++ b/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java @@ -149,15 +149,15 @@ private List extractCustomDataSamplesWithoutSession(fina MultiKeyMap customDataByStudySampleName = new MultiKeyMap<>(); - studyViewFilter.getCustomDataFilters().stream().forEach(filter -> { + studyViewFilter.getCustomDataFilters().stream().forEach(filter -> filter.getSamples().forEach(datum -> { String value = datum.getValue().toUpperCase(); if (value.equals("NAN") || value.equals("N/A")) { value = "NA"; } customDataByStudySampleName.put(datum.getStudyId(), datum.getSampleId(), filter.getDisplayName(), value); - }); - }); + }) + ); List filtered = new ArrayList<>(); customSampleIdentifiers.forEach(customSampleIdentifier -> { @@ -249,23 +249,19 @@ private Integer getFilteredCountByDataIntervalWithStudySampleNameMap(List> ranges = filter.getValues().stream() .map(this::calculateRangeValueForFilter) .filter(Objects::nonNull) - .collect(Collectors.toList()); + .toList(); // find special value filters List specialValues = filter.getValues().stream() .filter(f -> f.getValue() != null) .map(f -> f.getValue().toUpperCase()) - .collect(Collectors.toList()); + .toList(); - if (rangeValue != null) { - if (ranges.stream().anyMatch(r -> r.encloses(rangeValue))) { - count++; - } - } - else if (specialValues.contains(attrValue.toUpperCase())) { + if ((rangeValue != null && ranges.stream().anyMatch(r -> r.encloses(rangeValue))) || + (rangeValue == null && specialValues.contains(attrValue.toUpperCase()))) { count++; } - } else if (containsNA(filter)) { + } else if (Boolean.TRUE.equals(containsNA(filter))) { count++; } }