Skip to content

Commit

Permalink
Clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd committed Jun 10, 2024
1 parent e76d70d commit 915cbb3
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,14 @@ public List<AlterationCountByGene> getMutatedGenes(StudyViewFilter studyViewFilt

alterationCountByGenes.parallelStream()
.forEach(alterationCountByGene -> {
var matchingGenePanelIds = matchingGenePanelIdsMap.get(alterationCountByGene.getHugoGeneSymbol()).getMatchingGenePanelIds();
alterationCountByGene.setNumberOfProfiledCases(getTotalProfiledCount(alterationCountByGene.getHugoGeneSymbol(),
profiledCountsMap, profiledCountWithoutGenePanelData, matchingGenePanelIds));
String hugoGeneSymbol = alterationCountByGene.getHugoGeneSymbol();
var matchingGenePanelIds = matchingGenePanelIdsMap.get(hugoGeneSymbol) != null ?
matchingGenePanelIdsMap.get(hugoGeneSymbol).getMatchingGenePanelIds() : null;

int totalProfiledCount = getTotalProfiledCount(alterationCountByGene.getHugoGeneSymbol(),
profiledCountsMap, profiledCountWithoutGenePanelData, matchingGenePanelIds);

alterationCountByGene.setNumberOfProfiledCases(totalProfiledCount);

if(!hasGenePanelData(matchingGenePanelIds)) {
alterationCountByGene.setMatchingGenePanelIds(matchingGenePanelIds);
Expand All @@ -288,10 +293,8 @@ private int getTotalProfiledCount(@NonNull String hugoGeneSymbol, @NonNull Map<S
}

private boolean hasGenePanelData(@Nullable Set<String> matchingGenePanelIds) {
if( matchingGenePanelIds == null) {
return false;
}
return matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING) && matchingGenePanelIds.size() > 1;
return matchingGenePanelIds != null && matchingGenePanelIds.contains(WHOLE_EXOME_SEQUENCING)
&& matchingGenePanelIds.size() > 1;
}

private <S extends AlterationCountBase> Pair<List<S>, Long> getAlterationGeneCounts(
Expand Down

0 comments on commit 915cbb3

Please sign in to comment.