diff --git a/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java b/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java index 0b28d33940c..5597d02fb6b 100644 --- a/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/AlterationCountServiceImpl.java @@ -294,6 +294,16 @@ private < T extends AlterationCountByGene> List populateAlterationCounts(@Non return alterationCounts; } + /** + * Combines alteration counts by Hugo gene symbols. If multiple entries exist for the same + * gene symbol, their number of altered cases and total counts are summed up. Returns a + * list of unique AlterationCountByGene objects where each gene symbol is represented only once. + * + * This appears in the Data where Genes have similar Hugo Gene Symbols but different Entrez Ids + * + * @param alterationCounts List of AlterationCountByGene objects, potentially with duplicate gene symbols + * @return List of AlterationCountByGene objects with unique gene symbols and combined counts + */ private List combineAlterationCountsWithConflictingHugoSymbols(@NonNull List alterationCounts) { Map alterationCountByGeneMap = new HashMap<>(); for (var alterationCount : alterationCounts) { @@ -308,7 +318,17 @@ private List combineAlterationCountsWithConflictingHugoSy return alterationCountByGeneMap.values().stream().toList(); } - + /** + * Combines alteration counts by Hugo gene symbols. If multiple entries exist for the same + * gene symbol, their number of altered cases and total counts are summed up. Returns a + * list of unique AlterationCountByGene objects where each gene symbol is represented only once. + * + * This appears in the Data where Genes have similar Hugo Gene Symbols but different Entrez Ids. + * This is a special case to handle Copy Number Mutations where the Alteration type should be a part of the key + * + * @param alterationCounts List of CopyNumberCountByGene objects, potentially with duplicate gene symbols + * @return List of AlterationCountByGene objects with unique gene symbols and combined counts + */ private List combineCopyNumberCountsWithConflictingHugoSymbols(@NonNull List alterationCounts) { Map, CopyNumberCountByGene> alterationCountByGeneMap = new HashMap<>(); for (var alterationCount : alterationCounts) {