diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml index aabdd4cac24..0a301d5953c 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml @@ -247,8 +247,10 @@ FROM genetic_alteration_derived alteration_value != 'NA' AND - profile_type = #{profileType} - AND sample_unique_id IN () + profile_type = #{profileType} AND + + + hugo_gene_symbol = #{genomicDataFilter.hugoGeneSymbol} @@ -267,12 +269,11 @@ SELECT * FROM cna_query UNION ALL SELECT - hugoGeneSymbol, + coalesce((SELECT hugoGeneSymbol FROM cna_sum LIMIT 1), #{genomicDataFilters[0].hugoGeneSymbol}) as hugoGeneSymbol, #{profileType}, 'NA' as label, 'NA' as value, - cast(((SELECT * FROM ()) - cna_count) as INTEGER) as count - FROM cna_sum + cast(((SELECT * FROM ()) - coalesce((SELECT cna_count FROM cna_sum LIMIT 1), 0)) as INTEGER) as count @@ -281,14 +282,20 @@ SELECT count(distinct sgp.sample_unique_id) FROM sample_to_gene_panel_derived sgp JOIN gene_panel_to_gene_derived gpg ON sgp.gene_panel_id = gpg.gene_panel_id - WHERE sample_unique_id IN () + WHERE + + + AND gpg.gene = #{genomicDataFilter.hugoGeneSymbol} AND sgp.alteration_type = 'MUTATION_EXTENDED' ), mutated_count as ( SELECT count(distinct sample_unique_id) FROM genomic_event_derived - WHERE sample_unique_id IN () + WHERE + + + AND hugo_gene_symbol = #{genomicDataFilter.hugoGeneSymbol} AND variant_type = 'mutation' ) @@ -309,7 +316,9 @@ count(distinct(sample_unique_id)) as uniqueCount FROM genomic_event_derived - sample_unique_id IN () + + + AND variant_type = 'mutation' hugo_gene_symbol = #{genomicDataFilter.hugoGeneSymbol} @@ -595,10 +604,9 @@ SELECT * FROM genomic_numerical_query UNION ALL SELECT - attributeId, + coalesce((SELECT attributeId FROM genomic_numerical_sum LIMIT 1), concat(#{genomicDataBinFilters[0].hugoGeneSymbol}, #{profileType})) as attributeId, 'NA' as value, - cast(((SELECT * FROM ()) - genomic_numerical_count) as INTEGER) as count - FROM genomic_numerical_sum + cast(((SELECT * FROM ()) - coalesce((SELECT genomic_numerical_count FROM genomic_numerical_sum LIMIT 1), 0)) as INTEGER) as count