Q (sonnet): "In breast cancer, what is the correlation coefficient between EGFR expression levels and PIK3CA mutation status considering only patients who also have a homozygous deletion of PTEN?" ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ list_studies { "search": "breast" } ◀ 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 {"result":[{"cancer_study_identifier":"msk_met_2021","name":"MSK MetTropism (MSK, Cell 2021)","type_of_cancer_id":"mixed","sample_count":25775,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=msk_met_2021"},{"cancer_study_identifier":"breast_msk_2026","name":"CCNE1 Amplifications in Breast Cancer (MSK, 2026)","type_of_cancer_id":"breast","sample_count":6318,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=breast_msk_2026"},{"cancer_study_identifier":"breast_msk_2025","name":"Breast Cancer (MSK, Nat Genet 2025)","type_of_cancer_id":"brca","sample_count":3879,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=breast_msk_2025"},{"cancer_study_identifier":"brca_metabric","name":"Breast Cancer (METABRIC, Nature 2012 & Nat Commun 2016)","type_of_cancer_id":"brca","sample_count":2509,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_metabric"},{"cancer_study_identifier":"breast_msk_2018","name":"Breast Cancer (MSK, Cancer Cell 2018)","type_of_cancer_id":"breast","sample_count":1918,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=breast_msk_2018"},{"cancer_study_identifier":"breast_ink4_msk_2021","name":"Metastatic Breast Cancer (MSK, Cancer Discovery 2022)","type_of_cancer_id":"breast","sample_count":1365,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=breast_ink4_msk_2021"},{"cancer_study_identifier":"brca_tcga","name":"Breast Invasive Carcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"brca","sample_count":1108,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_tcga"},{"cancer_study_identifier":"brca_tcga_gdc","name":"Invasive Breast Carcinoma (TCGA GDC, 2025)","type_of_cancer_id":"brca","sample_count":1102,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_tcga_gdc"},{"cancer_study_identifier":"brca_tcga_pan_can_atlas_2018","name":"Breast Invasive Carcinoma (TCGA, PanCancer Atlas)","type_of_cancer_id":"brca","sample_count":1084,"has_guide":true,"url":"https://www.cbioportal.org/study/summary?id=brca_tcga_pan_can_atlas_2018"},{"cancer_study_identifier":"brca_tcga_pub","name":"Breast Invasive Carcinoma (TCGA, Nature 2012)","type_of_cancer_id":"brca","sample_count":825,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_tcga_pub"},{"cancer_study_identifier":"brca_tcga_pub2015","name":"Breast Invasive Carcinoma (TCGA, Cell 2015)","type_of_cancer_id":"brca","sample_count":818,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_tcga_pub2015"},{"cancer_study_identifier":"brca_msk_2025","name":"Breast Carcinoma (MSK, NPJ Precis Oncol 2025)","type_of_cancer_id":"brca","sample_count":527,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=brca_msk_2025"},{"cancer_study_identifier":"brca_mbcproject_2022","name":"The Metastatic Breast Cancer Project (Provisional, December 2021)","type_of_cancer_id":"brca","sample_count":379,"has_gu … (1846 more chars) ▶ clickhouse_list_table_columns { "table": "genetic_alteration_derived" } ▶ clickhouse_list_table_columns { "table": "genomic_event_derived" } ◀ result {"columns":[{"name":"sample_unique_id","type":"String"},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"hugo_gene_symbol","type":"String"},{"name":"profile_type","type":"LowCardinality(String)"},{"name":"alteration_value","type":"Nullable(String)"}]} ◀ 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": " SELECT cancer_study_identifier, count(DISTINCT sample_unique_id) AS n_pten_homdel FROM genomic_event_derived WHERE hugo_gene_symbol = 'PTEN' AND variant_type = 'cna' AND cna_alteration = -2 AND cancer_study_identifier IN ('brca_metabric','brca_tcga_pan_can_atlas_2018') GROUP BY cancer_study_identifier " } ▶ clickhouse_run_select_query { "query": " SELECT cancer_study_identifier, profile_type, count(DISTINCT sample_unique_id) AS n FROM genetic_alteration_derived WHERE cancer_study_identifier IN ('brca_metabric','brca_tcga_pan_can_atlas_2018') AND profile_type IN ('mrna','mrna_median_Zscores','mrna_seq_v2_rsem','mrna_seq_v2_rsem_Zscores','mrna_U133') AND hugo_gene_symbol = 'EGFR' GROUP BY cancer_study_identifier, profile_type ORDER BY cancer_study_identifier, profile_type " } ◀ result {"rows":[{"cancer_study_identifier":"brca_metabric","n_pten_homdel":44},{"cancer_study_identifier":"brca_tcga_pan_can_atlas_2018","n_pten_homdel":55}]} ◀ result {"rows":[{"cancer_study_identifier":"brca_metabric","profile_type":"mrna","n":1980}]} ▶ clickhouse_run_select_query { "query": " WITH pten_del AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'brca_metabric' AND hugo_gene_symbol = 'PTEN' AND variant_type = 'cna' AND cna_alteration = -2 ), egfr_expr AS ( SELECT sample_unique_id, toFloat64OrNull(alteration_value) AS expr FROM genetic_alteration_derived WHERE cancer_study_identifier = 'brca_metabric' AND profile_type = 'mrna' AND hugo_gene_symbol = 'EGFR' AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL ), pik3ca_mut AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'brca_metabric' AND hugo_gene_symbol = 'PIK3CA' AND variant_type = 'mutation' AND mutation_status != 'UNCALLED' ) SELECT count() AS n_samples, sum(if(p.sample_unique_id IS NOT NULL, 1, 0)) AS n_pik3ca_mutant, corr(e.expr, if(p.sample_unique_id IS NOT NULL, 1.0, 0.0)) AS point_biserial_corr FROM pten_del d INNER JOIN egfr_expr e USING (sample_unique_id) LEFT JOIN pik3ca_mut p ON p.sample_unique_id = d.sample_unique_id " } ◀ result {"rows":[{"n_samples":42,"n_pik3ca_mutant":42,"point_biserial_corr":null}]} ▶ clickhouse_run_select_query { "query": " WITH pten_del AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'brca_metabric' AND hugo_gene_symbol = 'PTEN' AND variant_type = 'cna' AND cna_alteration = -2 ), egfr_expr AS ( SELECT sample_unique_id, toFloat64OrNull(alteration_value) AS expr FROM genetic_alteration_derived WHERE cancer_study_identifier = 'brca_metabric' AND profile_type = 'mrna' AND hugo_gene_symbol = 'EGFR' AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL ), cohort AS ( SELECT d.sample_unique_id AS sample_unique_id, e.expr AS expr FROM pten_del d INNER JOIN egfr_expr e ON e.sample_unique_id = d.sample_unique_id ), pik3ca_mut_samples AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived WHERE cancer_study_identifier = 'brca_metabric' AND hugo_gene_symbol = 'PIK3CA' AND variant_type = 'mutation' AND mutation_status != 'UNCALLED' ) SELECT count() AS n_samples, sum(if(sample_unique_id IN (SELECT sample_unique_id FROM pik3ca_mut_samples), 1, 0)) AS n_pik3ca_mutant, corr(expr, if(sample_unique_id IN (SELECT sample_unique_id FROM pik3ca_mut_samples), 1.0, 0.0)) AS point_biserial_corr FROM cohort " } ◀ result {"rows":[{"n_samples":42,"n_pik3ca_mutant":6,"point_biserial_corr":0.08325733155496783}]} ▶ resolve_and_route { "studyIds": [ "brca_metabric" ] } ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"brca_metabric","name":"Breast Cancer (METABRIC, Nature 2012 & Nat Commun 2016)","sampleCount":2509,"studyViewUrl":"https://www.cbioportal.org/study?id=brca_metabric","metadata":{"clinicalAttributeIds":["AGE_AT_DIAGNOSIS","BREAST_SURGERY","CANCER_TYPE","CANCER_TYPE_DETAILED","CELLULARITY","CHEMOTHERAPY","CLAUDIN_SUBTYPE","COHORT","ER_IHC","ER_STATUS","GRADE","HER2_SNP6","HER2_STATUS","HISTOLOGICAL_SUBTYPE","HORMONE_THERAPY","INFERRED_MENOPAUSAL_STATE","INTCLUST","LATERALITY","LYMPH_NODES_EXAMINED_POSITIVE","MUTATION_COUNT","NPI","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","PR_STATUS","RADIO_THERAPY","RFS_MONTHS","RFS_STATUS","SAMPLE_COUNT","SAMPLE_TYPE","SEX","THREEGENE","TMB_NONSYNONYMOUS","TUMOR_SIZE","TUMOR_STAGE","VITAL_STATUS"],"molecularProfileIds":["brca_metabric_cna","brca_metabric_methylation_promoters_rrbs","brca_metabric_mrna","brca_metabric_mrna_median_all_sample_Zscores","brca_metabric_mutations"],"heatmapProfileIds":["brca_metabric_methylation_promoters_rrbs","brca_metabric_mrna_median_all_sample_Zscores"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations","mrna","dna_methylation"]}}]}} ▶ navigate_to_study_view { "studyIds": [ "brca_metabric" ], "filterJson": { "geneFilters": [ { "molecularProfileIds": [ "brca_metabric_cna" ], "geneQueries": [ [ { "hugoGeneSymbol": "PTEN", "alterations": [ "HOMDEL" ] } ] ] } ] } } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/study/summary?id=brca_metabric#filterJson=%7B%22geneFilters%22%3A%5B%7B%22geneQueries%22%3A%5B%5B%7B%22alterations%22%3A%5B%22HOMDEL%22%5D%2C%22hugoGeneSymbol%22%3A%22PTEN%22%7D%5D%5D%2C%22molecularProfileIds%22%3A%5B%22brca_metabric_cna%22%5D%7D%5D%7D","url":"https://www.cbioportal.org/study/summary?id=brca_metabric#filterJson=%7B%22geneFilters%22%3A%5B%7B%22geneQueries%22%3A%5B%5B%7B%22alterations%22%3A%5B%22HOMDEL%22%5D%2C%22hugoGeneSymbol%22%3A%22PTEN%22%7D%5D%5D%2C%22molecularProfileIds%22%3A%5B%22brca_metabric_cna%22%5D%7D%5D%7D","data":{"studyIds":["brca_metabric"],"studies":[{"studyId":"brca_metabric","name":"Breast Cancer (METABRIC, Nature 2012 & Nat Commun 2016)","sampleCount":2509}],"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_results_view { "studyIds": [ "brca_metabric" ], "genes": [ "PIK3CA: MUT", "EGFR" ], "tab": "plots", "studyViewFilter": { "geneFilters": [ { "molecularProfileIds": [ "brca_metabric_cna" ], "geneQueries": [ [ { "hugoGeneSymbol": "PTEN", "alterations": [ "HOMDEL" ] } ] ] } ] }, "plotsHorzSelection": { "dataType": "MUTATION_EXTENDED", "mutationCountBy": "MUTATED_VS_WILD_TYPE", "selectedGeneOption": "PIK3CA" }, "plotsVertSelection": { "dataType": "mrna", "selectedGeneOption": "EGFR" } } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/results/plots?session_id=6ab5d0efe497aad53593c28b","url":"https://www.cbioportal.org/results/plots?session_id=6ab5d0efe497aad53593c28b","data":{"studyIds":["brca_metabric"],"studies":[{"studyId":"brca_metabric","name":"Breast Cancer (METABRIC, Nature 2012 & Nat Commun 2016)","sampleCount":2509}],"genes":["PIK3CA","EGFR"],"filteredSampleCount":44,"caseSetId":"-1","sessionId":"6ab5d0efe497aad53593c28b","studyViewUrl":"https://www.cbioportal.org/study?id=brca_metabric#filterJson=%7B%22geneFilters%22%3A%5B%7B%22molecularProfileIds%22%3A%5B%22brca_metabric_cna%22%5D%2C%22geneQueries%22%3A%5B%5B%7B%22hugoGeneSymbol%22%3A%22PTEN%22%2C%22alterations%22%3A%5B%22HOMDEL%22%5D%7D%5D%5D%7D%5D%7D","pageDescription":"Scatter/box plots: EGFR mrna (y-axis) by PIK3CA mutation (x-axis)."}} ═ answer (success) **Live views for exploring this yourself:** - [PTEN homozygous deletion cohort — Study View overview](https://www.cbioportal.org/study/summary?id=brca_metabric#filterJson=%7B%22geneFilters%22%3A%5B%7B%22geneQueries%22%3A%5B%5B%7B%22alterations%22%3A%5B%22HOMDEL%22%5D%2C%22hugoGeneSymbol%22%3A%22PTEN%22%7D%5D%5D%2C%22molecularProfileIds%22%3A%5B%22brca_metabric_cna%22%5D%7D%5D%7D) (44 samples with the deletion, before requiring EGFR expression data) - [EGFR expression vs. PIK3CA mutation status — Plots tab, restricted to the PTEN-deleted cohort](https://www.cbioportal.org/results/plots?session_id=6ab5d0efe497aad53593c28b) — a box/scatter plot you can inspect directly, with the exact same 44-sample PTEN HOMDEL filter applied. The Plots tab will show you the same distributions underlying the r≈0.083 estimate above and lets you export the paired values if you want to run a formal significance test (e.g., point-biserial t-test) in R or Python.