Q (sonnet-5.5): show me the distribution of mutations in the tert promoter across cancer types ▶ read_guide { "uri": "cbioportal://mutation-frequency-guide" } ▶ read_guide { "uri": "cbioportal://common-pitfalls#16" } ◀ result # Mutation Frequency Analysis Guide ## IMPORTANT: Reporting Mutation Frequencies - **ALWAYS report frequencies as percentages**, not raw counts: `frequency = (altered_samples / total_profiled_samples) × 100` - For quick frequency lookups, **prefer the TCGA Pan-Cancer Atlas study first**, then offer to expand to other studies - When reporting across multiple studies, show **ranges** (e.g., "TP53 is mutated in 30–60% of samples") rather than a single average - **NEVER** sum mutation events across studies to compute an aggregate frequency — this can exceed 100% due to double-counting - Warn users that samples may overlap across cohorts (e.g., MSK studies may share patients) - **Choose and state the counting unit**: use patient-level frequencies for prevalence/rate questions unless the user explicitly asks for samples; use sample-level frequencies when the user asks about samples. - **For "across cancer types" questions**, jump to the [Cross-Cancer-Type Mutation Frequency](#cross-cancer-type-mutation-frequency) section below — there is one correct recipe and several common wrong ones. ## Counting Unit: Samples vs Patients Before answering any mutation count or frequency question, decide whether the unit is samples or patients and state that choice in the answer. | User wording | Counting unit | |--------------|---------------| | "prevalence", "rate", "fraction of patients", "patients with", "how common is" | Patient-level: `COUNT(DISTINCT patient_unique_id)` | | "samples", "specimens", "biopsies", sample-level cohort composition | Sample-level: `COUNT(DISTINCT sample_unique_id)` | | Ambiguous | Ask, or default to patient-level for prevalence/rate language and say so | ### Cross-study sample-count caveat When an answer touches more than one study and reports a sample count, prepend a one-line caveat: > Sample IDs are unique within cBioPortal study prefixes, not guaranteed biological-sample identifiers across studies; overlapping cohorts can count the same patient/sample more than once. Prefer one of these safer approaches: - Use a shipped `cancer_study_query_preferences` cohort such as `pan_cancer_tcga` or `all_studies_non_redundant`. - Restrict to one named study. - Aggregate by `patient_unique_id` when the biological question is patient prevalence. ## STOP rule: a frequency above 100% means your query is wrong If your query returns a frequency over 100%, **do not try to debug or explain the data inconsistency to the user**. The cause is always one of these query bugs: - Summing mutation events instead of `COUNT(DISTINCT sample_unique_id)` for the numerator - Using a study-wide sample count as the denominator instead of the gene-specific profiled count - Cross-study aggregation where the same biological sample appears under multiple `sample_unique_id` values (e.g., MSK-IMPACT and MSK-CHORD share patients) - **Joining the profiled CTE through `gene_panel` / `gene_panel_list` without a WES branch.** `gene_panel_id = 'WES'` is *not* a row in … (36467 more chars) ◀ result ### 16. 🚨 SILENT QUERY SUBSTITUTION ("did you mean...") When the user's wording differs from canonical terminology (e.g. "V600V" looks like "V600E" with a typo, or "point mutation" sounds like "missense"), it is forbidden to silently rewrite the question and answer the rewritten version. Doing so produces an answer that looks confident but is for a different question — the user cannot tell what was changed. #### ❌ Wrong: silently substitute > User: *"Find patients in colorectal cancer with the V600V alteration in BRAF"* > Agent: *(internally treats this as V600E)* "I found 412 samples with BRAF V600E in colorectal studies..." > User: *"What is the most prevalent TP53 mutation in uterine cancer that is not a point mutation?"* > Agent: *(internally treats "point mutation" = "missense", silently excludes only missense)* "The most prevalent non-missense TP53 mutation is..." #### ✅ Correct: answer the literal question, flag any normalization For an unusual-looking variant the user may have typed deliberately: - Query for what was asked, literally. - If 0 rows come back, **explain *why* zero is the expected answer** before suggesting a likely-intended alternative. For synonymous variants (e.g. BRAF V600V, TP53 R175R), the explanation is: *cBioPortal's mutation tables filter out synonymous (silent) variants in most studies, so 0 hits means "filtered upstream", not "no such variant exists in any patient"*. Then ask: *"Did you mean V600E (the canonical activating variant)? Or would you like me to look for V600V in the studies that do retain synonymous calls?"* - If the wording is ambiguous (e.g. "point mutation"), ask the user which definition they meant before querying — do not pick one silently. #### Mutation-type terminology mapping (use this to disambiguate) | User says | Canonical definition | `mutation_type` filter | |---|---|---| | "point mutation" | Any SNV (single-nucleotide variant) — includes missense, nonsense, synonymous, splice-site SNVs | `mutation_type IN ('Missense_Mutation','Nonsense_Mutation','Silent','Splice_Site')` — **but ask the user to confirm scope first** | | "missense" | Single amino-acid substitution that changes the protein | `mutation_type = 'Missense_Mutation'` | | "nonsense" / "stop-gain" | Premature stop codon | `mutation_type = 'Nonsense_Mutation'` | | "synonymous" / "silent" | Nucleotide change with no amino-acid change | `mutation_type = 'Silent'` (**often filtered out of public datasets** — see below) | | "splice site" | Mutation in canonical splice acceptor/donor | `mutation_type = 'Splice_Site'` | | "frameshift" | Indel changing reading frame | `mutation_type IN ('Frame_Shift_Ins','Frame_Shift_Del')` | | "indel" / "in-frame" | In-frame insertion or deletion | `mutation_type IN ('In_Frame_Ins','In_Frame_Del')` | | "truncating" | Anything that disrupts the protein early | `mutation_type IN ('Nonsense_Mutation','Frame_Shift_Ins','Frame_Shift_Del','Splice_Site','Nonstop_Mutation')` | **Synonymous-variant filter. … (785 more chars) ▶ clickhouse_list_table_columns { "table": "genomic_event_derived" } ◀ result {"columns":[{"name":"sample_unique_id","type":"String"},{"name":"hugo_gene_symbol","type":"String","comment":"HUGO gene symbol (e.g., TP53, KRAS, BRAF). Use for gene-specific queries."},{"name":"entrez_gene_id","type":"Int32"},{"name":"gene_panel_stable_id","type":"LowCardinality(String)"},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"genetic_profile_stable_id","type":"LowCardinality(String)"},{"name":"variant_type","type":"LowCardinality(String)","comment":"Type of genomic event: \"mutation\" for SNVs/indels, \"cna\" for copy number alterations, \"structural_variant\" for SVs. Always filter by this."},{"name":"mutation_variant","type":"String","comment":"Protein change notation (e.g., p.V600E, p.R175H). Use for specific variant queries. \"NA\" for non-mutation events."},{"name":"mutation_type","type":"LowCardinality(String)"},{"name":"mutation_status","type":"LowCardinality(String)","comment":"For mutations: Somatic, Germline, UNKNOWN, or UNCALLED. Filter mutation_status != \"UNCALLED\" to exclude uncertain calls. Include all other statuses."},{"name":"driver_filter","type":"LowCardinality(String)"},{"name":"driver_filter_annotation","type":"String"},{"name":"driver_tiers_filter","type":"LowCardinality(String)"},{"name":"driver_tiers_filter_annotation","type":"String"},{"name":"cna_alteration","type":"Nullable(Int8)","comment":"Copy number alteration: only 2 = amplification (AMP) and -2 = deep deletion (HOMDEL) are stored. Shallow deletion (-1), diploid (0) and gain (1) are not in this table; query genetic_alteration_derived WHERE profile_type = 'gistic' (alteration_value is a String, e.g. '-1'). NULL for non-CNA events."},{"name":"cna_cytoband","type":"String"},{"name":"sv_event_info","type":"String"},{"name":"patient_unique_id","type":"String"},{"name":"off_panel","type":"Bool","comment":"Boolean: 1 = mutation outside gene panel coverage (off-panel), 0 = within panel (on-panel). Filter off_panel = 0 for reliable frequency calculations."}]} ▶ clickhouse_run_select_query { "query": "SELECT mutation_type, count() n, uniqExact(sample_unique_id) s, groupArray(5)(mutation_variant) ex FROM genomic_event_derived WHERE hugo_gene_symbol='TERT' AND variant_type='mutation' AND cancer_study_identifier IN (SELECT cancer_study_identifier FROM cancer_study_query_preferences WHERE preference_name='pan_cancer_tcga') GROUP BY mutation_type ORDER BY n DESC" } ◀ result {"rows":[{"mutation_type":"Missense_Mutation","n":117,"s":107,"ex":["T878N","V1035I","R698W","L621I","N1120S"]},{"mutation_type":"Frame_Shift_Del","n":4,"s":4,"ex":["F1032Sfs*16","Q722Rfs*45","T1113Lfs*62","V1070Cfs*13"]},{"mutation_type":"Nonsense_Mutation","n":3,"s":3,"ex":["Y386*","S1095*","G641*"]},{"mutation_type":"Splice_Region","n":3,"s":3,"ex":["X862_splice","X860_splice","X794_splice"]},{"mutation_type":"Splice_Site","n":1,"s":1,"ex":["X823_splice"]}]} ▶ clickhouse_run_select_query { "query": "SELECT mutation_type, count() n, uniqExact(sample_unique_id) s, groupArray(5)(mutation_variant) ex FROM genomic_event_derived WHERE hugo_gene_symbol='TERT' AND variant_type='mutation' AND cancer_study_identifier='msk_impact_50k_2026' GROUP BY mutation_type ORDER BY n DESC" } ◀ result {"rows":[{"mutation_type":"5'Flank","n":6870,"s":6634,"ex":["Promoter","Promoter","Promoter","Promoter","Promoter"]},{"mutation_type":"Missense_Mutation","n":1098,"s":989,"ex":["F693L","G463D","A154P","R671W","P320L"]},{"mutation_type":"Frame_Shift_Del","n":36,"s":36,"ex":["P421Qfs*88","P308Hfs*43","E113Rfs*15","E113Rfs*15","P308Hfs*43"]},{"mutation_type":"Nonsense_Mutation","n":24,"s":24,"ex":["L989*","E793*","W510*","E668*","Q569*"]},{"mutation_type":"Splice_Site","n":9,"s":9,"ex":["X885_splice","X590_splice","X823_splice","X271_splice","X650_splice"]},{"mutation_type":"Frame_Shift_Ins","n":4,"s":4,"ex":["E113Rfs*79","E113Rfs*79","A1058Gfs*119","E113Rfs*79"]},{"mutation_type":"Splice_Region","n":2,"s":2,"ex":["X948_splice","X1099_splice"]},{"mutation_type":"In_Frame_Del","n":1,"s":1,"ex":["D43_A45del"]}]} ▶ clickhouse_run_select_query { "query": "WITH sct AS (SELECT sample_unique_id, attribute_value AS cancer_type FROM clinical_data_derived WHERE cancer_study_identifier='msk_impact_50k_2026' AND attribute_name='CANCER_TYPE'), alt AS (SELECT sct.cancer_type, uniqExact(g.sample_unique_id) a FROM genomic_event_derived g JOIN sct USING sample_unique_id WHERE g.cancer_study_identifier='msk_impact_50k_2026' AND g.hugo_gene_symbol='TERT' AND g.variant_type='mutation' AND g.mutation_type='5''Flank' AND g.mutation_status!='UNCALLED' AND g.off_panel=0 GROUP BY sct.cancer_type), prof AS (SELECT sct.cancer_type, uniqExact(p.sample_unique_id) n FROM (SELECT sample_unique_id FROM mutation_panel_gene_coverage WHERE hugo_gene_symbol='TERT' AND cancer_study_identifier='msk_impact_50k_2026' UNION ALL SELECT sample_unique_id FROM mutation_wes_coverage WHERE cancer_study_identifier='msk_impact_50k_2026') p JOIN sct USING sample_unique_id GROUP BY sct.cancer_type) SELECT prof.cancer_type, alt.a AS altered, prof.n AS profiled, round(alt.a*100/prof.n,1) pct FROM prof JOIN alt USING cancer_type WHERE prof.n>=50 ORDER BY pct DESC", "max_rows": 100 } ▶ resolve_and_route { "studyIds": [ "msk_impact_50k_2026" ] } ◀ result {"rows":[{"cancer_type":"Bladder Cancer","altered":1781,"profiled":2526,"pct":70.5},{"cancer_type":"Glioma","altered":1528,"profiled":2322,"pct":65.8},{"cancer_type":"Melanoma","altered":1037,"profiled":1831,"pct":56.6},{"cancer_type":"Thyroid Cancer","altered":475,"profiled":867,"pct":54.8},{"cancer_type":"Sex Cord Stromal Tumor","altered":35,"profiled":91,"pct":38.5},{"cancer_type":"Vaginal Cancer","altered":20,"profiled":57,"pct":35.1},{"cancer_type":"Head and Neck Cancer","altered":199,"profiled":657,"pct":30.3},{"cancer_type":"Skin Cancer, Non-Melanoma","altered":136,"profiled":455,"pct":29.9},{"cancer_type":"Embryonal Tumor","altered":14,"profiled":80,"pct":17.5},{"cancer_type":"Hepatobiliary Cancer","altered":217,"profiled":1431,"pct":15.2},{"cancer_type":"Cancer of Unknown Primary","altered":180,"profiled":1581,"pct":11.4},{"cancer_type":"Renal Cell Carcinoma","altered":111,"profiled":1209,"pct":9.2},{"cancer_type":"Salivary Gland Cancer","altered":36,"profiled":411,"pct":8.8},{"cancer_type":"Miscellaneous Brain Tumor","altered":5,"profiled":58,"pct":8.6},{"cancer_type":"Cervical Cancer","altered":28,"profiled":351,"pct":8},{"cancer_type":"Soft Tissue Sarcoma","altered":177,"profiled":2307,"pct":7.7},{"cancer_type":"Adrenocortical Carcinoma","altered":6,"profiled":88,"pct":6.8},{"altered":3,"profiled":50,"pct":6},{"cancer_type":"Mesothelioma","altered":23,"profiled":408,"pct":5.6},{"cancer_type":"Bone Cancer","altered":29,"profiled":590,"pct":4.9},{"cancer_type":"Anal Cancer","altered":7,"profiled":143,"pct":4.9},{"cancer_type":"CNS Cancer","altered":8,"profiled":170,"pct":4.7},{"cancer_type":"Ampullary Cancer","altered":5,"profiled":134,"pct":3.7},{"cancer_type":"Small Bowel Cancer","altered":6,"profiled":161,"pct":3.7},{"cancer_type":"Wilms Tumor","altered":2,"profiled":68,"pct":2.9},{"cancer_type":"Nerve Sheath Tumor","altered":4,"profiled":142,"pct":2.8},{"cancer_type":"Uterine Sarcoma","altered":9,"profiled":344,"pct":2.6},{"cancer_type":"Ovarian Cancer","altered":54,"profiled":2140,"pct":2.5},{"cancer_type":"Non-Small Cell Lung Cancer","altered":189,"profiled":7867,"pct":2.4},{"cancer_type":"Endometrial Cancer","altered":59,"profiled":2445,"pct":2.4},{"cancer_type":"Small Cell Lung Cancer","altered":10,"profiled":466,"pct":2.1},{"cancer_type":"Sellar Tumor","altered":2,"profiled":106,"pct":1.9},{"cancer_type":"Colorectal Cancer","altered":99,"profiled":5277,"pct":1.9},{"cancer_type":"Peripheral Nervous System","altered":6,"profiled":411,"pct":1.5},{"cancer_type":"Gastrointestinal Neuroendocrine Tumor","altered":3,"profiled":210,"pct":1.4},{"cancer_type":"Esophagogastric Cancer","altered":18,"profiled":1834,"pct":1},{"cancer_type":"Appendiceal Cancer","altered":2,"profiled":274,"pct":0.7},{"cancer_type":"Breast Cancer","altered":46,"profiled":6807,"pct":0.7},{"cancer_type":"Gastrointestinal Stromal Tumor","altered":3,"profiled":635,"pct":0.5},{"cancer_type":"Pancreatic Cancer","altered":15,"profiled":2851,"pct":0.5},{"cancer_type":"G … (128 more chars) ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"msk_impact_50k_2026","name":"MSK-IMPACT 50K Clinical Sequencing Cohort (MSK, Cancer Cell 2026)","sampleCount":54331,"studyViewUrl":"https://www.cbioportal.org/study?id=msk_impact_50k_2026","metadata":{"clinicalAttributeIds":["AGE_AT_DX","ANCESTRY_LABEL","CANCER_TYPE","CANCER_TYPE_DETAILED","DISEASE_STATUS","FACETS_PLOIDY","FACETS_PURITY","FACETS_QC","FACETS_SUITE_VERSION","FACETS_WGD","FRACTION_GENOME_ALTERED","GENE_PANEL","HLA-A1","HLA-A2","HLA-B1","HLA-B2","HLA-C1","HLA-C2","HLA_A1_LOH","HLA_A2_LOH","HLA_B1_LOH","HLA_B2_LOH","HLA_C1_LOH","HLA_C2_LOH","HLA_GENOTYPE_AVAILABLE","METASTATIC_SITE","MSI_SCORE","MSI_TYPE","MUTATION_COUNT","N_OTHER_CANCER_TYPES","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","PRIMARY_SITE","PURITY_ESTIMATE_FROM_MUTATIONS","SAMPLE_COUNT","SAMPLE_COVERAGE","SAMPLE_TYPE","SEX","SOMATIC_STATUS","TMB_SCORE","TUMOR_PURITY"],"molecularProfileIds":["msk_impact_50k_2026_gistic","msk_impact_50k_2026_mutations","msk_impact_50k_2026_structural_variants"],"genericAssayProfiles":["msk_impact_50k_2026_armlevel_cna","msk_impact_50k_2026_loh_hla","msk_impact_50k_2026_mutational_signatures_contribution_v2"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations","generic_assay_armlevel_cna","generic_assay_loh_hla","generic_assay_mutational_signature"]}}]}} ▶ navigate_to_results_view { "studyIds": [ "msk_impact_50k_2026" ], "genes": [ "TERT: MUT" ], "tab": "cancerTypesSummary" } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/results/cancerTypesSummary?cancer_study_list=msk_impact_50k_2026&gene_list=TERT%3A+MUT&case_set_id=msk_impact_50k_2026_all","url":"https://www.cbioportal.org/results/cancerTypesSummary?cancer_study_list=msk_impact_50k_2026&gene_list=TERT%3A+MUT&case_set_id=msk_impact_50k_2026_all","data":{"studyIds":["msk_impact_50k_2026"],"studies":[{"studyId":"msk_impact_50k_2026","name":"MSK-IMPACT 50K Clinical Sequencing Cohort (MSK, Cancer Cell 2026)","sampleCount":54331}],"genes":["TERT"],"caseSetId":"msk_impact_50k_2026_all","pageDescription":"Alteration frequencies for queried genes by cancer type."}} ═ answer (success) TERT promoter mutations are most common in bladder cancer (70.5%), glioma (65.8%), melanoma (56.6%) and thyroid cancer (54.8%). They are rare in most other cancer types. **Cohort:** MSK-IMPACT 50K (MSK, Cancer Cell 2026). I used this study because the TCGA PanCancer Atlas cohort has no TERT promoter records. Its TERT calls are all coding (missense, truncating, splice). **What I counted:** Samples with a TERT mutation annotated as "5'Flank / Promoter". Coding TERT mutations are excluded. The database doesn't expose exact positions, so I can't split C228T from C250T. Frequency is altered samples divided by samples profiled for TERT. Only cancer types with at least 50 profiled samples are shown. | Cancer type | Altered | Profiled | % | |---|---|---|---| | Bladder Cancer | 1,781 | 2,526 | 70.5 | | Glioma | 1,528 | 2,322 | 65.8 | | Melanoma | 1,037 | 1,831 | 56.6 | | Thyroid Cancer | 475 | 867 | 54.8 | | Sex Cord Stromal Tumor | 35 | 91 | 38.5 | | Vaginal Cancer | 20 | 57 | 35.1 | | Head and Neck Cancer | 199 | 657 | 30.3 | | Skin Cancer, Non-Melanoma | 136 | 455 | 29.9 | | Embryonal Tumor | 14 | 80 | 17.5 | | Hepatobiliary Cancer | 217 | 1,431 | 15.2 | | Cancer of Unknown Primary | 180 | 1,581 | 11.4 | | Renal Cell Carcinoma | 111 | 1,209 | 9.2 | | Salivary Gland Cancer | 36 | 411 | 8.8 | | Miscellaneous Brain Tumor | 5 | 58 | 8.6 | | Cervical Cancer | 28 | 351 | 8.0 | | Soft Tissue Sarcoma | 177 | 2,307 | 7.7 | | Adrenocortical Carcinoma | 6 | 88 | 6.8 | | Mesothelioma | 23 | 408 | 5.6 | | Bone Cancer | 29 | 590 | 4.9 | | Anal Cancer | 7 | 143 | 4.9 | | CNS Cancer | 8 | 170 | 4.7 | | Ampullary Cancer | 5 | 134 | 3.7 | | Small Bowel Cancer | 6 | 161 | 3.7 | | Wilms Tumor | 2 | 68 | 2.9 | | Nerve Sheath Tumor | 4 | 142 | 2.8 | | Uterine Sarcoma | 9 | 344 | 2.6 | | Ovarian Cancer | 54 | 2,140 | 2.5 | | Non-Small Cell Lung Cancer | 189 | 7,867 | 2.4 | | Endometrial Cancer | 59 | 2,445 | 2.4 | | Small Cell Lung Cancer | 10 | 466 | 2.1 | | Sellar Tumor | 2 | 106 | 1.9 | | Colorectal Cancer | 99 | 5,277 | 1.9 | | Peripheral Nervous System | 6 | 411 | 1.5 | | GI Neuroendocrine Tumor | 3 | 210 | 1.4 | | Esophagogastric Cancer | 18 | 1,834 | 1.0 | | Appendiceal Cancer | 2 | 274 | 0.7 | | Breast Cancer | 46 | 6,807 | 0.7 | | Gastrointestinal Stromal Tumor | 3 | 635 | 0.5 | | Pancreatic Cancer | 15 | 2,851 | 0.5 | | Germ Cell Tumor | 3 | 725 | 0.4 | | Prostate Cancer | 11 | 3,324 | 0.3 | One additional group has no cancer-type label: 3 of 50 samples (6%). **Caveats:** - The unit is samples, not patients. Some patients have more than one sample. - Cancer-type labels are the study's own broad categories. Glioma, for example, pools several histologies. [View TERT alteration frequencies by cancer type in MSK-IMPACT 50K](https://www.cbioportal.org/results/cancerTypesSummary?cancer_study_list=msk_impact_50k_2026&gene_list=TERT%3A+MUT&case_set_id=msk_impact_50k_2026_all) That link uses `TERT: MUT`, which counts all TERT mutations. Coding mutations are included, so its percentages will be slightly higher than the promoter-only figures above.