Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Created May 28, 2024 03:32
Show Gist options
  • Save lfy79001/1718fad192204afb58974526162bc0ba to your computer and use it in GitHub Desktop.
Save lfy79001/1718fad192204afb58974526162bc0ba to your computer and use it in GitHub Desktop.
WITH
mutCounts AS (
SELECT
COUNT(DISTINCT( Tumor_SampleBarcode )) AS CaseCount,
Hugo_Symbol,
HGVSc
FROM
`isb-cgc-bq.pancancer_atlas.Filtered_MC3_MAF_V5_one_per_tumor_sample`
GROUP BY
Hugo_Symbol,
HGVSc
),
mutRatios AS (
SELECT
HGVSc,
Hugo_Symbol,
CaseCount,
(CaseCount/SUM(CaseCount) OVER (PARTITION BY Hugo_Symbol)) AS ratio
FROM
mutCounts
)
SELECT *
FROM
mutRatios
WHERE
CaseCount>=10
AND ratio>=0.2
AND HGVSc is not null
ORDER BY
ratio DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment