Q (haiku): show me all KRAS mutations in colorectal cancer that are not at position 12 ▶ read_guide { "uri": "cbioportal://mutation-frequency-guide" } ▶ search_oncotree { "search_term": "colorectal" } ◀ 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 … (35166 more chars) ◀ result {"result":[{"code":"COADREAD","name":"Colorectal Adenocarcinoma","score":60,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD"},{"code":"CAIS","name":"Colon Adenocarcinoma In Situ","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD > CAIS"},{"code":"CMC","name":"Medullary Carcinoma of the Colon","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > CMC"},{"code":"COAD","name":"Colon Adenocarcinoma","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD > COAD"},{"code":"MACR","name":"Mucinous Adenocarcinoma of the Colon and Rectum","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD > MACR"},{"code":"READ","name":"Rectal Adenocarcinoma","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD > READ"},{"code":"SRCCR","name":"Signet Ring Cell Adenocarcinoma of the Colon and Rectum","score":45,"mainType":"Colorectal Cancer","tissue":"Bowel","hierarchy":"BOWEL > COADREAD > SRCCR"}]} ▶ list_studies { "search": "colorectal", "limit": 10 } ◀ result {"result":[{"cancer_study_identifier":"msk_met_2021","name":"MSK MetTropism (MSK, Cell 2021)","type_of_cancer_id":"mixed","sample_count":25775,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=msk_met_2021"},{"cancer_study_identifier":"crc_msk_2026","name":"Colorectal Adenocarcinoma (MSK, 2026)","type_of_cancer_id":"read","sample_count":7237,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=crc_msk_2026"},{"cancer_study_identifier":"crc_eo_2020","name":"Colorectal Cancer (MSK, JNCI 2021)","type_of_cancer_id":"bowel","sample_count":1516,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=crc_eo_2020"},{"cancer_study_identifier":"crc_msk_2017","name":"Metastatic Colorectal Cancer (MSK, Cancer Cell 2018)","type_of_cancer_id":"coadread","sample_count":1134,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=crc_msk_2017"},{"cancer_study_identifier":"crc_sysucc_2022","name":"Colorectal Cancer- ChangKang Project (SYSUCC, Nat Commun 2022)","type_of_cancer_id":"coadread","sample_count":1015,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=crc_sysucc_2022"},{"cancer_study_identifier":"coadread_tcga","name":"Colorectal Adenocarcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"coadread","sample_count":640,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=coadread_tcga"},{"cancer_study_identifier":"coadread_dfci_2016","name":"Colorectal Adenocarcinoma (DFCI, Cell Reports 2016)","type_of_cancer_id":"coadread","sample_count":619,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=coadread_dfci_2016"},{"cancer_study_identifier":"coadread_tcga_pan_can_atlas_2018","name":"Colorectal Adenocarcinoma (TCGA, PanCancer Atlas)","type_of_cancer_id":"coadread","sample_count":594,"has_guide":true,"url":"https://www.cbioportal.org/study/summary?id=coadread_tcga_pan_can_atlas_2018"},{"cancer_study_identifier":"crc_apc_impact_2020","name":"Colorectal Cancer (MSK, Gastroenterology 2020)","type_of_cancer_id":"coadread","sample_count":471,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=crc_apc_impact_2020"},{"cancer_study_identifier":"coadread_tcga_pub","name":"Colorectal Adenocarcinoma (TCGA, Nature 2012)","type_of_cancer_id":"coadread","sample_count":276,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=coadread_tcga_pub"}]} ▶ clickhouse_run_select_query { "query": " SELECT hugo_gene_symbol, mutation_variant, mutation_type, COUNT(DISTINCT sample_unique_id) AS num_samples, COUNT(*) AS total_events FROM genomic_event_derived WHERE cancer_study_identifier = 'crc_msk_2026' AND hugo_gene_symbol = 'KRAS' AND variant_type = 'mutation' AND mutation_status != 'UNCALLED' AND off_panel = 0 -- Filter out position 12 mutations by looking for variants that don't start with 'G12' AND mutation_variant NOT LIKE 'G12%' GROUP BY hugo_gene_symbol, mutation_variant, mutation_type ORDER BY num_samples DESC, total_events DESC ", "max_rows": 500 } ◀ result {"rows":[{"hugo_gene_symbol":"KRAS","mutation_variant":"G13D","mutation_type":"Missense_Mutation","num_samples":569,"total_events":569},{"hugo_gene_symbol":"KRAS","mutation_variant":"A146T","mutation_type":"Missense_Mutation","num_samples":185,"total_events":185},{"hugo_gene_symbol":"KRAS","mutation_variant":"Q61H","mutation_type":"Missense_Mutation","num_samples":74,"total_events":74},{"hugo_gene_symbol":"KRAS","mutation_variant":"K117N","mutation_type":"Missense_Mutation","num_samples":35,"total_events":35},{"hugo_gene_symbol":"KRAS","mutation_variant":"A146V","mutation_type":"Missense_Mutation","num_samples":35,"total_events":35},{"hugo_gene_symbol":"KRAS","mutation_variant":"G13C","mutation_type":"Missense_Mutation","num_samples":27,"total_events":27},{"hugo_gene_symbol":"KRAS","mutation_variant":"Q61K","mutation_type":"Missense_Mutation","num_samples":26,"total_events":26},{"hugo_gene_symbol":"KRAS","mutation_variant":"Q61R","mutation_type":"Missense_Mutation","num_samples":20,"total_events":20},{"hugo_gene_symbol":"KRAS","mutation_variant":"A59T","mutation_type":"Missense_Mutation","num_samples":15,"total_events":15},{"hugo_gene_symbol":"KRAS","mutation_variant":"Q61L","mutation_type":"Missense_Mutation","num_samples":12,"total_events":12},{"hugo_gene_symbol":"KRAS","mutation_variant":"V14I","mutation_type":"Missense_Mutation","num_samples":11,"total_events":11},{"hugo_gene_symbol":"KRAS","mutation_variant":"A146P","mutation_type":"Missense_Mutation","num_samples":11,"total_events":11},{"hugo_gene_symbol":"KRAS","mutation_variant":"D33E","mutation_type":"Missense_Mutation","num_samples":8,"total_events":8},{"hugo_gene_symbol":"KRAS","mutation_variant":"Q22K","mutation_type":"Missense_Mutation","num_samples":6,"total_events":6},{"hugo_gene_symbol":"KRAS","mutation_variant":"L19F","mutation_type":"Missense_Mutation","num_samples":5,"total_events":5},{"hugo_gene_symbol":"KRAS","mutation_variant":"G10dup","mutation_type":"In_Frame_Ins","num_samples":4,"total_events":4},{"hugo_gene_symbol":"KRAS","mutation_variant":"R68S","mutation_type":"Missense_Mutation","num_samples":4,"total_events":4},{"hugo_gene_symbol":"KRAS","mutation_variant":"D57N","mutation_type":"Missense_Mutation","num_samples":3,"total_events":3},{"hugo_gene_symbol":"KRAS","mutation_variant":"A59G","mutation_type":"Missense_Mutation","num_samples":3,"total_events":3},{"hugo_gene_symbol":"KRAS","mutation_variant":"G13R","mutation_type":"Missense_Mutation","num_samples":3,"total_events":3},{"hugo_gene_symbol":"KRAS","mutation_variant":"E98*","mutation_type":"Nonsense_Mutation","num_samples":2,"total_events":2},{"hugo_gene_symbol":"KRAS","mutation_variant":"K117Q","mutation_type":"Missense_Mutation","num_samples":2,"total_events":2},{"hugo_gene_symbol":"KRAS","mutation_variant":"T50I","mutation_type":"Missense_Mutation","num_samples":2,"total_events":2},{"hugo_gene_symbol":"KRAS","mutation_variant":"G13V","mutation_type":"Missense_Mutation","num_samples":2,"total_events":2},{"hugo_ge … (5213 more chars) ▶ clickhouse_run_select_query { "query": " SELECT COUNT(DISTINCT sample_unique_id) AS kras_profiled_samples FROM sample_to_gene_panel_derived WHERE cancer_study_identifier = 'crc_msk_2026' AND hugo_gene_symbol = 'KRAS' AND alteration_type = 'MUTATION_EXTENDED' ", "max_rows": 10 } ◀ result {"error_message":"Query execution failed: HTTPDriver for https://dl96orhu96.us-east-1.aws.clickhouse.cloud:8443 received ClickHouse error code 47\n Code: 47. DB::Exception: Unknown expression or function identifier `hugo_gene_symbol` in scope SELECT COUNTDistinct(sample_unique_id) AS kras_profiled_samples FROM sample_to_gene_panel_derived WHERE (cancer_study_identifier = 'crc_msk_2026') AND (hugo_gene_symbol = 'KRAS') AND (alteration_type = 'MUTATION_EXTENDED'). (UNKNOWN_IDENTIFIER) (version 26.4.1.2359 (official build))\n"} ▶ clickhouse_list_table_columns { "table": "sample_to_gene_panel_derived" } ◀ result {"columns":[{"name":"sample_unique_id","type":"String"},{"name":"alteration_type","type":"LowCardinality(String)"},{"name":"gene_panel_id","type":"LowCardinality(String)"},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"genetic_profile_id","type":"LowCardinality(String)"}]} ▶ clickhouse_run_select_query { "query": " SELECT COUNT(DISTINCT sample_unique_id) AS kras_profiled_samples FROM mutation_panel_gene_coverage WHERE cancer_study_identifier = 'crc_msk_2026' AND hugo_gene_symbol = 'KRAS' UNION ALL SELECT COUNT(DISTINCT sample_unique_id) AS kras_profiled_samples FROM mutation_wes_coverage WHERE cancer_study_identifier = 'crc_msk_2026' ", "max_rows": 10 } ◀ result {"rows":[{"kras_profiled_samples":0},{"kras_profiled_samples":7237}]} ▶ clickhouse_run_select_query { "query": " -- Total KRAS profiled samples (combine panel + WES) WITH kras_profiled AS ( SELECT COUNT(DISTINCT sample_unique_id) AS total_profiled FROM ( SELECT sample_unique_id FROM mutation_panel_gene_coverage WHERE cancer_study_identifier = 'crc_msk_2026' AND hugo_gene_symbol = 'KRAS' UNION ALL SELECT sample_unique_id FROM mutation_wes_coverage WHERE cancer_study_identifier = 'crc_msk_2026' ) ) SELECT kp.total_profiled FROM kras_profiled kp ", "max_rows": 10 } ◀ result {"rows":[{"total_profiled":7237}]} ▶ resolve_and_route { "studyIds": [ "crc_msk_2026" ] } ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"crc_msk_2026","name":"Colorectal Adenocarcinoma (MSK, 2026)","sampleCount":7237,"studyViewUrl":"https://www.cbioportal.org/study?id=crc_msk_2026","metadata":{"clinicalAttributeIds":["CANCER_TYPE","CANCER_TYPE_DETAILED","ETHNICITY","FRACTION_GENOME_ALTERED","GENE_PANEL","METASTATIC_SITE","MSI_SCORE","MSI_TYPE","MUTATION_COUNT","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","PRIMARY_SITE","RACE","SAMPLE_CLASS","SAMPLE_COUNT","SAMPLE_COVERAGE","SAMPLE_TYPE","SEX","SOMATIC_STATUS","STAGE_HIGHEST_RECORDED","TMB_NONSYNONYMOUS","TUMOR_PURITY"],"molecularProfileIds":["crc_msk_2026_cna","crc_msk_2026_mutations","crc_msk_2026_structural_variants"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations"]}}]}} ▶ navigate_to_results_view { "studyIds": [ "crc_msk_2026" ], "genes": [ "KRAS: MUT != G12" ], "tab": "mutations" } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/results/mutations?cancer_study_list=crc_msk_2026&gene_list=KRAS%3A+MUT+%21%3D+G12&case_set_id=crc_msk_2026_all","url":"https://www.cbioportal.org/results/mutations?cancer_study_list=crc_msk_2026&gene_list=KRAS%3A+MUT+%21%3D+G12&case_set_id=crc_msk_2026_all","data":{"studyIds":["crc_msk_2026"],"studies":[{"studyId":"crc_msk_2026","name":"Colorectal Adenocarcinoma (MSK, 2026)","sampleCount":7237}],"genes":["KRAS"],"caseSetId":"crc_msk_2026_all","pageDescription":"Detailed mutation table with lollipop plot showing mutation positions, types, and frequencies for queried genes."}} ═ answer (success) Perfect! Here are all **KRAS mutations in colorectal cancer (excluding position 12)**: ## Summary — MSK Colorectal Adenocarcinoma (2026) **Cohort:** 7,237 samples profiled for KRAS mutations **Unit:** Sample-level frequencies (samples are the biological unit for this cohort) --- ## Top KRAS Mutations (Non-Position 12) | Variant | Mutation Type | # Samples | Frequency | |---------|---------------|-----------|-----------| | **G13D** | Missense | 569 | 7.9% | | **A146T** | Missense | 185 | 2.6% | | **Q61H** | Missense | 74 | 1.0% | | **K117N** | Missense | 35 | 0.5% | | **A146V** | Missense | 35 | 0.5% | | **G13C** | Missense | 27 | 0.4% | | **Q61K** | Missense | 26 | 0.4% | | **Q61R** | Missense | 20 | 0.3% | | **A59T** | Missense | 15 | 0.2% | | **Q61L** | Missense | 12 | 0.2% | | **V14I** | Missense | 11 | 0.2% | | **A146P** | Missense | 11 | 0.2% | **All other variants** (42 additional unique mutations at low frequency: D33E, Q22K, L19F, frameshift insertions, indels, nonsense, and rare amino acid changes) account for **~80 samples total** (1.1%). --- ## Key Findings 1. **G13D dominates** — by far the most common non-G12 KRAS mutation at 7.9% of the cohort, followed by a long tail of low-frequency events. 2. **A146 cluster** (A146T, A146V, A146P, A146E) — collectively ~240 samples (3.3%) at position 146, the second-most active hotspot after G12/G13. 3. **Q61 cluster** (Q61H, Q61K, Q61R, Q61L, Q61D) — ~153 samples (2.1%) at position 61. 4. **Rare structural variants** — a single in-frame insertion, frameshift indel, and nonsense mutation each, likely of uncertain significance. --- ## Navigate to Interactive View [View KRAS mutations (non-position 12) in cBioPortal](https://www.cbioportal.org/results/mutations?cancer_study_list=crc_msk_2026&gene_list=KRAS%3A+MUT+%21%3D+G12&case_set_id=crc_msk_2026_all) This link takes you directly to the **Mutations tab**, where you can: - See the lollipop plot showing each mutation's position and frequency - Filter by mutation type, sample properties, or clinical attributes - Export the full mutation table - View individual patient profiles