Skip to content

Commit

Permalink
Update to handle use case when sampleProfileWithoutGenePanel is 0 the…
Browse files Browse the repository at this point in the history
…n assume total Profile Count
  • Loading branch information
haynescd committed Nov 7, 2024
1 parent cace275 commit d8a2a90
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public List<AlterationCountByGene> getStructuralVariantGenes(StudyViewFilterCont
private < T extends AlterationCountByGene> List<T> populateAlterationCounts(@NonNull List<T> alterationCounts,
@NonNull StudyViewFilterContext studyViewFilterContext,
@NonNull AlterationType alterationType) {
final int totalProfiledCount = studyViewRepository.getTotalProfiledCountsByAlterationType(studyViewFilterContext, alterationType.toString());
var profiledCountsMap = studyViewRepository.getTotalProfiledCounts(studyViewFilterContext, alterationType.toString());
final var matchingGenePanelIdsMap = studyViewRepository.getMatchingGenePanelIds(studyViewFilterContext, alterationType.toString());
final int sampleProfileCountWithoutGenePanelData = studyViewRepository.getSampleProfileCountWithoutPanelData(studyViewFilterContext, alterationType.toString());
Expand All @@ -295,17 +296,23 @@ private < T extends AlterationCountByGene> List<T> populateAlterationCounts(@Non
Set<String> matchingGenePanelIds = matchingGenePanelIdsMap.get(hugoGeneSymbol) != null ?
matchingGenePanelIdsMap.get(hugoGeneSymbol) : Collections.emptySet();

int totalProfiledCount = hasGenePanelData(matchingGenePanelIds)
? profiledCountsMap.getOrDefault(hugoGeneSymbol, 0) + sampleProfileCountWithoutGenePanelData
: sampleProfileCountWithoutGenePanelData;

alterationCountByGene.setNumberOfProfiledCases(totalProfiledCount);
int alterationTotalProfiledCount = computeTotalProfiledCount(hasGenePanelData(matchingGenePanelIds),
profiledCountsMap.getOrDefault(hugoGeneSymbol, 0),
sampleProfileCountWithoutGenePanelData, totalProfiledCount);
alterationCountByGene.setNumberOfProfiledCases(alterationTotalProfiledCount);

alterationCountByGene.setMatchingGenePanelIds(matchingGenePanelIds);

});
return alterationCounts;
}

private int computeTotalProfiledCount(boolean hasGenePanelData, int alterationsProfiledCount, int sampleProfileCountWithoutGenePanelData, int totalProfiledCount) {
int profiledCount = hasGenePanelData ? alterationsProfiledCount + sampleProfileCountWithoutGenePanelData
: sampleProfileCountWithoutGenePanelData;
return profiledCount == 0 ? totalProfiledCount : profiledCount;
}

private List<AlterationCountByGene> populateAlterationCountsWithMutSigQValue(List<AlterationCountByGene> alterationCountByGenes, StudyViewFilterContext studyViewFilterContext) throws StudyNotFoundException {
final var mutSigs = getMutSigs(studyViewFilterContext);
Expand Down

0 comments on commit d8a2a90

Please sign in to comment.