Q (sonnet): What are the most frequently altered genes in KRAS wild-type lung adenocarcinoma patients? ▶ read_guide { "uri": "cbioportal://mutation-frequency-guide" } ▶ read_guide { "uri": "cbioportal://study-resolution-guide" } ◀ 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 # Study Resolution Guide Use this guide when the user names a study, cohort, portal, or data source that may not exist in the connected cBioPortal deployment. ## Routing Triggers Read this guide when the user mentions: - PBTA, Pediatric Brain Tumor Atlas, pediatric cBioPortal, Kids First - GENIE, AACR GENIE, MSK private cohorts, institutional cohorts - "download study", "which study", "find cohort", "data from [portal]" - a named cohort that `list_studies(search=...)` does not find ## Core Rules 1. Resolve the requested study before substituting another study. 2. If the requested study is not in this deployment, say so explicitly. 3. Do not silently analyze a substitute cohort. 4. If the user agrees to a substitute, keep a one-line scope caveat when reporting numbers. ## Known External cBioPortal Instances These are not necessarily queryable from this MCP server, but they are useful redirects: | User wording | Likely external instance | Scope | |---|---|---| | PBTA, Pediatric Brain Tumor Atlas, pediatric brain tumors | https://pedcbioportal.kidsfirstdrc.org/ | Pediatric cancer studies, including pediatric brain tumor cohorts | | GENIE | https://genie.cbioportal.org/ | AACR GENIE data access, depending on release and permissions | | MSK private / institutional cohorts | private institutional cBioPortal deployments | Not queryable from public cBioPortal unless exported to the public database | ## Study Resolution Workflow 1. Call `list_studies(search=...)` with the user's exact study/cohort phrase and close variants. 2. If a cancer type is mentioned, call `search_oncotree(search_term)` before disease-level study discovery. 3. If no matching study is found, check known external instances above before declaring the study absent. 4. If proposing a substitute, describe why it is a substitute and how its scope differs. ## Substitute-Cohort Answer Pattern > I cannot query PBTA from this cBioPortal deployment. PBTA is typically accessed through pediatric cBioPortal at https://pedcbioportal.kidsfirstdrc.org/. I can analyze `[substitute_study_id]` here, but its results should not be interpreted as PBTA results. When reporting numbers from a substitute: > Scope note: these counts are from `[substitute_study_id]` in this deployment, not from the requested PBTA cohort. ## Do Not - Do not answer a PBTA question with `brain_cptac_2020` numbers without a scope warning. - Do not let later turns drop the substitute-cohort warning. - Do not claim a study does not exist globally; say it is not available in the connected deployment. ▶ clickhouse_run_select_query { "query": "SELECT * FROM co_altered_genes_in_study(study = 'luad_tcga_pan_can_atlas_2018', gene = 'KRAS', top_n = 20)" } ◀ result {"rows":[{"hugo_gene_symbol":"TP53","mutant_altered":62,"mutant_profiled":168,"mutant_pct":36.9,"wildtype_altered":233,"wildtype_profiled":398,"wildtype_pct":58.5,"pct_difference":-21.6},{"hugo_gene_symbol":"EGFR","mutant_altered":1,"mutant_profiled":168,"mutant_pct":0.6,"wildtype_altered":69,"wildtype_profiled":398,"wildtype_pct":17.3,"pct_difference":-16.7},{"hugo_gene_symbol":"STK11","mutant_altered":38,"mutant_profiled":168,"mutant_pct":22.6,"wildtype_altered":37,"wildtype_profiled":398,"wildtype_pct":9.3,"pct_difference":13.3},{"hugo_gene_symbol":"ATM","mutant_altered":28,"mutant_profiled":168,"mutant_pct":16.7,"wildtype_altered":19,"wildtype_profiled":398,"wildtype_pct":4.8,"pct_difference":11.9},{"hugo_gene_symbol":"MUC16","mutant_altered":84,"mutant_profiled":168,"mutant_pct":50,"wildtype_altered":158,"wildtype_profiled":398,"wildtype_pct":39.7,"pct_difference":10.3},{"hugo_gene_symbol":"NF1","mutant_altered":8,"mutant_profiled":168,"mutant_pct":4.8,"wildtype_altered":58,"wildtype_profiled":398,"wildtype_pct":14.6,"pct_difference":-9.8},{"hugo_gene_symbol":"CSMD1","mutant_altered":48,"mutant_profiled":168,"mutant_pct":28.6,"wildtype_altered":77,"wildtype_profiled":398,"wildtype_pct":19.3,"pct_difference":9.3},{"hugo_gene_symbol":"CNTNAP2","mutant_altered":32,"mutant_profiled":168,"mutant_pct":19,"wildtype_altered":39,"wildtype_profiled":398,"wildtype_pct":9.8,"pct_difference":9.2},{"hugo_gene_symbol":"RIMS2","mutant_altered":32,"mutant_profiled":168,"mutant_pct":19,"wildtype_altered":40,"wildtype_profiled":398,"wildtype_pct":10.1,"pct_difference":8.9},{"hugo_gene_symbol":"LRP1B","mutant_altered":69,"mutant_profiled":168,"mutant_pct":41.1,"wildtype_altered":132,"wildtype_profiled":398,"wildtype_pct":33.2,"pct_difference":7.9},{"hugo_gene_symbol":"LRRC7","mutant_altered":34,"mutant_profiled":168,"mutant_pct":20.2,"wildtype_altered":49,"wildtype_profiled":398,"wildtype_pct":12.3,"pct_difference":7.9},{"hugo_gene_symbol":"TNR","mutant_altered":19,"mutant_profiled":168,"mutant_pct":11.3,"wildtype_altered":76,"wildtype_profiled":398,"wildtype_pct":19.1,"pct_difference":-7.8},{"hugo_gene_symbol":"BRAF","mutant_altered":3,"mutant_profiled":168,"mutant_pct":1.8,"wildtype_altered":38,"wildtype_profiled":398,"wildtype_pct":9.5,"pct_difference":-7.7},{"hugo_gene_symbol":"RP1L1","mutant_altered":37,"mutant_profiled":168,"mutant_pct":22,"wildtype_altered":60,"wildtype_profiled":398,"wildtype_pct":15.1,"pct_difference":6.9},{"hugo_gene_symbol":"ZFHX4","mutant_altered":63,"mutant_profiled":168,"mutant_pct":37.5,"wildtype_altered":122,"wildtype_profiled":398,"wildtype_pct":30.7,"pct_difference":6.8},{"hugo_gene_symbol":"HECTD4","mutant_altered":18,"mutant_profiled":168,"mutant_pct":10.7,"wildtype_altered":16,"wildtype_profiled":398,"wildtype_pct":4,"pct_difference":6.7},{"hugo_gene_symbol":"KMT2C","mutant_altered":15,"mutant_profiled":168,"mutant_pct":8.9,"wildtype_altered":62,"wildtype_profiled":398,"wildtype_pct":15.6,"pct_difference":-6.7},{"hugo_gene_ … (513 more chars) ▶ resolve_and_route { "studyIds": [ "luad_tcga_pan_can_atlas_2018" ] } ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"luad_tcga_pan_can_atlas_2018","name":"Lung Adenocarcinoma (TCGA, PanCancer Atlas)","sampleCount":566,"studyViewUrl":"https://www.cbioportal.org/study?id=luad_tcga_pan_can_atlas_2018","metadata":{"clinicalAttributeIds":["AGE","AJCC_PATHOLOGIC_TUMOR_STAGE","AJCC_STAGING_EDITION","ANEUPLOIDY_SCORE","BUFFA_HYPOXIA_SCORE","CANCER_TYPE","CANCER_TYPE_ACRONYM","CANCER_TYPE_DETAILED","DAYS_LAST_FOLLOWUP","DAYS_TO_BIRTH","DAYS_TO_INITIAL_PATHOLOGIC_DIAGNOSIS","DFS_MONTHS","DFS_STATUS","DSS_MONTHS","DSS_STATUS","ETHNICITY","FORM_COMPLETION_DATE","FRACTION_GENOME_ALTERED","GENETIC_ANCESTRY_LABEL","GRADE","HISTORY_NEOADJUVANT_TRTYN","ICD_10","ICD_O_3_HISTOLOGY","ICD_O_3_SITE","INFORMED_CONSENT_VERIFIED","IN_PANCANPATHWAYS_FREEZE","MSI_SCORE_MANTIS","MSI_SENSOR_SCORE","MUTATION_COUNT","NEW_TUMOR_EVENT_AFTER_INITIAL_TREATMENT","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","OTHER_PATIENT_ID","PATH_M_STAGE","PATH_N_STAGE","PATH_T_STAGE","PERSON_NEOPLASM_CANCER_STATUS","PFS_MONTHS","PFS_STATUS","PRIMARY_LYMPH_NODE_PRESENTATION_ASSESSMENT","PRIOR_DX","RACE","RADIATION_THERAPY","RAGNUM_HYPOXIA_SCORE","SAMPLE_COUNT","SAMPLE_TYPE","SEX","SOMATIC_STATUS","SUBTYPE","TBL_SCORE","TISSUE_PROSPECTIVE_COLLECTION_INDICATOR","TISSUE_RETROSPECTIVE_COLLECTION_INDICATOR","TISSUE_SOURCE_SITE","TISSUE_SOURCE_SITE_CODE","TMB_NONSYNONYMOUS","TUMOR_TISSUE_SITE","TUMOR_TYPE","WEIGHT","WINTER_HYPOXIA_SCORE"],"molecularProfileIds":["luad_tcga_pan_can_atlas_2018_gistic","luad_tcga_pan_can_atlas_2018_log2CNA","luad_tcga_pan_can_atlas_2018_mutations","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores","luad_tcga_pan_can_atlas_2018_rppa","luad_tcga_pan_can_atlas_2018_rppa_Zscores","luad_tcga_pan_can_atlas_2018_structural_variants"],"genericAssayProfiles":["luad_tcga_pan_can_atlas_2018_armlevel_cna","luad_tcga_pan_can_atlas_2018_genetic_ancestry","luad_tcga_pan_can_atlas_2018_methylation_hm27_hm450_merge","luad_tcga_pan_can_atlas_2018_methylation_hm450"],"heatmapProfileIds":["luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","luad_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores","luad_tcga_pan_can_atlas_2018_rppa_Zscores"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations","mrna","protein","generic_assay_armlevel_cna","generic_assay_genetic_ancestry","generic_assay_methylation"]}}]}} ▶ navigate_to_results_view { "studyIds": [ "luad_tcga_pan_can_atlas_2018" ], "genes": [ "KRAS: MUT", "TP53", "MUC16", "LRP1B", "ZFHX4", "STK11", "CSMD1", "EGFR", "ATM" ], "tab": "comparison/alterations", "profileFilter": "mutations" } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/results/comparison/alterations?cancer_study_list=luad_tcga_pan_can_atlas_2018&gene_list=KRAS%3A+MUT%0ATP53%0AMUC16%0ALRP1B%0AZFHX4%0ASTK11%0ACSMD1%0AEGFR%0AATM&case_set_id=luad_tcga_pan_can_atlas_2018_all&profileFilter=mutations","url":"https://www.cbioportal.org/results/comparison/alterations?cancer_study_list=luad_tcga_pan_can_atlas_2018&gene_list=KRAS%3A+MUT%0ATP53%0AMUC16%0ALRP1B%0AZFHX4%0ASTK11%0ACSMD1%0AEGFR%0AATM&case_set_id=luad_tcga_pan_can_atlas_2018_all&profileFilter=mutations","data":{"studyIds":["luad_tcga_pan_can_atlas_2018"],"studies":[{"studyId":"luad_tcga_pan_can_atlas_2018","name":"Lung Adenocarcinoma (TCGA, PanCancer Atlas)","sampleCount":566}],"genes":["KRAS","TP53","MUC16","LRP1B","ZFHX4","STK11","CSMD1","EGFR","ATM"],"caseSetId":"luad_tcga_pan_can_atlas_2018_all","pageDescription":"Comparison of rate of genomic alterations (mutations, CNA, structural variants) in all genes compared across groups defined by query genes."}} ═ answer (success) ## Most Frequently Altered Genes in KRAS-Wild-Type LUAD Patients **Cohort:** TCGA PanCancer Atlas Lung Adenocarcinoma (`luad_tcga_pan_can_atlas_2018`) — 398 KRAS-wild-type samples (profiled), 168 KRAS-mutant samples. Ranked by mutation frequency **within the KRAS-wild-type group** (sample-level, mutation-only): | Rank | Gene | KRAS-WT frequency | KRAS-mutant frequency (for reference) | |------|------|-------------------|----------------------------------------| | 1 | TP53 | 58.5% (233/398) | 36.9% | | 2 | MUC16 | 39.7% (158/398) | 50.0% | | 3 | LRP1B | 33.2% (132/398) | 41.1% | | 4 | ZFHX4 | 30.7% (122/398) | 37.5% | | 5 | CSMD1 | 19.3% (77/398) | 28.6% | | 6 | TNR | 19.1% (76/398) | 11.3% | | 7 | EGFR | 17.3% (69/398) | 0.6% | | 8 | NF1 | 14.6% (58/398) | 4.8% | | 9 | RP1L1 | 15.1% (60/398) | 22.0% | | 10 | KMT2C | 15.6% (62/398) | 8.9% | Notable contrasts vs. KRAS-mutant tumors: **EGFR** (17.3% vs 0.6%) and **BRAF** (9.5% vs 1.8%) are markedly enriched in the KRAS-wild-type group, consistent with the largely mutually exclusive driver-oncogene landscape in LUAD, while **STK11** (9.3% vs 22.6%) and **ATM** (4.8% vs 16.7%) are enriched in KRAS-mutant tumors. TTN and other very large passenger genes were excluded from this ranking since they are not disease-relevant drivers. These are mutation-frequency differences only (not amplifications/deletions), and no statistical testing has been applied — significance would require Fisher's exact test via the Mutual Exclusivity/Comparison tab. [View KRAS-Mutant vs Wild-Type Alteration Comparison](https://www.cbioportal.org/results/comparison/alterations?cancer_study_list=luad_tcga_pan_can_atlas_2018&gene_list=KRAS%3A+MUT%0ATP53%0AMUC16%0ALRP1B%0AZFHX4%0ASTK11%0ACSMD1%0AEGFR%0AATM&case_set_id=luad_tcga_pan_can_atlas_2018_all&profileFilter=mutations) This opens the Comparison/Alterations tab with KRAS mutation status defining the Altered/Unaltered (wild-type) groups, so you can explore full alteration rates (including CNA) interactively for these and other genes.