Skip to content

Commit

Permalink
Update mutated-genes api to use filtered samples from ch
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd committed Jul 10, 2023
1 parent 4fa24f1 commit 2aa3101
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.cbioportal.model.AlterationCountByGene;
import org.cbioportal.model.AlterationFilter;
import org.cbioportal.model.ClinicalDataCountItem;
import org.cbioportal.model.Sample;
import org.cbioportal.service.StudyViewService;
import org.cbioportal.service.exception.StudyNotFoundException;
import org.cbioportal.web.columnstore.util.NewStudyViewFilterUtil;
import org.cbioportal.web.config.annotation.InternalApi;
import org.cbioportal.webparam.ClinicalDataCountFilter;
Expand Down Expand Up @@ -73,9 +75,17 @@ public ResponseEntity<List<AlterationCountByGene>> fetchMutatedGenes(
@RequestAttribute(required = false, value = "involvedCancerStudies") Collection<String> involvedCancerStudies,
@ApiIgnore // prevent reference to this attribute in the swagger-ui interface. this attribute is needed for the @PreAuthorize tag above.
@Valid @RequestAttribute(required = false, value = "interceptedStudyViewFilter") StudyViewFilter interceptedStudyViewFilter
) {
) throws StudyNotFoundException {
AlterationFilter annotationFilters = interceptedStudyViewFilter.getAlterationFilter();
List<Sample> samples = studyViewService.getFilteredSamplesFromColumnstore(interceptedStudyViewFilter);
List<String> studyIds = new ArrayList<>();
List<String> sampleIds = new ArrayList<>();
for(Sample sample : samples) {
studyIds.add(sample.getCancerStudyIdentifier());
sampleIds.add(sample.getStableId());
}
return new ResponseEntity<>(
studyViewService.getMutatedGenesFromColumnstore(interceptedStudyViewFilter),
studyViewService.getMutationAlterationCountByGenes(studyIds, sampleIds, annotationFilters),
HttpStatus.OK
);
}
Expand Down

0 comments on commit 2aa3101

Please sign in to comment.