Q (haiku): calculate median expression of ceacam5, itgb6, muc2, tpgb and muc1 mRNA in pancreatic cancer ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ search_oncotree { "search_term": "pancreatic cancer" } ▶ list_studies { "search": "pancreatic", "limit": 20 } ◀ 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":[{"code":"IOPN","name":"Intraductal Oncocytic Papillary Neoplasm","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT > IOPN"},{"code":"IPMN","name":"Intraductal Papillary Mucinous Neoplasm","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT > IPMN"},{"code":"ITPN","name":"Intraductal Tubulopapillary Neoplasm","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT > ITPN"},{"code":"MCN","name":"Mucinous Cystic Neoplasm","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT > MCN"},{"code":"OSGCT","name":"Osteoclastic Giant Cell Tumor","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > UCP > OSGCT"},{"code":"PAAC","name":"Acinar Cell Carcinoma of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PAAC"},{"code":"PAAD","name":"Pancreatic Adenocarcinoma","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PAAD"},{"code":"PAASC","name":"Adenosquamous Carcinoma of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PAASC"},{"code":"PACT","name":"Cystic Tumor of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT"},{"code":"PANCREAS","name":"Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS"},{"code":"PANEC","name":"Pancreatic Neuroendocrine Carcinoma","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PANEC"},{"code":"PANET","name":"Pancreatic Neuroendocrine Tumor","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PANET"},{"code":"PB","name":"Pancreatoblastoma","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PB"},{"code":"PSC","name":"Serous Cystadenoma of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > PACT > PSC"},{"code":"SPN","name":"Solid Pseudopapillary Neoplasm of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > SPN"},{"code":"UCP","name":"Undifferentiated Carcinoma of the Pancreas","score":65,"mainType":"Pancreatic Cancer","tissue":"Pancreas","hierarchy":"PANCREAS > UCP"}]} ◀ 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":"pdac_msk_2024","name":"Pancreatic Adenocarcinoma (MSK, Nat Med 2024)","type_of_cancer_id":"pancreas","sample_count":2336,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=pdac_msk_2024"},{"cancer_study_identifier":"paad_qcmg_uq_2016","name":"Pancreatic Adenocarcinoma (QCMG, Nature 2016)","type_of_cancer_id":"paad","sample_count":456,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_qcmg_uq_2016"},{"cancer_study_identifier":"pancreas_ctdna_msk_2025","name":"Pancreatic Cancer cfDNA (MSK, J Natl Cancer Inst 2025)","type_of_cancer_id":"paad","sample_count":412,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=pancreas_ctdna_msk_2025"},{"cancer_study_identifier":"pancreas_msk_2024","name":"Pancreatic Cancer (MSK, Cancer Cell 2024)","type_of_cancer_id":"pancreas","sample_count":395,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=pancreas_msk_2024"},{"cancer_study_identifier":"paad_tcga_gdc","name":"Pancreatic Adenocarcinoma (TCGA GDC, 2025)","type_of_cancer_id":"paad","sample_count":186,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_tcga_gdc"},{"cancer_study_identifier":"paad_tcga","name":"Pancreatic Adenocarcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"paad","sample_count":186,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_tcga"},{"cancer_study_identifier":"paad_tcga_pan_can_atlas_2018","name":"Pancreatic Adenocarcinoma (TCGA, PanCancer Atlas)","type_of_cancer_id":"paad","sample_count":184,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_tcga_pan_can_atlas_2018"},{"cancer_study_identifier":"pancreas_cptac_gdc","name":"Pancreatic Cancer (CPTAC GDC, 2025)","type_of_cancer_id":"pancreas","sample_count":183,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=pancreas_cptac_gdc"},{"cancer_study_identifier":"paad_cptac_2021","name":"Pancreatic Ductal Adenocarcinoma (CPTAC, Cell 2021)","type_of_cancer_id":"paad","sample_count":140,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_cptac_2021"},{"cancer_study_identifier":"paad_utsw_2015","name":"Pancreatic Cancer (UTSW, Nat Commun 2015)","type_of_cancer_id":"paad","sample_count":109,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_utsw_2015"},{"cancer_study_identifier":"paad_icgc","name":"Pancreatic Adenocarcinoma (ICGC, Nature 2012)","type_of_cancer_id":"paad","sample_count":99,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=paad_icgc"},{"cancer_study_identifier":"panet_arcnet_2017","name":"Pancreatic Neuroendocrine Tumors (Multi-Institute, Nature 2017)","type_of_cancer_id":"panet","sample_count":98,"has_gui … (1828 more chars) ▶ clickhouse_run_select_query { "query": " SELECT DISTINCT profile_type FROM genetic_alteration_derived WHERE cancer_study_identifier = 'pdac_msk_2024' ORDER BY profile_type LIMIT 50 " } ◀ result {"rows":[{"profile_type":"cna"}]} ▶ clickhouse_run_select_query { "query": " SELECT DISTINCT profile_type FROM genetic_alteration_derived WHERE cancer_study_identifier = 'paad_tcga_pan_can_atlas_2018' ORDER BY profile_type " } ◀ result {"rows":[{"profile_type":"gistic"},{"profile_type":"log2CNA"},{"profile_type":"rna_seq_v2_mrna"},{"profile_type":"rna_seq_v2_mrna_median_Zscores"},{"profile_type":"rna_seq_v2_mrna_median_all_sample_Zscores"},{"profile_type":"rppa"},{"profile_type":"rppa_Zscores"}]} ▶ clickhouse_run_select_query { "query": " SELECT hugo_gene_symbol, count() AS samples_with_data, round(median(toFloat64OrNull(alteration_value)), 2) AS median_rsem, round(quantile(0.25)(toFloat64OrNull(alteration_value)), 2) AS q25_rsem, round(quantile(0.75)(toFloat64OrNull(alteration_value)), 2) AS q75_rsem FROM genetic_alteration_derived WHERE cancer_study_identifier = 'paad_tcga_pan_can_atlas_2018' AND profile_type = 'rna_seq_v2_mrna' AND hugo_gene_symbol IN ('CEACAM5', 'ITGB6', 'MUC2', 'TPGB', 'MUC1') AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL GROUP BY hugo_gene_symbol ORDER BY hugo_gene_symbol ", "max_rows": 10 } ◀ result {"rows":[{"hugo_gene_symbol":"CEACAM5","samples_with_data":177,"median_rsem":10049.7,"q25_rsem":1115.14,"q75_rsem":32625.1},{"hugo_gene_symbol":"ITGB6","samples_with_data":177,"median_rsem":3740.15,"q25_rsem":2365.02,"q75_rsem":6166.43},{"hugo_gene_symbol":"MUC1","samples_with_data":177,"median_rsem":14799,"q25_rsem":7580.57,"q75_rsem":26641.5},{"hugo_gene_symbol":"MUC2","samples_with_data":177,"median_rsem":6.53,"q25_rsem":1.35,"q75_rsem":65.17}]} ═ answer (success) ## mRNA Expression Medians in Pancreatic Adenocarcinoma **Study:** [Pancreatic Adenocarcinoma (TCGA, PanCancer Atlas)](https://www.cbioportal.org/study/summary?id=paad_tcga_pan_can_atlas_2018) — 184 samples, 177 with expression data | Gene | Median RSEM | Q1–Q3 (IQR) | |---|---|---| | **CEACAM5** | 10,049.7 | 1,115–32,625 | | **ITGB6** | 3,740.2 | 2,365–6,166 | | **MUC1** | 14,799.0 | 7,581–26,642 | | **MUC2** | 6.5 | 1.4–65.2 | | **TPGB** | *Not found* | — | **Data type:** RSEM (RNA-Seq by Expectation Maximization), batch-normalized across TCGA PanCancer Atlas studies for cross-cancer comparability. Raw counts, not Z-scores — values reflect absolute expression level. **Note:** TPGB was not detected in the expression data for this study. If you're looking for an alternative gene name or want to check a different study (e.g., the larger MSK 2024 cohort has 2,336 samples but lacks mRNA data), let me know. **Interpretation:** MUC1 shows the highest median expression; ITGB6 is moderately expressed across samples; CEACAM5 has high median but very wide spread (IQR spanning 30-fold). MUC2 is very lowly expressed, consistent with adenocarcinoma biology (not columnar/mucinous).