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 aa7fffe commit 1bb4598
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 1bb4598

Please sign in to comment.