Q (sonnet): In TCGA lower grade glioma, show me IDH1 mRNA expression by IDH1 mutation status. ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ resolve_and_route { "studyKeywords": [ "TCGA", "lower grade glioma", "pan_can_atlas" ] } ◀ 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 | `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 | | `brca_metabric` | ESR1 | PGR | `mrna` | 0.487 | 1980 | ESR1↔PGR is the textbook breast-cancer estrogen-receptor coregula … (2785 more chars) ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"lgg_tcga_pan_can_atlas_2018","name":"Brain Lower Grade Glioma (TCGA, PanCancer Atlas)","sampleCount":514,"studyViewUrl":"https://www.cbioportal.org/study?id=lgg_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":["lgg_tcga_pan_can_atlas_2018_gistic","lgg_tcga_pan_can_atlas_2018_log2CNA","lgg_tcga_pan_can_atlas_2018_mutations","lgg_tcga_pan_can_atlas_2018_rna_seq_v2_mrna","lgg_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","lgg_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","lgg_tcga_pan_can_atlas_2018_rppa","lgg_tcga_pan_can_atlas_2018_rppa_Zscores","lgg_tcga_pan_can_atlas_2018_structural_variants"],"genericAssayProfiles":["lgg_tcga_pan_can_atlas_2018_armlevel_cna","lgg_tcga_pan_can_atlas_2018_genetic_ancestry","lgg_tcga_pan_can_atlas_2018_methylation_hm27_hm450_merge","lgg_tcga_pan_can_atlas_2018_methylation_hm450"],"heatmapProfileIds":["lgg_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_Zscores","lgg_tcga_pan_can_atlas_2018_rna_seq_v2_mrna_median_all_sample_Zscores","lgg_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"]}}]}} ▶ clickhouse_run_select_query { "query": " WITH mut AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'lgg_tcga_pan_can_atlas_2018' AND hugo_gene_symbol = 'IDH1' AND event_type = 'MUTATION' ), expr AS ( SELECT sample_unique_id, toFloat64OrNull(alteration_value) AS v FROM genetic_alteration_derived WHERE cancer_study_identifier = 'lgg_tcga_pan_can_atlas_2018' AND profile_type = 'rna_seq_v2_mrna' AND hugo_gene_symbol = 'IDH1' AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL ) SELECT if(m.sample_unique_id != '', 'Mutant', 'Wildtype') AS idh1_status, count() AS n_samples, avg(e.v) AS mean_expr, median(e.v) AS median_expr, stddevPop(e.v) AS sd_expr, min(e.v) AS min_expr, max(e.v) AS max_expr FROM expr e LEFT JOIN mut m ON e.sample_unique_id = m.sample_unique_id GROUP BY idh1_status ORDER BY idh1_status " } ◀ 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 `event_type` in scope mut AS m. (UNKNOWN_IDENTIFIER) (version 26.4.1.2359 (official build))\n"} ▶ clickhouse_list_table_columns { "table": "genomic_event_derived" } ◀ result {"columns":[{"name":"sample_unique_id","type":"String"},{"name":"hugo_gene_symbol","type":"String","comment":"HUGO gene symbol (e.g., TP53, KRAS, BRAF). Use for gene-specific queries."},{"name":"entrez_gene_id","type":"Int32"},{"name":"gene_panel_stable_id","type":"LowCardinality(String)"},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"genetic_profile_stable_id","type":"LowCardinality(String)"},{"name":"variant_type","type":"LowCardinality(String)","comment":"Type of genomic event: \"mutation\" for SNVs/indels, \"cna\" for copy number alterations, \"structural_variant\" for SVs. Always filter by this."},{"name":"mutation_variant","type":"String","comment":"Protein change notation (e.g., p.V600E, p.R175H). Use for specific variant queries. \"NA\" for non-mutation events."},{"name":"mutation_type","type":"LowCardinality(String)"},{"name":"mutation_status","type":"LowCardinality(String)","comment":"For mutations: Somatic, Germline, UNKNOWN, or UNCALLED. Filter mutation_status != \"UNCALLED\" to exclude uncertain calls. Include all other statuses."},{"name":"driver_filter","type":"LowCardinality(String)"},{"name":"driver_filter_annotation","type":"String"},{"name":"driver_tiers_filter","type":"LowCardinality(String)"},{"name":"driver_tiers_filter_annotation","type":"String"},{"name":"cna_alteration","type":"Nullable(Int8)","comment":"Copy number alteration: only 2 = amplification (AMP) and -2 = deep deletion (HOMDEL) are stored. Shallow deletion (-1), diploid (0) and gain (1) are not in this table; query genetic_alteration_derived WHERE profile_type = 'gistic' (alteration_value is a String, e.g. '-1'). NULL for non-CNA events."},{"name":"cna_cytoband","type":"String"},{"name":"sv_event_info","type":"String"},{"name":"patient_unique_id","type":"String"},{"name":"off_panel","type":"Bool","comment":"Boolean: 1 = mutation outside gene panel coverage (off-panel), 0 = within panel (on-panel). Filter off_panel = 0 for reliable frequency calculations."}]} ▶ clickhouse_run_select_query { "query": " WITH mut AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'lgg_tcga_pan_can_atlas_2018' AND hugo_gene_symbol = 'IDH1' AND variant_type = 'mutation' AND mutation_status != 'UNCALLED' ), expr AS ( SELECT sample_unique_id, toFloat64OrNull(alteration_value) AS v FROM genetic_alteration_derived WHERE cancer_study_identifier = 'lgg_tcga_pan_can_atlas_2018' AND profile_type = 'rna_seq_v2_mrna' AND hugo_gene_symbol = 'IDH1' AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL ) SELECT if(m.sample_unique_id != '', 'Mutant', 'Wildtype') AS idh1_status, count() AS n_samples, avg(e.v) AS mean_expr, median(e.v) AS median_expr, stddevPop(e.v) AS sd_expr, min(e.v) AS min_expr, max(e.v) AS max_expr FROM expr e LEFT JOIN mut m ON e.sample_unique_id = m.sample_unique_id GROUP BY idh1_status ORDER BY idh1_status " } ◀ result {"rows":[{"idh1_status":"Mutant","n_samples":395,"mean_expr":1679.2331012658221,"median_expr":1585.31,"sd_expr":579.4864894947646,"min_expr":349.913,"max_expr":3725.17},{"idh1_status":"Wildtype","n_samples":119,"mean_expr":1893.6835966386561,"median_expr":1816.67,"sd_expr":977.3944157664467,"min_expr":321.288,"max_expr":5411.17}]} ▶ navigate_to_results_view { "studyIds": [ "lgg_tcga_pan_can_atlas_2018" ], "genes": [ "IDH1: MUT" ], "tab": "plots", "profileFilter": "rna_seq_v2_mrna", "plotsHorzSelection": { "dataType": "MUTATION_EXTENDED", "mutationCountBy": "MutationType", "selectedGeneOption": "IDH1" }, "plotsVertSelection": { "dataType": "mrna", "selectedGeneOption": "IDH1", "selectedDataSourceOption": "rna_seq_v2_mrna" } } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/results/plots?cancer_study_list=lgg_tcga_pan_can_atlas_2018&gene_list=IDH1%3A+MUT&case_set_id=lgg_tcga_pan_can_atlas_2018_all&profileFilter=rna_seq_v2_mrna&plots_horz_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22MUTATION_EXTENDED%22%2C%22mutationCountBy%22%3A%22MutationType%22%7D&plots_vert_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22mrna%22%2C%22selectedDataSourceOption%22%3A%22rna_seq_v2_mrna%22%7D","url":"https://www.cbioportal.org/results/plots?cancer_study_list=lgg_tcga_pan_can_atlas_2018&gene_list=IDH1%3A+MUT&case_set_id=lgg_tcga_pan_can_atlas_2018_all&profileFilter=rna_seq_v2_mrna&plots_horz_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22MUTATION_EXTENDED%22%2C%22mutationCountBy%22%3A%22MutationType%22%7D&plots_vert_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22mrna%22%2C%22selectedDataSourceOption%22%3A%22rna_seq_v2_mrna%22%7D","data":{"studyIds":["lgg_tcga_pan_can_atlas_2018"],"studies":[{"studyId":"lgg_tcga_pan_can_atlas_2018","name":"Brain Lower Grade Glioma (TCGA, PanCancer Atlas)","sampleCount":514}],"genes":["IDH1"],"caseSetId":"lgg_tcga_pan_can_atlas_2018_all","pageDescription":"Scatter/box plots: IDH1 mrna (y-axis) by IDH1 mutation (x-axis)."}} ═ answer (success) ## IDH1 mRNA Expression by IDH1 Mutation Status — TCGA Lower Grade Glioma (PanCancer Atlas) Cohort: **514 samples**, of which 514 were profiled for both mutations and RNA-Seq V2 (RSEM) expression. | IDH1 Status | n (samples) | Mean RSEM | Median RSEM | SD | Min | Max | |---|---|---|---|---|---|---| | Mutant | 395 | 1679.2 | 1585.3 | 579.5 | 349.9 | 3725.2 | | Wildtype | 119 | 1893.7 | 1816.7 | 977.4 | 321.3 | 5411.2 | **Observations (descriptive only):** IDH1-mutant samples show somewhat lower mean/median RSEM expression and less spread than wildtype samples, but I have not run a statistical test (e.g., Mann-Whitney U) on this difference — no significance claim is made here. Note IDH1-mutant LGG (~77% of this cohort, consistent with the well-established high IDH1 mutation rate in lower-grade glioma) tend to be driven largely by R132 hotspot mutations. [View IDH1 mRNA expression by mutation status (box plot)](https://www.cbioportal.org/results/plots?cancer_study_list=lgg_tcga_pan_can_atlas_2018&gene_list=IDH1%3A+MUT&case_set_id=lgg_tcga_pan_can_atlas_2018_all&profileFilter=rna_seq_v2_mrna&plots_horz_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22MUTATION_EXTENDED%22%2C%22mutationCountBy%22%3A%22MutationType%22%7D&plots_vert_selection=%7B%22selectedGeneOption%22%3A%223417%22%2C%22dataType%22%3A%22mrna%22%2C%22selectedDataSourceOption%22%3A%22rna_seq_v2_mrna%22%7D) This opens the Plots tab with IDH1 mRNA (RNA-Seq V2 RSEM) on the y-axis and IDH1 mutation type on the x-axis, letting you inspect individual points, hover for sample details, or switch to a log scale.