Q (haiku): Which genomic alterations are associated with immunotherapy response in melanoma patients from the MSK-CHORD Study? ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ list_studies { "search": "MSK CHORD melanoma" } ◀ result # Gene Expression Analysis Guide This guide covers continuous-value genomic data: gene **expression**, **copy number** values, **methylation**, and related profile types. Mutation/CNA/SV *frequency* analysis lives in `cbioportal://mutation-frequency-guide`. ## Where this data lives Continuous per-sample-per-gene values are stored in `genetic_alteration_derived`: | Column | Description | |---|---| | `sample_unique_id` | `_` | | `cancer_study_identifier` | study scope | | `hugo_gene_symbol` | gene | | `profile_type` | which assay/normalization (see below) | | `alteration_value` | the actual value — stored as Nullable(String); cast with `toFloat64OrNull` | `alteration_value` is a string because the same column hosts many different value scales. The `''` and `'NA'` sentinels mean "missing"; always filter them out and use `toFloat64OrNull(alteration_value) IS NOT NULL` for downstream math. ## Discovering profile types for a study Different studies expose different profile types depending on what assays were run and how the data was normalized. Always check what a specific study supports before picking one: ```sql SELECT DISTINCT profile_type FROM genetic_alteration_derived WHERE cancer_study_identifier = 'brca_metabric' ORDER BY profile_type; ``` Common values across the public portal: | Family | Profile types | |---|---| | mRNA expression | `rna_seq_v2_mrna`, `rna_seq_v2_mrna_median_Zscores`, `rna_seq_v2_mrna_median_all_sample_Zscores` (TCGA PanCancer Atlas), `mrna`, `mrna_median_Zscores`, `mrna_seq_v2_rsem`, `mrna_seq_v2_rsem_Zscores`, `mrna_seq_cpm`, `mrna_seq_fpkm`, `mrna_U133`, `mrna_outliers` | | Copy number (continuous) | `cna`, `linear_CNA`, `log2CNA`, `cna_consensus`, `cna_rae`, `gistic` | | Methylation | `methylation_hm27`, `methylation_hm450`, `methylation_epic`, `methylation_promoters_rrbs` | | miRNA | `mirna`, `mirna_median_Zscores` | | Protein | `protein_quantification`, `protein_level`, `RPPA` | **Z-score vs raw choice.** When the user asks "is X correlated with Y", either works for Spearman (rank-based) — Pearson would care. Default to the non-Z-score variant if both exist, and call out which one in the response. ## Canonical recipe — Spearman correlation between two genes ```sql SELECT * FROM gene_pair_coexpression( study = 'brca_metabric', gene_a = 'TP53', gene_b = 'MYC', profile_type = 'mrna' ); ``` Returns one row: `(gene_a, gene_b, profile_type, spearman_correlation, num_samples)`. - `spearman_correlation` in [−1, 1]; `NULL` when fewer than 3 valid paired samples. - Mirrors cbioportal-backend's `ClickhouseCoExpressionMapper.getCoExpressions`, simplified to a pair lookup (the backend computes one ref gene vs ALL other genes for the coexpression page; here the agent asks about a specific pair). ### Verified examples | Study | gene_a | gene_b | profile_type | spearman | n | |---|---|---|---|---|---| | `brca_metabric` | TP53 | MYC | `mrna` | 0.118 | 1980 | | … (4931 more chars) ◀ result {"result":[]} ▶ list_studies { "search": "CHORD" } ◀ result {"result":[{"cancer_study_identifier":"msk_chord_2024","name":"MSK-CHORD (MSK, Nature 2024)","type_of_cancer_id":"mixed","sample_count":25040,"has_guide":true,"url":"https://www.cbioportal.org/study/summary?id=msk_chord_2024"}]} ▶ get_study_guide { "study_id": "msk_chord_2024" } ▶ 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) ▶ read_guide { "uri": "cbioportal://external-resources-guide" } ◀ 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 Treatment 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) ◀ result # External Resources Guide Use this guide when the user asks about data that may be linked from cBioPortal rather than stored directly in molecular or clinical tables. ## Routing Triggers Read this guide before answering or refusing questions that mention: - imaging, radiology, CT, MRI, pathology slides, histology, Minerva, viewer - external portal, external resource, image data, spatial data - HTAN studies or study-specific linked viewers ## Core Rule Do not say cBioPortal has no imaging or external-resource data until you have checked: - `resource_definition` - `resource_study` - `resource_sample` - `resource_patient` cBioPortal may store links to external viewers or portals even when it does not store raw images. ## Which Studies Have Imaging Data For "which studies have imaging / pathology slides / CT" or "how many samples have images", read `cancer_study.resource_sample_counts` — per-study sample counts keyed by resource display name, the same numbers as the portal's "Data type" filter. One query, no joins: ```sql SELECT cancer_study_identifier, name, resource_sample_counts['Slide Microscopy'] AS slide_microscopy_samples FROM cancer_study WHERE resource_sample_counts['Slide Microscopy'] > 0 ORDER BY slide_microscopy_samples DESC; ``` List the resource names that exist with `SELECT DISTINCT arrayJoin(mapKeys(resource_sample_counts)) FROM cancer_study` (e.g. `'Slide Microscopy'`, `'Computed Tomography'`, `'Magnetic Resonance'`, `'H&E Slide'`, `'MxIF Image'`). The map counts sample- and patient-level resources only. For study-level links (`resource_study`) and for the URLs themselves, use the queries below. ## Discovery Query Start with table and column validation, then use this pattern: ```sql SELECT rd.resource_id, rd.display_name, rd.description, rd.resource_type, rs.cancer_study_identifier, rs.url FROM resource_study rs JOIN resource_definition rd ON rs.resource_id = rd.resource_id WHERE lower(rd.display_name) LIKE '%minerva%' OR lower(rd.description) LIKE '%minerva%' OR lower(rd.display_name) LIKE '%image%' OR lower(rd.description) LIKE '%image%' OR lower(rd.display_name) LIKE '%pathology%' OR lower(rd.description) LIKE '%pathology%' OR lower(rd.display_name) LIKE '%histology%' OR lower(rd.description) LIKE '%histology%' ORDER BY rs.cancer_study_identifier, rd.display_name LIMIT 100; ``` If no study-level rows appear, check sample- and patient-level resource links: ```sql SELECT rd.resource_id, rd.display_name, rd.description, rs.cancer_study_identifier, rs.sample_unique_id, rs.url FROM resource_sample rs JOIN resource_definition rd ON rs.resource_id = rd.resource_id WHERE lower(rd.display_name) LIKE '%minerva%' OR lower(rd.description) LIKE '%minerva%' OR lower(rd.display_name) LIKE '%image%' OR lower(rd.description) LIKE '%image%' OR lower(rd.display_name) LIKE '%pathology%' OR lower(rd.description) LIKE '%pathology%' … (981 more chars) ▶ clickhouse_run_select_query { "query": "-- First, confirm melanoma is not in MSK-CHORD SELECT DISTINCT attribute_value AS cancer_type, COUNT(DISTINCT sample_unique_id) as samples FROM clinical_data_derived WHERE cancer_study_identifier = 'msk_chord_2024' AND attribute_name = 'CANCER_TYPE' GROUP BY attribute_value ORDER BY samples DESC;" } ◀ result {"rows":[{"cancer_type":"Non-Small Cell Lung Cancer","samples":7809},{"cancer_type":"Colorectal Cancer","samples":5543},{"cancer_type":"Breast Cancer","samples":5368},{"cancer_type":"Prostate Cancer","samples":3211},{"cancer_type":"Pancreatic Cancer","samples":3109}]} ▶ clickhouse_run_select_query { "query": "-- Check for immunotherapy treatments in MSK-CHORD SELECT subtype.value as treatment_subtype, agent.value as agent_name, COUNT(DISTINCT ce.patient_id) as patients FROM clinical_event ce JOIN clinical_event_data agent ON ce.clinical_event_id = agent.clinical_event_id AND agent.key = 'AGENT' JOIN clinical_event_data subtype ON ce.clinical_event_id = subtype.clinical_event_id AND subtype.key = 'SUBTYPE' 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 = 'msk_chord_2024' AND ce.event_type IN ('Treatment', 'TREATMENT') AND subtype.value = 'Immuno' GROUP BY subtype.value, agent.value ORDER BY patients DESC LIMIT 20;" } ◀ result {"rows":[{"treatment_subtype":"Immuno","agent_name":"PEMBROLIZUMAB","patients":2061},{"treatment_subtype":"Immuno","agent_name":"NIVOLUMAB","patients":809},{"treatment_subtype":"Immuno","agent_name":"ATEZOLIZUMAB","patients":370},{"treatment_subtype":"Immuno","agent_name":"DURVALUMAB","patients":246},{"treatment_subtype":"Immuno","agent_name":"IPILIMUMAB","patients":218},{"treatment_subtype":"Immuno","agent_name":"AVELUMAB","patients":3},{"treatment_subtype":"Immuno","agent_name":"CEMIPLIMAB","patients":3},{"treatment_subtype":"Immuno","agent_name":"TREMELIMUMAB","patients":1}]} ═ answer (success) Based on my investigation, I need to provide you with an important clarification: ## Key Finding: Melanoma is Not in MSK-CHORD **The MSK-CHORD study (MSK, Nature 2024) does not contain melanoma patients.** The cohort consists of exactly five cancer types: - Non-Small Cell Lung Cancer (7,809 samples) - Colorectal Cancer (5,543 samples) - Breast Cancer (5,368 samples) - Prostate Cancer (3,211 samples) - Pancreatic Cancer (3,109 samples) --- ## Important Data Limitation: No Therapy Response Phenotype **MSK-CHORD does NOT include immunotherapy response data** (e.g., RECIST response, objective response rate, or best response). According to the study guide, there is no therapy-response variable in the clinical attributes or events. --- ## What IS Available for Immunotherapy in MSK-CHORD While immunotherapy response is not measured, the study does have: 1. **Immunotherapy Treatment Records**: 3,341 patients across all cancer types received immunotherapy, with top agents: - **Pembrolizumab**: 2,061 patients - **Nivolumab**: 809 patients - **Atezolizumab**: 370 patients - **Durvalumab**: 246 patients - **Ipilimumab**: 218 patients 2. **Genomic Alterations**: Sequenced via MSK-IMPACT panels (341–505 genes depending on panel version) 3. **Potential Outcome Proxies**: - Overall survival (`OS_MONTHS`, `OS_STATUS`) - NLP-derived progression events (`PROGRESSION = Y/N`) --- ## What You Can Do Instead If you're interested in **genomic alterations and immunotherapy in lung or colorectal cancer** (which both have substantial immunotherapy use in MSK-CHORD), I can: 1. **Identify frequently mutated genes** in immunotherapy-treated patients by cancer type 2. **Link genomic alterations to survival outcomes** (using OS/progression as a proxy) 3. **Compare genomic profiles** between immunotherapy-treated and untreated patients **For melanoma immunotherapy genomics**, you would need a different study—[cBioPortal hosts several skin cancer cohorts](https://www.cbioportal.org). Would you like me to search for melanoma studies with immunotherapy data instead?