Skip to content

Commit

Permalink
Adding option for extracting study ids from sample identifiers for cl…
Browse files Browse the repository at this point in the history
…inical data counts endpoint
  • Loading branch information
dippindots committed Nov 14, 2024
1 parent 23e6f29 commit 335d936
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.cbioportal.web.parameter.GenericAssayDataFilter;
import org.cbioportal.web.parameter.GenomicDataBinFilter;
import org.cbioportal.web.parameter.GenomicDataFilter;
import org.cbioportal.web.parameter.SampleIdentifier;
import org.cbioportal.web.parameter.StudyViewFilter;
import org.cbioportal.web.columnar.util.CustomDataFilterUtil;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -158,7 +159,16 @@ public List<ClinicalDataCountItem> getClinicalDataCounts(StudyViewFilter studyVi

var context = createContext(studyViewFilter);

var involvedCancerStudies = studyViewFilter.getStudyIds();
List<String> involvedCancerStudies = new ArrayList<>();
if (studyViewFilter.getStudyIds() != null && !studyViewFilter.getStudyIds().isEmpty()) {
involvedCancerStudies = studyViewFilter.getStudyIds();
} else if (studyViewFilter.getSampleIdentifiers() != null && !studyViewFilter.getSampleIdentifiers().isEmpty()) {
Set<String> studyIdSet = new HashSet<>();
for (SampleIdentifier sampleIdentifier : studyViewFilter.getSampleIdentifiers()) {
studyIdSet.add(sampleIdentifier.getStudyId());
}
involvedCancerStudies = studyIdSet.stream().toList();
}

var result = studyViewRepository.getClinicalDataCounts(context, filteredAttributes);

Expand Down

0 comments on commit 335d936

Please sign in to comment.