Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix # Issue with gene-panel-data/fetch API When molecularProfileIds is Empty [Issue 11252] #11253

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/main/java/org/cbioportal/web/GenePanelDataController.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.ArrayList;

@PublicApi
@RestController
Expand Down Expand Up @@ -83,9 +84,10 @@ public ResponseEntity<List<GenePanelData>> fetchGenePanelDataInMultipleMolecular
@Parameter(required = true, description = "Gene panel data filter object")
@RequestBody(required = false) GenePanelDataMultipleStudyFilter genePanelDataMultipleStudyFilter) {

List<GenePanelData> genePanelDataList;
if(CollectionUtils.isEmpty(interceptedGenePanelDataMultipleStudyFilter.getMolecularProfileIds())) {
List<MolecularProfileCaseIdentifier> molecularProfileSampleIdentifiers = interceptedGenePanelDataMultipleStudyFilter.getSampleMolecularIdentifiers()
List<GenePanelData> genePanelDataList = new ArrayList<>();
if(interceptedGenePanelDataMultipleStudyFilter.getMolecularProfileIds()!= null && CollectionUtils.isEmpty(interceptedGenePanelDataMultipleStudyFilter.getMolecularProfileIds())) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nicer to call the endpoint once, store it to a variable and test against it - a function call might be unnecessarily expensive.

if(interceptedGenePanelDataMultipleStudyFilter.getSampleMolecularIdentifiers()!= null){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

List<MolecularProfileCaseIdentifier> molecularProfileSampleIdentifiers = interceptedGenePanelDataMultipleStudyFilter.getSampleMolecularIdentifiers()
.stream()
.map(sampleMolecularIdentifier -> {
MolecularProfileCaseIdentifier profileCaseIdentifier = new MolecularProfileCaseIdentifier();
Expand All @@ -94,8 +96,8 @@ public ResponseEntity<List<GenePanelData>> fetchGenePanelDataInMultipleMolecular
return profileCaseIdentifier;
})
.collect(Collectors.toList());

genePanelDataList = genePanelService.fetchGenePanelDataInMultipleMolecularProfiles(molecularProfileSampleIdentifiers);
}
} else {
genePanelDataList = genePanelService.fetchGenePanelDataByMolecularProfileIds(new HashSet<>(interceptedGenePanelDataMultipleStudyFilter.getMolecularProfileIds()));
}
Expand Down