Skip to content

Commit 7342519

Browse files
authored
Add off_panel indicator for genomic_event_derived table (#11477)
1 parent 191dbf4 commit 7342519

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/main/resources/db-scripts/clickhouse/clickhouse.sql

+23-6
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ CREATE TABLE IF NOT EXISTS genomic_event_derived
9696
cna_alteration Nullable(Int8),
9797
cna_cytoband String,
9898
sv_event_info String,
99-
patient_unique_id String
99+
patient_unique_id String,
100+
off_panel Boolean DEFAULT FALSE
100101
) ENGINE = MergeTree
101-
ORDER BY ( variant_type, entrez_gene_id, hugo_gene_symbol, genetic_profile_stable_id, sample_unique_id);
102+
ORDER BY (variant_type, entrez_gene_id, hugo_gene_symbol, genetic_profile_stable_id, sample_unique_id);
102103

103104
INSERT INTO genomic_event_derived
104105
-- Insert Mutations
@@ -117,7 +118,11 @@ SELECT concat(cs.cancer_study_identifier, '_', sample.stable_id) AS sample_uniqu
117118
NULL AS cna_alteration,
118119
'' AS cna_cytoband,
119120
'' AS sv_event_info,
120-
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id
121+
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id,
122+
(gene_panel_stable_id, hugo_gene_symbol) NOT IN (
123+
SELECT gene_panel_id, gene
124+
FROM gene_panel_to_gene_derived
125+
) AS off_panel
121126
FROM mutation
122127
INNER JOIN mutation_event AS me ON mutation.mutation_event_id = me.mutation_event_id
123128
INNER JOIN sample_profile sp
@@ -145,7 +150,11 @@ SELECT concat(cs.cancer_study_identifier, '_', sample.stable_id) AS sample_uniqu
145150
ce.alteration AS cna_alteration,
146151
rgg.cytoband AS cna_cytoband,
147152
'' AS sv_event_info,
148-
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id
153+
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id,
154+
(gene_panel_stable_id, hugo_gene_symbol) NOT IN (
155+
SELECT gene_panel_id, gene
156+
FROM gene_panel_to_gene_derived
157+
) AS off_panel
149158
FROM cna_event ce
150159
INNER JOIN sample_cna_event sce ON ce.cna_event_id = sce.cna_event_id
151160
INNER JOIN sample_profile sp ON sce.sample_id = sp.sample_id AND sce.genetic_profile_id = sp.genetic_profile_id
@@ -173,7 +182,11 @@ SELECT concat(cs.cancer_study_identifier, '_', s.stable_id) AS sample_unique_id,
173182
NULL AS cna_alteration,
174183
'' AS cna_cytoband,
175184
event_info AS sv_event_info,
176-
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id
185+
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id,
186+
(gene_panel_stable_id, hugo_gene_symbol) NOT IN (
187+
SELECT gene_panel_id, gene
188+
FROM gene_panel_to_gene_derived
189+
) AS off_panel
177190
FROM structural_variant sv
178191
INNER JOIN genetic_profile gp ON sv.genetic_profile_id = gp.genetic_profile_id
179192
INNER JOIN sample s ON sv.sample_id = s.internal_id
@@ -199,7 +212,11 @@ SELECT concat(cs.cancer_study_identifier, '_', s.stable_id) AS sample_unique_id,
199212
NULL AS cna_alteration,
200213
'' AS cna_cytoband,
201214
event_info AS sv_event_info,
202-
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id
215+
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id,
216+
(gene_panel_stable_id, hugo_gene_symbol) NOT IN (
217+
SELECT gene_panel_id, gene
218+
FROM gene_panel_to_gene_derived
219+
) AS off_panel
203220
FROM structural_variant sv
204221
INNER JOIN genetic_profile gp ON sv.genetic_profile_id = gp.genetic_profile_id
205222
INNER JOIN sample s ON sv.sample_id = s.internal_id

0 commit comments

Comments
 (0)