Q (sonnet): What percentage of endometrial cancer samples have hypermutation (>5000 mutations) and how does this correlate with histological subtype? ▶ list_guides {} ◀ result {"result":[{"uri":"cbioportal://mutation-frequency-guide","description":"Comprehensive guide for calculating gene mutation frequencies with gene-specific profiling denominators"},{"uri":"cbioportal://clinical-data-guide","description":"Guide for querying clinical data including patient vs sample level considerations"},{"uri":"cbioportal://sample-filtering-guide","description":"Guide for filtering samples and studies in cBioPortal queries"},{"uri":"cbioportal://common-pitfalls","description":"Guide to avoid common mistakes when querying cBioPortal data. If you already know which numbered pitfall applies, fetch just that section via read_guide(\"cbioportal://common-pitfalls#\") (e.g. #16) instead of the full guide"},{"uri":"cbioportal://treatment-guide","description":"Guide for querying treatment/clinical event data including drug agents, timelines, and linking to genomic data"},{"uri":"cbioportal://faq-guide","description":"General cBioPortal FAQ: history, how to cite, data types, reference genome, abbreviations, GISTIC thresholds, API access"},{"uri":"cbioportal://statistical-tests-guide","description":"Statistical test selection guide — decision matrix for choosing Fisher's exact, Wilcoxon, chi-squared, t-test, ANOVA, etc. based on data type and group count"},{"uri":"cbioportal://gene-expression-guide","description":"Gene expression / copy-number / methylation analysis. Covers genetic_alteration_derived, profile_type discovery, and the gene_pair_coexpression view for Spearman correlation between two genes"},{"uri":"cbioportal://external-resources-guide","description":"Guide for finding external linked resources such as imaging, pathology, Minerva, HTAN, or other resource_* table links before declaring data unavailable"},{"uri":"cbioportal://gene-resolution-guide","description":"Guide for resolving ambiguous gene symbols, aliases, gene families, and shorthand such as CD3 before querying expression or alteration data"},{"uri":"cbioportal://study-resolution-guide","description":"Guide for resolving requested studies, avoiding silent substitute cohorts, and redirecting to known external cBioPortal instances when data is not in this deployment"},{"uri":"cbioportal://germline-guide","description":"Guide for querying germline variant data — storage columns, study discovery, query patterns, and somatic vs germline considerations"},{"uri":"cbioportal://study-guide/{study_id}","description":"Dynamic study-specific guide - use get_study_guide(study_id) tool to generate"}]} ▶ read_guide { "uri": "cbioportal://clinical-data-guide" } ▶ read_guide { "uri": "cbioportal://sample-filtering-guide" } ◀ result # Clinical Data Query Guide ## Overview Clinical data in cBioPortal is stored at both patient and sample levels. Understanding the distinction is crucial for accurate analysis. ## Data Organization ### Patient-Level vs Sample-Level Data - **Patient-level**: Demographics, overall survival, disease stage (stored once per patient) - **Sample-level**: Sample type, sequencing platform, purity (can have multiple per patient) ### Key Tables - `clinical_patient`: Patient-level clinical attributes - `clinical_sample`: Sample-level clinical attributes - `clinical_data_derived`: Pre-joined view combining both levels - `clinical_attribute_meta`: Metadata about available clinical attributes ## Recommended Approach: Use clinical_data_derived The `clinical_data_derived` table is pre-joined and optimized for most queries: ```sql -- Get clinical data for specific attributes SELECT sample_unique_id, patient_unique_id, attribute_name, attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'your_study_id' AND attribute_name IN ('CANCER_TYPE', 'SAMPLE_TYPE', 'TMB_NONSYNONYMOUS'); ``` ## Clinical Attribute Discovery ### Use clinical_attribute_meta for Discovering Available Attributes **Always start here** to see what clinical attributes are available for a specific study: ```sql -- Discover available clinical attributes for a study SELECT attr_id, description, patient_attribute, cancer_study_id FROM clinical_attribute_meta WHERE cancer_study_id = ( SELECT cancer_study_id FROM cancer_study WHERE cancer_study_identifier = 'your_study_id' ) ORDER BY patient_attribute, attr_id; ``` **Key Fields:** - **attr_id**: matches attr_id in clinical_sample/clinical_patient tables - **description**: human-readable description of the attribute - **patient_attribute**: true = patient attribute, false = sample attribute - **cancer_study_id**: links to cancer_study table (filter by study) ## Attribute Semantics and Matching ### Case-Insensitive Matching for Attribute Values Clinical values are free text across studies and may differ only by case. For example, a controlled-looking value such as germline mutation status may appear as `GERMLINE`, `Germline`, or another case variant. When filtering `clinical_data_derived.attribute_value`, use case-insensitive matching unless you have already profiled the exact values in the target study: ```sql -- Correct: case-insensitive clinical value filter SELECT DISTINCT sample_unique_id, patient_unique_id FROM clinical_data_derived WHERE cancer_study_identifier = 'your_study_id' AND attribute_name = 'MUTATION_STATUS' AND upper(attribute_value) = 'GERMLINE'; ``` Do not write `attribute_value = 'GERMLINE'` without first checking all distinct values for that attribute in the study. ### Query the Requested Attribute, Not a Proxy Do not infer one clinical attribute from a related subtype or marker. Query the actual requested attribute when it … (17073 more chars) ▶ read_guide { "uri": "cbioportal://statistical-tests-guide" } ◀ result # Sample and Study Filtering Guide ## Overview Proper filtering is essential for meaningful cBioPortal analysis. This guide covers filtering by studies, sample types, and other criteria. ## Study-Level Filtering ### 1. Always Filter by Study Every query should specify a study to ensure consistent results: ```sql -- Always include study filtering SELECT * FROM your_table WHERE cancer_study_identifier = 'your_study_id' -- Additional filters... ``` ### 2. Find Available Studies ```sql -- Discover available studies SELECT cancer_study_identifier, name, description, type_of_cancer_id FROM cancer_study ORDER BY cancer_study_identifier; ``` ### 3. Study Information ```sql -- Get detailed study information SELECT cs.cancer_study_identifier, cs.name as study_name, cs.description, cs.sample_count, COUNT(DISTINCT p.internal_id) as patient_count FROM cancer_study cs LEFT JOIN patient p ON cs.cancer_study_id = p.cancer_study_id WHERE cs.cancer_study_identifier = 'your_study_id' GROUP BY cs.cancer_study_identifier, cs.name, cs.description, cs.sample_count; ``` ### 4. Find Studies by Available Data Types Use this when the user asks *"which studies have mutation and copy-number data for X"*, *"studies with expression for Y"*, *"is there any imaging data"*, or any *"studies with Z data"* question. `cancer_study` has one precomputed sample count per data type — filter on them. No join and no schema exploration needed. These are the same counts as the portal's study list and its "Data type" filter. **Canonical query — studies with ALL requested data types for a cancer type:** ```sql SELECT cancer_study_identifier, name, sample_count, mutation_sample_count, cna_sample_count FROM cancer_study WHERE type_of_cancer_id = 'luad' -- ← OncoTree code from search_oncotree AND mutation_sample_count > 0 -- ← one condition per required data type AND cna_sample_count > 0 ORDER BY sample_count DESC; ``` **Data type → column** (a count of 0 means the study doesn't have that data): | Data type in the user's question | Column (portal "Data type" filter label) | |---|---| | samples in the study | `sample_count` | | mutation / mutations | `mutation_sample_count` ("Mutations") | | copy-number / CNA / amplification / deletion | `cna_sample_count` ("CNA") | | structural variant / fusion | `structural_variant_sample_count` | | RNA / mRNA / gene expression (any platform) | `mrna_expression_sample_count` — use this for "which studies have expression data" | | specifically the portal's "RNA-Seq" filter | `rna_seq_sample_count` ("RNA-Seq") — counts only the `_rna_seq_v2_mrna` list; 0 for many GDC and iAtlas studies that do have RNA-Seq | | specifically the portal's "RNA (microarray)" filter | `mrna_microarray_sample_count` ("RNA (microarray)") — counts only the `_mrna` list | | microRNA | `mirna_sample_count` ("miRNA") | | protein / RPPA | `rppa_sample_count` ("RPPA") | | mas … (7083 more chars) ▶ list_studies { "search": "endometrial" } ◀ 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) ▶ search_oncotree { "search_term": "endometrial" } ◀ result {"result":[{"cancer_study_identifier":"ucec_ancestry_cds_msk_2023","name":"Endometrial Cancer (MSK, Cancer Discovery 2023)","type_of_cancer_id":"ucec","sample_count":1882,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_ancestry_cds_msk_2023"},{"cancer_study_identifier":"ucec_tcga","name":"Uterine Corpus Endometrial Carcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"ucec","sample_count":549,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_tcga"},{"cancer_study_identifier":"ucec_tcga_gdc","name":"Endometrial Carcinoma (TCGA GDC, 2025)","type_of_cancer_id":"ucec","sample_count":547,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_tcga_gdc"},{"cancer_study_identifier":"ucec_tcga_pan_can_atlas_2018","name":"Uterine Corpus Endometrial Carcinoma (TCGA, PanCancer Atlas)","type_of_cancer_id":"ucec","sample_count":529,"has_guide":true,"url":"https://www.cbioportal.org/study/summary?id=ucec_tcga_pan_can_atlas_2018"},{"cancer_study_identifier":"ucec_tcga_pub","name":"Uterine Corpus Endometrial Carcinoma (TCGA, Nature 2013)","type_of_cancer_id":"ucec","sample_count":373,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_tcga_pub"},{"cancer_study_identifier":"ucec_msk_2018","name":"Endometrial Cancer (MSK, 2018)","type_of_cancer_id":"ucec","sample_count":197,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_msk_2018"},{"cancer_study_identifier":"ucec_ccr_msk_2022","name":"Endometrial Carcinoma MSI (MSK, Clin Cancer Res 2022)","type_of_cancer_id":"ucec","sample_count":181,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_ccr_msk_2022"},{"cancer_study_identifier":"ucec_cptac_2020","name":"Endometrial Carcinoma (CPTAC, Cell 2020)","type_of_cancer_id":"ucec","sample_count":81,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_cptac_2020"},{"cancer_study_identifier":"ucs_msk_2024","name":"Endometrial Carcinoma (MSK, Molecular Oncology 2024)","type_of_cancer_id":"ucec","sample_count":69,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucs_msk_2024"},{"cancer_study_identifier":"ucec_ccr_cfdna_msk_2022","name":"Endometrial Carcinoma cfDNA (MSK, Clin Cancer Res 2022)","type_of_cancer_id":"ucec","sample_count":44,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_ccr_cfdna_msk_2022"},{"cancer_study_identifier":"ucec_msk_2024","name":"Endometrial and Ovarian Cancer (MSK, Nature Medicine 2024)","type_of_cancer_id":"mixed","sample_count":33,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ucec_msk_2024"},{"cancer_study_identifier":"uec_msk_2024","name":"Endometrial cancer HR-positive (MSK, 2024)","type_of_cancer_id":"ucec","sample_count":24,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=uec_msk_2024"},{"cancer_study_identifier":"uccc_nih_2017","name":"Uterine Clear Cell Carcinoma (NIH, Cancer 2017)","type_of_cancer_id … (447 more chars) ◀ result {"result":[{"code":"ESS","name":"Endometrial Stromal Sarcoma","score":60,"mainType":"Uterine Sarcoma","tissue":"Uterus","hierarchy":"UTERUS > USARC > ESS"},{"code":"UCEC","name":"Endometrial Carcinoma","score":60,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC"},{"code":"HGESS","name":"High-Grade Endometrial Stromal Sarcoma","score":50,"mainType":"Uterine Sarcoma","tissue":"Uterus","hierarchy":"UTERUS > USARC > ESS > HGESS"},{"code":"LGESS","name":"Low-Grade Endometrial Stromal Sarcoma","score":50,"mainType":"Uterine Sarcoma","tissue":"Uterus","hierarchy":"UTERUS > USARC > ESS > LGESS"},{"code":"UMEC","name":"Uterine Mixed Endometrial Carcinoma","score":50,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UMEC"},{"code":"OUTT","name":"Other Uterine Tumor","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > OUTT"},{"code":"UASC","name":"Uterine Adenosquamous Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UASC"},{"code":"UCCC","name":"Uterine Clear Cell Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UCCC"},{"code":"UCS","name":"Uterine Carcinosarcoma/Uterine Malignant Mixed Mullerian Tumor","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UCS"},{"code":"UDDC","name":"Uterine Dedifferentiated Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UDDC"},{"code":"UEC","name":"Uterine Endometrioid Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UEC"},{"code":"UMC","name":"Uterine Mucinous Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UMC"},{"code":"UMNC","name":"Uterine Mesonephric Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UMNC"},{"code":"UNEC","name":"Uterine Neuroendocrine Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UNEC"},{"code":"UPDC","name":"Poorly Differentiated Carcinoma of the Uterus","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UPDC"},{"code":"USC","name":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > USC"},{"code":"UUC","name":"Uterine Undifferentiated Carcinoma","score":45,"mainType":"Endometrial Cancer","tissue":"Uterus","hierarchy":"UTERUS > UCEC > UUC"}]} ▶ clickhouse_run_select_query { "query": "SELECT DISTINCT attribute_name FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND (upper(attribute_name) LIKE '%HISTOLOG%' OR upper(attribute_name) LIKE '%SUBTYPE%' OR upper(attribute_name) LIKE '%MUTATION_COUNT%' OR upper(attribute_name) LIKE '%TMB%' OR upper(attribute_name) LIKE '%MSI%')" } ◀ result {"rows":[{"attribute_name":"ICD_O_3_HISTOLOGY"},{"attribute_name":"SUBTYPE"},{"attribute_name":"MSI_SCORE_MANTIS"},{"attribute_name":"MSI_SENSOR_SCORE"},{"attribute_name":"MUTATION_COUNT"},{"attribute_name":"TMB_NONSYNONYMOUS"}]} ▶ clickhouse_run_select_query { "query": "SELECT DISTINCT attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'ICD_O_3_HISTOLOGY'" } ◀ result {"rows":[{"attribute_value":"8380/3"},{"attribute_value":"8441/3"},{"attribute_value":"8382/3"},{"attribute_value":"8460/3"},{"attribute_value":"8461/3"},{"attribute_value":"8310/3"},{"attribute_value":"8255/3"},{"attribute_value":"8020/3"},{"attribute_value":"8140/3"}]} ▶ clickhouse_run_select_query { "query": "SELECT DISTINCT attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'SUBTYPE'" } ◀ result {"rows":[{"attribute_value":"UCEC_POLE"},{"attribute_value":"UCEC_CN_LOW"},{"attribute_value":"UCEC_MSI"},{"attribute_value":"UCEC_CN_HIGH"},{}]} ▶ clickhouse_run_select_query { "query": "SELECT DISTINCT attribute_value, count() FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'CANCER_TYPE_DETAILED' GROUP BY attribute_value" } ◀ result {"rows":[{"attribute_value":"Uterine Mixed Endometrial Carcinoma","count()":21},{"attribute_value":"Uterine Endometrioid Carcinoma","count()":399},{"attribute_value":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","count()":109}]} ▶ clickhouse_run_select_query { "query": " WITH sample_data AS ( SELECT sample_unique_id, maxIf(toFloat64OrNull(attribute_value), attribute_name = 'MUTATION_COUNT') AS mutation_count, maxIf(attribute_value, attribute_name = 'CANCER_TYPE_DETAILED') AS histology, maxIf(attribute_value, attribute_name = 'SUBTYPE') AS molecular_subtype FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name IN ('MUTATION_COUNT', 'CANCER_TYPE_DETAILED', 'SUBTYPE') GROUP BY sample_unique_id ) SELECT count() AS total_samples, countIf(mutation_count IS NOT NULL) AS samples_with_mutation_data, countIf(mutation_count > 5000) AS hypermutated, round(100.0 * countIf(mutation_count > 5000) / countIf(mutation_count IS NOT NULL), 2) AS pct_hypermutated_of_profiled FROM sample_data " } ◀ result {"rows":[{"total_samples":530,"samples_with_mutation_data":517,"hypermutated":38,"pct_hypermutated_of_profiled":7.35}]} ▶ clickhouse_run_select_query { "query": " WITH sample_data AS ( SELECT sample_unique_id, maxIf(toFloat64OrNull(attribute_value), attribute_name = 'MUTATION_COUNT') AS mutation_count, maxIf(attribute_value, attribute_name = 'CANCER_TYPE_DETAILED') AS histology FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name IN ('MUTATION_COUNT', 'CANCER_TYPE_DETAILED') GROUP BY sample_unique_id ) SELECT histology, count() AS n_samples, countIf(mutation_count IS NOT NULL) AS n_profiled, countIf(mutation_count > 5000) AS n_hypermutated, round(100.0 * countIf(mutation_count > 5000) / countIf(mutation_count IS NOT NULL), 2) AS pct_hypermutated FROM sample_data WHERE histology IS NOT NULL AND histology != '' GROUP BY histology ORDER BY n_samples DESC " } ◀ result {"rows":[{"histology":"Uterine Endometrioid Carcinoma","n_samples":399,"n_profiled":388,"n_hypermutated":34,"pct_hypermutated":8.76},{"histology":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","n_samples":109,"n_profiled":108,"n_hypermutated":2,"pct_hypermutated":1.85},{"histology":"Uterine Mixed Endometrial Carcinoma","n_samples":21,"n_profiled":21,"n_hypermutated":2,"pct_hypermutated":9.52}]} ▶ clickhouse_run_select_query { "query": " WITH sample_data AS ( SELECT sample_unique_id, maxIf(toFloat64OrNull(attribute_value), attribute_name = 'MUTATION_COUNT') AS mutation_count, maxIf(attribute_value, attribute_name = 'SUBTYPE') AS molecular_subtype FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name IN ('MUTATION_COUNT', 'SUBTYPE') GROUP BY sample_unique_id ) SELECT molecular_subtype, count() AS n_samples, countIf(mutation_count IS NOT NULL) AS n_profiled, countIf(mutation_count > 5000) AS n_hypermutated, round(100.0 * countIf(mutation_count > 5000) / countIf(mutation_count IS NOT NULL), 2) AS pct_hypermutated, round(avg(mutation_count), 0) AS mean_mutation_count, round(quantile(0.5)(mutation_count), 0) AS median_mutation_count FROM sample_data WHERE molecular_subtype IS NOT NULL AND molecular_subtype != '' GROUP BY molecular_subtype ORDER BY n_samples DESC " } ◀ result {"rows":[{"molecular_subtype":"UCEC_POLE","n_samples":1,"n_profiled":0,"n_hypermutated":0,"pct_hypermutated":null}]} ▶ clickhouse_run_select_query { "query": "SELECT attribute_value, count() FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'SUBTYPE' GROUP BY attribute_value" } ▶ clickhouse_list_table_columns { "table": "clinical_data_derived" } ◀ result {"rows":[{"count()":22},{"attribute_value":"UCEC_MSI","count()":148},{"attribute_value":"UCEC_POLE","count()":49},{"attribute_value":"UCEC_CN_HIGH","count()":163},{"attribute_value":"UCEC_CN_LOW","count()":147}]} ◀ result {"columns":[{"name":"internal_id","type":"Int32"},{"name":"sample_unique_id","type":"String","comment":"Globally unique sample ID: cancer_study_identifier + \"_\" + sample.stable_id. Empty for patient-level attributes. Use this for sample filtering and joins."},{"name":"patient_unique_id","type":"String","comment":"Globally unique patient ID: cancer_study_identifier + \"_\" + patient.stable_id. Present for both sample and patient-level attributes."},{"name":"attribute_name","type":"LowCardinality(String)","comment":"Clinical attribute name (e.g., SAMPLE_TYPE, CANCER_TYPE, AGE, OS_MONTHS). Use with attribute_value for filtering. AGE may be floored or capped for de-identification (e.g. all children recorded as 18, or everyone 89+ recorded as 89 or 90): before age statistics check for a pile-up at the min/max, and if present compute age from DAYS_TO_BIRTH (-days / 365.25)."},{"name":"attribute_value","type":"String","comment":"Value of the clinical attribute (String). For SAMPLE_TYPE: Primary, Metastasis, Local Recurrence, Unknown. Missing values are empty strings, so use toFloat64OrNull(attribute_value) for numeric comparisons — CAST fails on them."},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"type","type":"LowCardinality(String)","comment":"Data level: \"sample\" for sample-level attributes (e.g., SAMPLE_TYPE), \"patient\" for patient-level attributes (e.g., AGE, OS_MONTHS)."}]} ▶ clickhouse_run_select_query { "query": " WITH mut AS ( SELECT sample_unique_id, patient_unique_id, toFloat64OrNull(attribute_value) AS mutation_count FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'MUTATION_COUNT' ), sub AS ( SELECT patient_unique_id, attribute_value AS molecular_subtype FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'SUBTYPE' ) SELECT sub.molecular_subtype AS molecular_subtype, count() AS n_samples, countIf(mut.mutation_count IS NOT NULL) AS n_profiled, countIf(mut.mutation_count > 5000) AS n_hypermutated, round(100.0 * countIf(mut.mutation_count > 5000) / countIf(mut.mutation_count IS NOT NULL), 2) AS pct_hypermutated, round(avg(mut.mutation_count), 0) AS mean_mutation_count, round(quantile(0.5)(mut.mutation_count), 0) AS median_mutation_count FROM mut LEFT JOIN sub ON mut.patient_unique_id = sub.patient_unique_id WHERE sub.molecular_subtype IS NOT NULL AND sub.molecular_subtype != '' GROUP BY molecular_subtype ORDER BY n_samples DESC " } ◀ result {"rows":[{"molecular_subtype":"UCEC_CN_HIGH","n_samples":163,"n_profiled":163,"n_hypermutated":0,"pct_hypermutated":0,"mean_mutation_count":71,"median_mutation_count":54},{"molecular_subtype":"UCEC_MSI","n_samples":148,"n_profiled":148,"n_hypermutated":6,"pct_hypermutated":4.05,"mean_mutation_count":1020,"median_mutation_count":578},{"molecular_subtype":"UCEC_CN_LOW","n_samples":147,"n_profiled":147,"n_hypermutated":0,"pct_hypermutated":0,"mean_mutation_count":77,"median_mutation_count":50},{"molecular_subtype":"UCEC_POLE","n_samples":49,"n_profiled":49,"n_hypermutated":32,"pct_hypermutated":65.31,"mean_mutation_count":7427,"median_mutation_count":7385}]} ▶ clickhouse_run_select_query { "query": " WITH mut AS ( SELECT sample_unique_id, patient_unique_id, toFloat64OrNull(attribute_value) AS mutation_count FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'MUTATION_COUNT' ), hist AS ( SELECT sample_unique_id, attribute_value AS histology FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'CANCER_TYPE_DETAILED' ), sub AS ( SELECT patient_unique_id, attribute_value AS molecular_subtype FROM clinical_data_derived WHERE cancer_study_identifier = 'ucec_tcga_pan_can_atlas_2018' AND attribute_name = 'SUBTYPE' ) SELECT hist.histology AS histology, sub.molecular_subtype AS molecular_subtype, count() AS n_samples, countIf(mut.mutation_count > 5000) AS n_hypermutated FROM mut LEFT JOIN hist ON mut.sample_unique_id = hist.sample_unique_id LEFT JOIN sub ON mut.patient_unique_id = sub.patient_unique_id WHERE hist.histology IS NOT NULL AND hist.histology != '' AND sub.molecular_subtype IS NOT NULL AND sub.molecular_subtype != '' GROUP BY histology, molecular_subtype ORDER BY histology, n_samples DESC " } ◀ result {"rows":[{"histology":"Uterine Endometrioid Carcinoma","molecular_subtype":"UCEC_MSI","n_samples":141,"n_hypermutated":5},{"histology":"Uterine Endometrioid Carcinoma","molecular_subtype":"UCEC_CN_LOW","n_samples":140,"n_hypermutated":0},{"histology":"Uterine Endometrioid Carcinoma","molecular_subtype":"UCEC_CN_HIGH","n_samples":55,"n_hypermutated":0},{"histology":"Uterine Endometrioid Carcinoma","molecular_subtype":"UCEC_POLE","n_samples":45,"n_hypermutated":29},{"histology":"Uterine Mixed Endometrial Carcinoma","molecular_subtype":"UCEC_CN_HIGH","n_samples":11,"n_hypermutated":0},{"histology":"Uterine Mixed Endometrial Carcinoma","molecular_subtype":"UCEC_MSI","n_samples":5,"n_hypermutated":1},{"histology":"Uterine Mixed Endometrial Carcinoma","molecular_subtype":"UCEC_CN_LOW","n_samples":3,"n_hypermutated":0},{"histology":"Uterine Mixed Endometrial Carcinoma","molecular_subtype":"UCEC_POLE","n_samples":2,"n_hypermutated":1},{"histology":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","molecular_subtype":"UCEC_CN_HIGH","n_samples":97,"n_hypermutated":0},{"histology":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","molecular_subtype":"UCEC_CN_LOW","n_samples":4,"n_hypermutated":0},{"histology":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","molecular_subtype":"UCEC_MSI","n_samples":2,"n_hypermutated":0},{"histology":"Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","molecular_subtype":"UCEC_POLE","n_samples":2,"n_hypermutated":2}]} ▶ resolve_and_route { "studyIds": [ "ucec_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":"ucec_tcga_pan_can_atlas_2018","name":"Uterine Corpus Endometrial Carcinoma (TCGA, PanCancer Atlas)","sampleCount":529,"studyViewUrl":"https://www.cbioportal.org/study?id=ucec_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":["ucec_tcga_pan_can_atlas_2018_gistic","ucec_tcga_pan_can_atlas_2018_log2CNA","ucec_tcga_pan_can_atlas_2018_mutations","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores","ucec_tcga_pan_can_atlas_2018_rppa","ucec_tcga_pan_can_atlas_2018_rppa_Zscores","ucec_tcga_pan_can_atlas_2018_structural_variants"],"genericAssayProfiles":["ucec_tcga_pan_can_atlas_2018_armlevel_cna","ucec_tcga_pan_can_atlas_2018_genetic_ancestry","ucec_tcga_pan_can_atlas_2018_methylation_hm27_hm450_merge","ucec_tcga_pan_can_atlas_2018_methylation_hm450"],"heatmapProfileIds":["ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","ucec_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_ref_normal_Zscores","ucec_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"]}}]}} ▶ get_studyviewfilter_options { "studyId": "ucec_tcga_pan_can_atlas_2018", "attributeIds": [ "SUBTYPE", "CANCER_TYPE_DETAILED", "MUTATION_COUNT" ] } ◀ result {"success":true,"message":"Successfully retrieved StudyView filter options","data":{"studyId":"ucec_tcga_pan_can_atlas_2018","attributes":[{"attributeId":"CANCER_TYPE_DETAILED","displayName":"Cancer Type Detailed","description":"Cancer Type Detailed","datatype":"STRING","values":["Uterine Serous Carcinoma/Uterine Papillary Serous Carcinoma","Uterine Mixed Endometrial Carcinoma","Uterine Endometrioid Carcinoma"]},{"attributeId":"MUTATION_COUNT","displayName":"Mutation Count","description":"Mutation Count","datatype":"NUMBER","continuous":true,"bins":[{"end":46.5,"count":129},{"start":46.5,"end":75,"count":130},{"start":75,"end":564,"count":129},{"start":564,"count":129}]},{"attributeId":"SUBTYPE","displayName":"Subtype","description":"Subtype","datatype":"STRING","values":["UCEC_MSI","UCEC_CN_HIGH","UCEC_POLE","NA","UCEC_CN_LOW"]}]}} ▶ navigate_to_study_view { "studyIds": [ "ucec_tcga_pan_can_atlas_2018" ], "filterJson": { "clinicalDataFilters": [ { "attributeId": "MUTATION_COUNT", "values": [ { "start": 5000 } ] } ] } } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/study/summary?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22MUTATION_COUNT%22%2C%22values%22%3A%5B%7B%22start%22%3A5000%7D%5D%7D%5D%7D","url":"https://www.cbioportal.org/study/summary?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22MUTATION_COUNT%22%2C%22values%22%3A%5B%7B%22start%22%3A5000%7D%5D%7D%5D%7D","data":{"studyIds":["ucec_tcga_pan_can_atlas_2018"],"studies":[{"studyId":"ucec_tcga_pan_can_atlas_2018","name":"Uterine Corpus Endometrial Carcinoma (TCGA, PanCancer Atlas)","sampleCount":529}],"tab":"summary","hasFilters":true,"hasPlotsConfig":false,"pageDescription":"Overview of all study data displayed as interactive charts summarizing available clinical and genomic data. Click within a chart to filter. Additional charts may be available in the Charts menu."}} ▶ navigate_to_group_comparison { "studyIds": [ "ucec_tcga_pan_can_atlas_2018" ], "tab": "clinical", "groups": [ { "name": "POLE", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "SUBTYPE", "values": [ { "value": "UCEC_POLE" } ] } ] } }, { "name": "MSI", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "SUBTYPE", "values": [ { "value": "UCEC_MSI" } ] } ] } }, { "name": "CN_HIGH", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "SUBTYPE", "values": [ { "value": "UCEC_CN_HIGH" } ] } ] } }, { "name": "CN_LOW", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "SUBTYPE", "values": [ { "value": "UCEC_CN_LOW" } ] } ] } } ] } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/comparison/clinical?comparisonId=6ab5ba74e497aad53593c255","url":"https://www.cbioportal.org/comparison/clinical?comparisonId=6ab5ba74e497aad53593c255","data":{"description":"Group comparison (4 custom groups)","studies":["ucec_tcga_pan_can_atlas_2018"],"totalGroups":4,"groups":[{"name":"POLE","sampleCount":49},{"name":"MSI","sampleCount":148},{"name":"CN_HIGH","sampleCount":163},{"name":"CN_LOW","sampleCount":147}],"studyViewUrl":"https://www.cbioportal.org/study?id=ucec_tcga_pan_can_atlas_2018","groupUrls":[{"groupName":"POLE","url":"https://www.cbioportal.org/study?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22SUBTYPE%22%2C%22values%22%3A%5B%7B%22value%22%3A%22UCEC_POLE%22%7D%5D%7D%5D%7D"},{"groupName":"MSI","url":"https://www.cbioportal.org/study?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22SUBTYPE%22%2C%22values%22%3A%5B%7B%22value%22%3A%22UCEC_MSI%22%7D%5D%7D%5D%7D"},{"groupName":"CN_HIGH","url":"https://www.cbioportal.org/study?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22SUBTYPE%22%2C%22values%22%3A%5B%7B%22value%22%3A%22UCEC_CN_HIGH%22%7D%5D%7D%5D%7D"},{"groupName":"CN_LOW","url":"https://www.cbioportal.org/study?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22SUBTYPE%22%2C%22values%22%3A%5B%7B%22value%22%3A%22UCEC_CN_LOW%22%7D%5D%7D%5D%7D"}],"pageDescription":"Clinical attribute distributions compared across POLE (49) vs MSI (148) vs CN_HIGH (163) vs CN_LOW (147)."}} ═ answer (success) ## Results — TCGA UCEC PanCancer Atlas (`ucec_tcga_pan_can_atlas_2018`, n=529) **Overall hypermutation rate** - 38 / 517 mutation-profiled samples have >5,000 mutations → **7.35%** hypermutated **By histological subtype** (`CANCER_TYPE_DETAILED`) | Histology | N samples | N profiled | Hypermutated | % Hypermutated | |---|---|---|---|---| | Endometrioid Carcinoma | 399 | 388 | 34 | **8.76%** | | Serous Carcinoma | 109 | 108 | 2 | **1.85%** | | Mixed Endometrial Carcinoma | 21 | 21 | 2 | **9.52%** | **By TCGA molecular subtype** (`SUBTYPE`) — the stronger correlate of hypermutation | Molecular subtype | N | Hypermutated | % Hypermutated | Mean mutations | Median mutations | |---|---|---|---|---|---| | POLE (ultramutated) | 49 | 32 | **65.31%** | 7,427 | 7,385 | | MSI (hypermutated) | 148 | 6 | **4.05%** | 1,020 | 578 | | CN-high (serous-like) | 163 | 0 | **0%** | 71 | 54 | | CN-low (endometrioid-like) | 147 | 0 | **0%** | 77 | 50 | **Cross-tabulation** — nearly all hypermutated samples are histologically endometrioid, but this reflects that POLE mutations occur almost exclusively in endometrioid tumors (45/49 POLE cases are endometrioid; 29 of the 34 hypermutated endometrioid samples are POLE-subtype). Serous carcinoma is almost entirely CN-high (97/109) and essentially never hypermutated (only 2 of 109 serous samples exceed 5,000 mutations, both classified as POLE). **Interpretation caveat:** Histological subtype alone is a weak predictor of hypermutation (endometrioid 8.76% vs. serous 1.85%). The correlation is much stronger with the molecular (TCGA) subtype — hypermutation is essentially a POLE-subtype phenomenon (65% of POLE tumors are hypermutated vs. ≤4% in every other molecular subtype), and POLE mutations happen to be enriched in — but not exclusive to — endometrioid histology. This is a descriptive frequency comparison; I have not run a statistical test. If you want to formally test whether hypermutation rate differs significantly by histology or molecular subtype, that's a chi-squared test (4+ groups, categorical) — happy to hand off the contingency table for that. ### Navigate [View Hypermutated Samples (>5,000 mutations) in Study View](https://www.cbioportal.org/study/summary?id=ucec_tcga_pan_can_atlas_2018#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22MUTATION_COUNT%22%2C%22values%22%3A%5B%7B%22start%22%3A5000%7D%5D%7D%5D%7D) [Compare Molecular Subtypes (POLE vs MSI vs CN-High vs CN-Low) — Clinical Comparison](https://www.cbioportal.org/comparison/clinical?comparisonId=6ab5ba74e497aad53593c255) Groups: POLE (n=49), MSI (n=148), CN-High (n=163), CN-Low (n=147).