Skip to content

Commit

Permalink
split custom and clinical data binning case
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Sep 26, 2024
1 parent bebefc2 commit f14e457
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/main/java/org/cbioportal/web/columnar/BasicDataBinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,21 @@ public <T extends DataBinCountFilter, S extends DataBinFilter, U extends DataBin
Map<String, ClinicalDataType> attributeDatatypeMap;
switch (dataBinCountFilter) {
// TODO: first case is to support clinical data, but clinical data is not using this now. We should update controller to use this method later
case ClinicalDataBinCountFilter clinicalDataBinCountFilter when customDataService.getCustomDataSessions(uniqueKeys).isEmpty() -> {
unfilteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(partialFilter, uniqueKeys);
filteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(studyViewFilter, uniqueKeys);
attributeDatatypeMap = studyViewColumnarService.getClinicalAttributeDatatypeMap();
}
case ClinicalDataBinCountFilter clinicalDataBinCountFilter -> {
Map<String, CustomDataSession> customDataSessions = customDataService.getCustomDataSessions(uniqueKeys);
if (!customDataSessions.isEmpty()) {
List<SampleIdentifier> unfilteredSampleIdentifiers = studyViewColumnarService.getFilteredSamples(partialFilter).stream().map(sample -> studyViewFilterUtil.buildSampleIdentifier(sample.getCancerStudyIdentifier(), sample.getStableId())).toList();
unfilteredClinicalDataCounts = customDataFilterUtil.getCustomDataCounts(unfilteredSampleIdentifiers, customDataSessions);
List<SampleIdentifier> filteredSampleIdentifiers = studyViewColumnarService.getFilteredSamples(studyViewFilter).stream().map(sample -> studyViewFilterUtil.buildSampleIdentifier(sample.getCancerStudyIdentifier(), sample.getStableId())).toList();
filteredClinicalDataCounts = customDataFilterUtil.getCustomDataCounts(filteredSampleIdentifiers, customDataSessions);
attributeDatatypeMap = customDataSessions.entrySet().stream().collect(toMap(
Map.Entry::getKey,
NewClinicalDataBinUtil::getDataType
));
}
else {
unfilteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(partialFilter, uniqueKeys);
filteredClinicalDataCounts = studyViewColumnarService.getClinicalDataCounts(studyViewFilter, uniqueKeys);
attributeDatatypeMap = studyViewColumnarService.getClinicalAttributeDatatypeMap();
}
List<SampleIdentifier> unfilteredSampleIdentifiers = studyViewColumnarService.getFilteredSamples(partialFilter).stream().map(sample -> studyViewFilterUtil.buildSampleIdentifier(sample.getCancerStudyIdentifier(), sample.getStableId())).toList();
unfilteredClinicalDataCounts = customDataFilterUtil.getCustomDataCounts(unfilteredSampleIdentifiers, customDataSessions);
List<SampleIdentifier> filteredSampleIdentifiers = studyViewColumnarService.getFilteredSamples(studyViewFilter).stream().map(sample -> studyViewFilterUtil.buildSampleIdentifier(sample.getCancerStudyIdentifier(), sample.getStableId())).toList();
filteredClinicalDataCounts = customDataFilterUtil.getCustomDataCounts(filteredSampleIdentifiers, customDataSessions);
attributeDatatypeMap = customDataSessions.entrySet().stream().collect(toMap(
Map.Entry::getKey,
NewClinicalDataBinUtil::getDataType
));
}
case GenomicDataBinCountFilter genomicDataBinCountFilter -> {
unfilteredClinicalDataCounts = studyViewColumnarService.getGenomicDataBinCounts(partialFilter, uniqueKeys);
Expand Down

0 comments on commit f14e457

Please sign in to comment.