-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbq161.sql
More file actions
30 lines (30 loc) · 1.12 KB
/
bq161.sql
File metadata and controls
30 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
WITH paad_patients AS (
SELECT DISTINCT bcr_patient_barcode
FROM `isb-cgc-bq.pancancer_atlas.Filtered_clinical_PANCAN_patient_with_followup`
WHERE acronym = 'PAAD'
),
kras_mutations AS (
SELECT DISTINCT ParticipantBarcode
FROM `isb-cgc-bq.pancancer_atlas.Filtered_MC3_MAF_V5_one_per_tumor_sample`
WHERE Hugo_Symbol = 'KRAS' AND FILTER = 'PASS' AND Study = 'PAAD'
),
tp53_mutations AS (
SELECT DISTINCT ParticipantBarcode
FROM `isb-cgc-bq.pancancer_atlas.Filtered_MC3_MAF_V5_one_per_tumor_sample`
WHERE Hugo_Symbol = 'TP53' AND FILTER = 'PASS' AND Study = 'PAAD'
),
both_mutations AS (
SELECT k.ParticipantBarcode
FROM kras_mutations k
JOIN tp53_mutations t ON k.ParticipantBarcode = t.ParticipantBarcode
),
neither_mutation AS (
SELECT p.bcr_patient_barcode
FROM paad_patients p
LEFT JOIN kras_mutations k ON p.bcr_patient_barcode = k.ParticipantBarcode
LEFT JOIN tp53_mutations t ON p.bcr_patient_barcode = t.ParticipantBarcode
WHERE k.ParticipantBarcode IS NULL AND t.ParticipantBarcode IS NULL
)
SELECT
(SELECT COUNT(*) FROM both_mutations) -
(SELECT COUNT(*) FROM neither_mutation) AS net_difference