Skip to content

Commit 6c28892

Browse files
authored
Stable sort structural variant genes (#11861)
* make sure to stable sort structural variant genes first by total count and then by hugo gene symbol * also sort mutated genes and cna genes by total count and gene symbol
1 parent c7cfc74 commit 6c28892

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/java/org/cbioportal/domain/alteration/usecase/GetAlterationCountByGeneUseCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.cbioportal.domain.alteration.usecase;
22

3-
import java.util.HashMap;
3+
import java.util.LinkedHashMap;
44
import java.util.List;
55
import java.util.Map;
66
import java.util.function.Function;
@@ -85,7 +85,7 @@ public List<AlterationCountByGene> execute(
8585
*/
8686
private List<AlterationCountByGene> combineAlterationCountsWithConflictingHugoSymbols(
8787
List<AlterationCountByGene> alterationCounts) {
88-
Map<String, AlterationCountByGene> alterationCountByGeneMap = new HashMap<>();
88+
Map<String, AlterationCountByGene> alterationCountByGeneMap = new LinkedHashMap<>();
8989
for (var alterationCount : alterationCounts) {
9090
if (alterationCountByGeneMap.containsKey(alterationCount.getHugoGeneSymbol())) {
9191
AlterationCountByGene toUpdate =
@@ -136,7 +136,7 @@ private List<AlterationCountByGene> populateAlterationCountsWithMutSigQValue(
136136
private Map<String, MutSig> getMutSigs(StudyViewFilterContext studyViewFilterContext)
137137
throws StudyNotFoundException {
138138
var distinctStudyIds = getFilteredStudyIdsUseCase.execute(studyViewFilterContext);
139-
Map<String, MutSig> mutSigs = new HashMap<>();
139+
Map<String, MutSig> mutSigs = new LinkedHashMap<>();
140140
if (distinctStudyIds.size() == 1) {
141141
var studyId = distinctStudyIds.getFirst();
142142
mutSigs =

src/main/resources/mappers/clickhouse/alteration/ClickhouseAlterationMapper.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
</if>
3030
</where>
3131
GROUP BY entrez_gene_id, hugo_gene_symbol
32+
ORDER BY totalCount DESC, hugo_gene_symbol ASC
3233
</select>
3334

3435
<!-- /cna-genes/fetch (returns CopyNumberCountByGene) -->
@@ -55,6 +56,7 @@
5556
</if>
5657
</where>
5758
GROUP BY entrez_gene_id, hugo_gene_symbol, alteration, cytoband
59+
ORDER BY totalCount DESC, hugo_gene_symbol ASC
5860
</select>
5961

6062
<select
@@ -77,6 +79,7 @@
7779
<include refid="whereMutationStatus" />
7880
</where>
7981
GROUP BY entrez_gene_id, hugo_gene_symbol
82+
ORDER BY totalCount DESC, hugo_gene_symbol ASC
8083
</select>
8184

8285
<!-- Grab Total Profiled Counts. Currently, this query filters out all samples associated with a Gene Panel WES before

0 commit comments

Comments
 (0)