Q (sonnet-5.5): Which genomic alterations are associated with immunotherapy response in melanoma patients from the MSK-CHORD Study? ▶ read_guide { "uri": "cbioportal://statistical-tests-guide" } ▶ get_study_guide { "study_id": "msk_chord_2024" } ◀ result Statistical Test Selection Guide ================================ Purpose ------- This guide ensures the correct statistical test is selected before performing any group comparison, matching cBioPortal's own Group Comparison defaults. HARD RULES — NEVER FABRICATE A STATISTIC ---------------------------------------- ClickHouse cannot run statistical tests. The agent therefore must NEVER produce a derived statistic that is not a literal column value from a SQL result. Specifically: 1. **Never invent a p-value.** Not "p < 0.001", not "p ≈ 0.05", not any p-value. If the user asks "what is the p-value?", the answer is *"I can't compute that — here is the 2x2 contingency table (or group statistics). Run it in cBioPortal's Group Comparison tab, in R with `fisher.test(...)` / `wilcox.test(...)`, or in Python with `scipy.stats.fisher_exact(...)` / `mannwhitneyu(...)`."* 2. **Never claim mutual exclusivity (or co-occurrence) from a contingency table alone.** A 2x2 table is not a test. The shape "altered/not altered × group A/group B" needs Fisher's exact + a defined direction (odds ratio < 1 with significant p). Without that test, the agent presents the table and stops. Descriptive phrasing is also a claim: "largely/mostly mutually exclusive", "rarely co-occur", "tend to co-occur" are forbidden without the test — point to cBioPortal's Mutual Exclusivity tab instead. 3. **Never report a "median" that came from `AVG(...)` or any non-median aggregate.** "Median" and "mean" are different statistics; for skewed clinical distributions (especially survival) they differ substantially. Use ClickHouse's `quantile(0.5)(...)` for actual median, and label arithmetic averages as "mean", never "median". 4. **Never report a hazard ratio, odds ratio, risk ratio, or relative risk** that wasn't computed by an external tool. These require regression / model fitting that ClickHouse does not do. 5. **Never report median overall survival from `AVG(OS_MONTHS)` or even `quantile(0.5)(OS_MONTHS)`.** Median OS requires Kaplan-Meier estimation, which handles censoring (`OS_STATUS = 0:LIVING` means the event hasn't happened yet). Naive medians/means over `OS_MONTHS` ignore censoring and are systematically wrong. The correct handoff: return the raw `(OS_MONTHS, OS_STATUS)` pairs (or descriptive counts: N events, N censored, follow-up range) and tell the user to run KM in R (`survival::survfit`) or Python (`lifelines.KaplanMeierFitter`), or use cBioPortal's Survival comparison. If asked to do any of (1)–(5), respond with the appropriate handoff template from the "Approved Response Templates" section below — do not produce the number. Ambiguous-Term Clarification (before any analysis) -------------------------------------------------- If the user's question uses an ambiguous term, ask before computing anything. Examples: - **"aggressive"** → could mean shorter overall survival, higher metastasis rate, higher grade/stage, higher TMB, or specific molecular features. Ask which definit … (9984 more chars) ▶ read_guide { "uri": "cbioportal://treatment-guide" } ◀ result # MSK-CHORD (MSK, Nature 2024) **Study ID:** `msk_chord_2024` ## Overview Targeted sequencing via MSK-IMPACT panels. Clinical annotations include some derived from natural language processing (denoted NLP). **Exactly five cancer types** (`CANCER_TYPE`, patients): Non-Small Cell Lung Cancer 7,809, Colorectal Cancer 5,543, Breast Cancer 5,368, Prostate Cancer 3,211, Pancreatic Cancer 3,109. There is **no melanoma** or any other cancer type; say so up front if asked, instead of substituting another type. **No therapy-response variable.** There is no RECIST, objective response, or best-response attribute or event. For treatment-outcome questions (e.g. immunotherapy response), say this first; the only proxies are `OS_MONTHS`/`OS_STATUS`, or NLP radiology progression events (`Diagnosis` events with `SUBTYPE = 'Progression'`, key `PROGRESSION` = Y/N/Indeterminate), in patients with `Treatment` events of the relevant `SUBTYPE` (e.g. `Immuno`: 3,341 patients). Hand off the comparison to cBioPortal group comparison / survival. **Nearly one sample per patient: 24,950 patients / 25,040 samples.** Only 90 patients have more than one sample, and all 90 have samples from two different cancer types (second primaries); only 26 have both a `Primary` and a `Metastasis` sample. There is no meaningful same-patient (paired) primary-vs-metastasis cohort. For "same patient" / paired questions, say this up front, then offer the **unpaired** comparison of all `Primary` vs `Metastasis` samples (`SAMPLE_TYPE`), labelled as unpaired. ```sql SELECT countIf(n > 1) AS multi_sample_patients, -- 90 countIf(has_p AND has_m) AS primary_and_met -- 26 FROM (SELECT patient_unique_id, count() AS n, has(groupArray(attribute_value), 'Primary') AS has_p, has(groupArray(attribute_value), 'Metastasis') AS has_m FROM clinical_data_derived WHERE cancer_study_identifier = 'msk_chord_2024' AND attribute_name = 'SAMPLE_TYPE' GROUP BY patient_unique_id); ``` ## Gene Panels This study uses multiple MSK-IMPACT panel versions: - **IMPACT341**: Earlier version, 341 genes - **IMPACT410**: 410 genes - **IMPACT468**: 468 genes - **IMPACT505**: Latest version, 505 genes **Important:** Different samples may have different gene coverage. Always use gene-specific denominators when calculating mutation frequencies. ## Clinical Attributes - Semantic Guide ### Cancer Classification | Attribute | Description | Values | |-----------|-------------|--------| | `CANCER_TYPE` | Broad cancer category | e.g., "Non-Small Cell Lung Cancer", "Breast Cancer" | | `CANCER_TYPE_DETAILED` | Specific subtype | e.g., "Lung Adenocarcinoma", "Invasive Ductal Carcinoma" | | `ONCOTREE_CODE` | OncoTree classification code | Standardized cancer type codes | ### Sample Information | Attribute | Description | Values | |-----------|-------------|--------| | `SAMPLE_TYPE` | Sample origin | Primary, Metastasis, Local Recurrence, Unknown | | `SAMPLE_CLASS` | Sample … (5439 more chars) ◀ result # Treatment Data Query Guide ## Overview Treatment data in cBioPortal is stored in **clinical event tables**, separate from clinical attributes. This allows for timeline-based treatment records with start/stop dates. ## Start Here: Treatment Views For "most common treatments / agents / regimens in study X", use the parameterized views (documented in `cbioportal://clinical-data-guide`, Study-View Chart Counts): ```sql -- Patients per agent (the portal's Treatment chart), with type/subtype arrays SELECT * FROM treatment_counts_in_study(study='msk_chord_2024') ORDER BY patients DESC LIMIT 20; -- Same-day agent combinations (investigational, prior-medication and radiation events excluded) SELECT * FROM treatment_regimens_in_study(study='msk_chord_2024') ORDER BY patients DESC LIMIT 20; ``` Write raw event queries (below) only for subgroups, timelines or keys the views do not expose. ## Key Tables | Table | Description | |-------|-------------| | `clinical_event` | Event records with patient_id, event_type, start_date, stop_date | | `clinical_event_data` | Key-value pairs linked to each clinical_event_id | ## Schema ``` clinical_event ├── clinical_event_id (PK) ├── patient_id (FK → patient.internal_id) ├── event_type (Treatment, TREATMENT, Diagnosis, SURGERY, etc.) ├── start_date (days from diagnosis) └── stop_date (days from diagnosis) clinical_event_data ├── clinical_event_id (FK) ├── key (AGENT, SUBTYPE, etc.) └── value ``` ## Event Types Not all studies have all event types. Common ones include: | Event Type | Description | |------------|-------------| | `Treatment` / `TREATMENT` | Drug/therapy administration | | `SURGERY` | Surgical procedures | | `Diagnosis` | Diagnosis events | | `LAB_TEST` | Laboratory results | | `Sequencing` | Sequencing events | | `Sample acquisition` | Sample collection | | `PATHOLOGY` / `Pathology` | Pathology reports | ## Basic *** Queries ### List Available Event Types in a Study ```sql SELECT DISTINCT ce.event_type, COUNT(*) as event_count FROM clinical_event ce JOIN patient p ON ce.patient_id = p.internal_id JOIN cancer_study cs ON p.cancer_study_id = cs.cancer_study_id WHERE cs.cancer_study_identifier = 'your_study_id' GROUP BY ce.event_type ORDER BY event_count DESC; ``` ### List Treatment Data Keys in a Study ```sql SELECT DISTINCT ced.key, COUNT(*) as cnt FROM clinical_event ce JOIN clinical_event_data ced ON ce.clinical_event_id = ced.clinical_event_id JOIN patient p ON ce.patient_id = p.internal_id JOIN cancer_study cs ON p.cancer_study_id = cs.cancer_study_id WHERE cs.cancer_study_identifier = 'your_study_id' AND ce.event_type IN ('Treatment', 'TREATMENT') GROUP BY ced.key ORDER BY cnt DESC; ``` ### Get Most Common Treatment Agents ```sql SELECT ced.value as agent, COUNT(DISTINCT ce.patient_id) as patient_count FROM clinical_event ce JOIN clinical_event_data ced ON ce.clinical_event_id = ced.clinical_event_id JOIN patient p ON ce.patient_id = p.internal_id JOIN cancer_stud … (6220 more chars) ▶ clickhouse_run_select_query { "query": "SELECT attribute_value, uniqExact(patient_unique_id) AS patients FROM clinical_data_derived WHERE cancer_study_identifier='msk_chord_2024' AND attribute_name='CANCER_TYPE' GROUP BY attribute_value ORDER BY patients DESC" } ▶ list_studies { "search": "melanoma", "limit": 30 } ◀ result {"rows":[{"attribute_value":"Non-Small Cell Lung Cancer","patients":7809},{"attribute_value":"Colorectal Cancer","patients":5543},{"attribute_value":"Breast Cancer","patients":5368},{"attribute_value":"Prostate Cancer","patients":3211},{"attribute_value":"Pancreatic Cancer","patients":3109}]} ◀ result {"result":[{"cancer_study_identifier":"mel_mskimpact_2020","name":"Melanoma (MSK, Clin Cancer Res 2021)","type_of_cancer_id":"skcm","sample_count":696,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=mel_mskimpact_2020"},{"cancer_study_identifier":"skcm_tcga","name":"Skin Cutaneous Melanoma (TCGA, Firehose Legacy)","type_of_cancer_id":"skcm","sample_count":480,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_tcga"},{"cancer_study_identifier":"skcm_tcga_gdc","name":"Cutaneous Melanoma (TCGA GDC, 2025)","type_of_cancer_id":"skcm","sample_count":473,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_tcga_gdc"},{"cancer_study_identifier":"skcm_tcga_pan_can_atlas_2018","name":"Skin Cutaneous Melanoma (TCGA, PanCancer Atlas)","type_of_cancer_id":"skcm","sample_count":448,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_tcga_pan_can_atlas_2018"},{"cancer_study_identifier":"skcm_tcga_pub_2015","name":"Melanomas (TCGA, Cell 2015)","type_of_cancer_id":"skcm","sample_count":359,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_tcga_pub_2015"},{"cancer_study_identifier":"mixed_allen_2018","name":"MSS Mixed Solid Tumors (Broad/Dana-Farber, Nat Genet 2018)","type_of_cancer_id":"mixed","sample_count":249,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=mixed_allen_2018"},{"cancer_study_identifier":"skcm_yale","name":"Skin Cutaneous Melanoma (Yale, Nat Genet 2012)","type_of_cancer_id":"skcm","sample_count":147,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_yale"},{"cancer_study_identifier":"mel_dfci_2019","name":"Metastatic Melanoma (DFCI, Nature Medicine 2019)","type_of_cancer_id":"mel","sample_count":144,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=mel_dfci_2019"},{"cancer_study_identifier":"mel_iatlas_liu_2019","name":"Metastatic Melanoma (DFCI, Nat Med. 2019) - iAtlas Harmonized","type_of_cancer_id":"mel","sample_count":122,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=mel_iatlas_liu_2019"},{"cancer_study_identifier":"skcm_broad","name":"Skin Cutaneous Melanoma (Broad, Cell 2012)","type_of_cancer_id":"skcm","sample_count":121,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_broad"},{"cancer_study_identifier":"skcm_dfci_2015","name":"Metastatic Melanoma (DFCI, Science 2015)","type_of_cancer_id":"skcm","sample_count":110,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=skcm_dfci_2015"},{"cancer_study_identifier":"mel_iatlas_riaz_nivolumab_2017","name":"Melanoma (MSK, Cell 2017) - iAtlas Harmonized","type_of_cancer_id":"mel","sample_count":107,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=mel_iatlas_riaz_nivolumab_2017"},{"cancer_study_identifier":"mel_iatlas_gide_2019","name":"Metastatic Melanoma (Immunotherapy Trial, Cancer Cell 2019) - iAtlas Harmonized","type_of_cancer_id":"mel","sam … (2906 more chars) ═ answer (success) I can't answer this from MSK-CHORD, for two reasons. 1. **MSK-CHORD has no melanoma patients.** The study ([MSK-CHORD, Nature 2024](https://www.cbioportal.org/study/summary?id=msk_chord_2024)) covers only five cancer types: | Cancer type | Patients | |---|---| | Non-Small Cell Lung Cancer | 7,809 | | Colorectal Cancer | 5,543 | | Breast Cancer | 5,368 | | Prostate Cancer | 3,211 | | Pancreatic Cancer | 3,109 | 2. **MSK-CHORD has no immunotherapy response variable.** It has no RECIST, objective response or best-response field. The closest proxies are overall survival and NLP-derived radiology progression events. Treatment records do include immunotherapy exposure (3,341 patients across the five cancer types). I haven't run any alteration-versus-outcome comparison, so I can't name associated alterations. Any such result would also need Fisher's exact test or a log-rank test, which I can't compute here. cBioPortal's Group Comparison can run them. **Melanoma studies that could fit your question** - [Melanoma (MSK, Clin Cancer Res 2021)](https://www.cbioportal.org/study/summary?id=mel_mskimpact_2020) (`mel_mskimpact_2020`): 696 samples, MSK-IMPACT sequencing. This is probably the closest match to what you had in mind. I haven't checked whether it has immunotherapy response or outcome data. - Melanoma cohorts treated with checkpoint inhibitors: - [Melanoma (MSK, Cell 2017), iAtlas](https://www.cbioportal.org/study/summary?id=mel_iatlas_riaz_nivolumab_2017) (nivolumab, 107 samples) - [Metastatic Melanoma (DFCI, Nat Med 2019)](https://www.cbioportal.org/study/summary?id=mel_dfci_2019) (144 samples) - [Metastatic Melanoma (DFCI, Nat Med 2019), iAtlas](https://www.cbioportal.org/study/summary?id=mel_iatlas_liu_2019) (122 samples) - [Metastatic Melanoma (Immunotherapy Trial, Cancer Cell 2019), iAtlas](https://www.cbioportal.org/study/summary?id=mel_iatlas_gide_2019) (91 samples) - [Metastatic Melanoma (UCLA, Cell 2016), iAtlas](https://www.cbioportal.org/study/summary?id=mel_iatlas_hugo_ucla_2016) (27 samples) - [Metastatic Melanoma (DFCI, Science 2015)](https://www.cbioportal.org/study/summary?id=skcm_dfci_2015) (110 samples) **Next step:** tell me which cohort you want and how to define response: responder versus non-responder, or overall survival. I can then pull alteration counts by response group and set up a Group Comparison. If you meant immunotherapy outcomes in one of MSK-CHORD's five cancer types, I can do that with survival as the proxy. For example, non-small cell lung cancer patients who received checkpoint inhibitors, split by gene alteration.