Skip to content

Commit

Permalink
Add entrez_id to alteration Count endpoints (#10936)
Browse files Browse the repository at this point in the history
  • Loading branch information
haynescd authored Aug 13, 2024
1 parent 280dd58 commit d7af5e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/main/resources/db-scripts/clickhouse/clickhouse.sql
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ CREATE TABLE IF NOT EXISTS genomic_event_derived
(
sample_unique_id String,
hugo_gene_symbol String,
entrez_gene_id Int32,
gene_panel_stable_id LowCardinality(String),
cancer_study_identifier LowCardinality(String),
genetic_profile_stable_id LowCardinality(String),
Expand All @@ -95,12 +96,13 @@ CREATE TABLE IF NOT EXISTS genomic_event_derived
sv_event_info String,
patient_unique_id String
) ENGINE = MergeTree
ORDER BY ( variant_type, hugo_gene_symbol, genetic_profile_stable_id, sample_unique_id);
ORDER BY ( variant_type, entrez_gene_id, hugo_gene_symbol, genetic_profile_stable_id, sample_unique_id);

INSERT INTO genomic_event_derived
-- Insert Mutations
SELECT concat(cs.cancer_study_identifier, '_', sample.stable_id) AS sample_unique_id,
gene.hugo_gene_symbol AS hugo_gene_symbol,
gene.entrez_gene_id AS entrez_gene_id,
ifNull(gp.stable_id, 'WES') AS gene_panel_stable_id,
cs.cancer_study_identifier AS cancer_study_identifier,
g.stable_id AS genetic_profile_stable_id,
Expand Down Expand Up @@ -128,6 +130,7 @@ UNION ALL
-- Insert CNA Genes
SELECT concat(cs.cancer_study_identifier, '_', sample.stable_id) AS sample_unique_id,
gene.hugo_gene_symbol AS hugo_gene_symbol,
gene.entrez_gene_id AS entrez_gene_id,
ifNull(gp.stable_id, 'WES') AS gene_panel_stable_id,
cs.cancer_study_identifier AS cancer_study_identifier,
g.stable_id AS genetic_profile_stable_id,
Expand Down Expand Up @@ -155,6 +158,7 @@ UNION ALL
-- Insert Structural Variants Site1
SELECT concat(cs.cancer_study_identifier, '_', s.stable_id) AS sample_unique_id,
gene.hugo_gene_symbol AS hugo_gene_symbol,
gene.entrez_gene_id AS entrez_gene_id,
ifNull(gene_panel.stable_id, 'WES') AS gene_panel_stable_id,
cs.cancer_study_identifier AS cancer_study_identifier,
gp.stable_id AS genetic_profile_stable_id,
Expand All @@ -180,6 +184,7 @@ UNION ALL
-- Insert Structural Variants Site2
SELECT concat(cs.cancer_study_identifier, '_', s.stable_id) AS sample_unique_id,
gene.hugo_gene_symbol AS hugo_gene_symbol,
gene.entrez_gene_id AS entrez_gene_id,
ifNull(gene_panel.stable_id, 'WES') AS gene_panel_stable_id,
cs.cancer_study_identifier AS cancer_study_identifier,
gp.stable_id AS genetic_profile_stable_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<select id="getMutatedGenes" resultType="org.cbioportal.model.AlterationCountByGene">
SELECT
hugo_gene_symbol as hugoGeneSymbol,
1 as entrezGeneId,
entrez_gene_id as entrezGeneId,
COUNT(DISTINCT sample_unique_id) as numberOfAlteredCases,
COUNT(*) as totalCount
FROM genomic_event_derived
Expand All @@ -37,14 +37,14 @@
<include refid="mutationAlterationFilter"/>
</if>
</where>
GROUP BY hugo_gene_symbol;
GROUP BY entrez_gene_id, hugo_gene_symbol;
</select>

<!-- /cna-genes/fetch (returns CopyNumberCountByGene) -->
<select id="getCnaGenes" resultType="org.cbioportal.model.CopyNumberCountByGene">
SELECT
hugo_gene_symbol as hugoGeneSymbol,
1 as entrezGeneId,
entrez_gene_id as entrezGeneId,
cna_alteration as alteration,
cna_cytoband as cytoband,
COUNT(DISTINCT sample_unique_id) as numberOfAlteredCases,
Expand All @@ -59,13 +59,13 @@
<include refid="cnaAlterationFilter"/>
</if>
</where>
GROUP BY hugo_gene_symbol, alteration, cytoband;
GROUP BY entrez_gene_id, hugo_gene_symbol, alteration, cytoband;
</select>

<select id="getStructuralVariantGenes" resultType="org.cbioportal.model.AlterationCountByGene">
SELECT
hugo_gene_symbol as hugoGeneSymbol,
1 as entrezGeneId,
entrez_gene_id as entrezGeneId,
COUNT(DISTINCT sample_unique_id) as numberOfAlteredCases,
COUNT(*) as totalCount
FROM genomic_event_derived
Expand All @@ -75,7 +75,7 @@
<property name="filter_type" value="'SAMPLE_AND_PATIENT_ID'"/>
</include>
</where>
GROUP BY hugo_gene_symbol;
GROUP BY entrez_gene_id, hugo_gene_symbol;
</select>

<select id="getSampleClinicalDataFromStudyViewFilter" resultType="org.cbioportal.model.ClinicalData">
Expand Down

0 comments on commit d7af5e5

Please sign in to comment.