Skip to content

Commit

Permalink
use samples filtered without numerical clinical data filter when conv…
Browse files Browse the repository at this point in the history
…erting patient clinical data to sample clinical data
  • Loading branch information
onursumer committed Oct 24, 2024
1 parent 9a5f9e3 commit 2f99479
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,19 @@ public ResponseEntity<ClinicalViolinPlotData> fetchClinicalDataViolinPlots(
List<ClinicalData> patientClinicalDataList = filterNonEmptyClinicalData(
studyViewColumnarService.getPatientClinicalData(interceptedStudyViewFilter, attributeIds)
);

List<ClinicalData> combinedClinicalDataList = Stream.concat(
sampleClinicalDataList.stream(),
convertPatientClinicalDataToSampleClinicalData(patientClinicalDataList, filteredSamples).stream()
).toList();

List<ClinicalData> combinedClinicalDataList;
if (patientClinicalDataList.isEmpty()) {
combinedClinicalDataList = sampleClinicalDataList;
} else {
// fetch samples again without the numerical clinical data filter
List<Sample> samplesWithoutNumericalFilter = studyViewColumnarService.getFilteredSamples(interceptedStudyViewFilter);

combinedClinicalDataList = Stream.concat(
sampleClinicalDataList.stream(),
convertPatientClinicalDataToSampleClinicalData(patientClinicalDataList, samplesWithoutNumericalFilter).stream()
).toList();
}

// Only mutation count can use log scale
boolean useLogScale = logScale && numericalAttributeId.equals("MUTATION_COUNT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public static List<ClinicalData> filterNonEmptyClinicalData(List<ClinicalData> c

public static List<ClinicalData> convertPatientClinicalDataToSampleClinicalData(
List<ClinicalData> patientClinicalDataList,
List<Sample> filteredSamples
List<Sample> samplesWithoutNumericalFilter
) {
List<ClinicalData> sampleClinicalDataList = new ArrayList<>();

Map<String, Map<String, List<Sample>>> patientToSamples = filteredSamples
Map<String, Map<String, List<Sample>>> patientToSamples = samplesWithoutNumericalFilter
.stream()
.collect(Collectors.groupingBy(
s -> s.getCancerStudyIdentifier() + "_" + s.getPatientStableId(),
Expand Down

0 comments on commit 2f99479

Please sign in to comment.