Q (haiku): Help me rank TCGA cancer studies based on median CD3 expression ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ list_studies { "search": "TCGA", "limit": 100 } ◀ 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":"pancan_pcawg_2020","name":"Pan-cancer analysis of whole genomes (ICGC/TCGA, Nature 2020)","type_of_cancer_id":"mixed","sample_count":2922,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=pancan_pcawg_2020"},{"cancer_study_identifier":"nsclc_tcga_broad_2016","name":"Pan-Lung Cancer (TCGA, Nat Genet 2016)","type_of_cancer_id":"nsclc","sample_count":1144,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=nsclc_tcga_broad_2016"},{"cancer_study_identifier":"lgggbm_tcga_pub","name":"Merged Cohort of LGG and GBM (TCGA, Cell 2016)","type_of_cancer_id":"difg","sample_count":1122,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=lgggbm_tcga_pub"},{"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":"coadread_tcga","name":"Colorectal Adenocarcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"coadread","sample_count":640,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=coadread_tcga"},{"cancer_study_identifier":"gbm_tcga","name":"Glioblastoma Multiforme (TCGA, Firehose Legacy)","type_of_cancer_id":"difg","sample_count":619,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=gbm_tcga"},{"cancer_study_identifier":"ov_tcga","name":"Ovarian Serous Cystadenocarcinoma (TCGA, Firehose Legacy)","type_of_cancer_id":"hgsoc","sample_count":617,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=ov_tcga"},{"cancer_study_identifier":"gbm_tcga_gdc","name":"Glioblastoma Multiforme (TCGA GDC, 2025)","type_of_cancer_id":"difg","sample_count":611,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=gbm_tcga_gdc"},{"cancer_study_identifier":"hgsoc_tcga_gdc","name":"High-Grade Serous Ovarian Cancer (TCGA GDC, 2025)","type_of_cancer_id":"hgsoc","sample_count":604,"has_guide":false," … (20756 more chars) ▶ clickhouse_list_table_columns { "table": "genetic_alteration_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)"}]} ▶ clickhouse_run_select_query { "query": " WITH cd3_data AS ( SELECT cancer_study_identifier, hugo_gene_symbol, profile_type, toFloat64OrNull(alteration_value) AS cd3_value FROM genetic_alteration_derived WHERE hugo_gene_symbol = 'CD3D' AND cancer_study_identifier LIKE '%tcga%' AND alteration_value NOT IN ('', 'NA') AND toFloat64OrNull(alteration_value) IS NOT NULL ) SELECT cancer_study_identifier, profile_type, count() AS sample_count, quantile(0.5)(cd3_value) AS median_cd3, quantile(0.25)(cd3_value) AS q1_cd3, quantile(0.75)(cd3_value) AS q3_cd3, min(cd3_value) AS min_cd3, max(cd3_value) AS max_cd3, avg(cd3_value) AS mean_cd3 FROM cd3_data GROUP BY cancer_study_identifier, profile_type ORDER BY median_cd3 DESC ", "max_rows": 200 } ◀ result {"rows":[{"cancer_study_identifier":"thym_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":120,"median_cd3":17330.5,"q1_cd3":2893.25,"q3_cd3":33382.75,"min_cd3":56,"max_cd3":64624,"mean_cd3":20150.433333333334},{"cancer_study_identifier":"thym_tcga","profile_type":"rna_seq_v2_mrna","sample_count":120,"median_cd3":6932.0932,"q1_cd3":1248.513225,"q3_cd3":14307.81055,"min_cd3":16.6549,"max_cd3":36818.7192,"mean_cd3":9116.191934999997},{"cancer_study_identifier":"thym_tcga_pan_can_atlas_2018","profile_type":"rna_seq_v2_mrna","sample_count":119,"median_cd3":6846.47,"q1_cd3":1234.03,"q3_cd3":14316.3,"min_cd3":16.6549,"max_cd3":36818.7,"mean_cd3":9129.270594117648},{"cancer_study_identifier":"dlbclnos_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":48,"median_cd3":2356,"q1_cd3":936,"q3_cd3":4051.75,"min_cd3":135,"max_cd3":31523,"mean_cd3":3291.9583333333335},{"cancer_study_identifier":"thym_tcga_gdc","profile_type":"mrna_seq_tpm","sample_count":120,"median_cd3":1428.32665,"q1_cd3":272.37975,"q3_cd3":3441.166475,"min_cd3":5.577,"max_cd3":6200.697,"mean_cd3":1974.5852841666667},{"cancer_study_identifier":"dlbc_tcga_pan_can_atlas_2018","profile_type":"rna_seq_v2_mrna","sample_count":48,"median_cd3":1076.0194999999999,"q1_cd3":448.55625,"q3_cd3":1938.5025,"min_cd3":92.8799,"max_cd3":13022.6,"mean_cd3":1515.5197479166666},{"cancer_study_identifier":"dlbc_tcga","profile_type":"rna_seq_v2_mrna","sample_count":48,"median_cd3":1076.0181,"q1_cd3":448.55665,"q3_cd3":1938.5057749999999,"min_cd3":92.8799,"max_cd3":13022.5564,"mean_cd3":1515.5190666666667},{"cancer_study_identifier":"thym_tcga_gdc","profile_type":"mrna_seq_fpkm","sample_count":120,"median_cd3":522.47225,"q1_cd3":96.26872500000002,"q3_cd3":1046.33195,"min_cd3":1.2692999999999999,"max_cd3":2930.3771,"mean_cd3":691.6581491666669},{"cancer_study_identifier":"nsgct_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":156,"median_cd3":521,"q1_cd3":209,"q3_cd3":1000.75,"min_cd3":12,"max_cd3":4219,"mean_cd3":732.9679487179487},{"cancer_study_identifier":"ccrcc_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":534,"median_cd3":423,"q1_cd3":233,"q3_cd3":785.5,"min_cd3":4,"max_cd3":4557,"mean_cd3":649.8014981273408},{"cancer_study_identifier":"stad_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":412,"median_cd3":402,"q1_cd3":205.75,"q3_cd3":753.75,"min_cd3":9,"max_cd3":4226,"mean_cd3":576.0849514563107},{"cancer_study_identifier":"luad_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":518,"median_cd3":358,"q1_cd3":184.25,"q3_cd3":641.75,"min_cd3":1,"max_cd3":3217,"mean_cd3":509.75482625482624},{"cancer_study_identifier":"cesc_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":306,"median_cd3":350.5,"q1_cd3":162.5,"q3_cd3":743,"min_cd3":3,"max_cd3":6748,"mean_cd3":628.1307189542483},{"cancer_study_identifier":"hnsc_tcga_gdc","profile_type":"rna_seq_mrna","sample_count":522,"median_cd3":270,"q1_cd3":124,"q3_cd3":558.75,"min_cd3":6,"max_cd3":3741,"mean_cd3":451.2681992337165},{" … (41817 more chars) ▶ resolve_and_route { "studyIds": "[\"thym_tcga_gdc\", \"thym_tcga\", \"dlbclnos_tcga_gdc\", \"dlbc_tcga\", \"nsgct_tcga_gdc\", \"ccrcc_tcga_gdc\", \"stad_tcga_gdc\", \"luad_tcga_gdc\", \"cesc_tcga_gdc\", \"hnsc_tcga_gdc\"]" } ✗ error Error: No such tool available: mcp__claude_ai_cBioPortal_MCP__resolve_and_route ▶ resolve_and_route { "studyIds": [ "thym_tcga_gdc" ] } ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"thym_tcga_gdc","name":"Thymoma (TCGA GDC, 2025)","sampleCount":124,"studyViewUrl":"https://www.cbioportal.org/study?id=thym_tcga_gdc","metadata":{"clinicalAttributeIds":["AGE","BIOPSY_SITE","CANCER_TYPE","CANCER_TYPE_DETAILED","DAYS_LAST_FOLLOWUP","DAYS_TO_BIRTH","DAYS_TO_DEATH","DFS_MONTHS","DFS_STATUS","DISEASE_TYPE","ETHNICITY","FRACTION_GENOME_ALTERED","ICD_10","IS_FFPE","MASAOKA_STAGE","MORPHOLOGY","MUTATION_COUNT","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","OTHER_PATIENT_ID","OTHER_SAMPLE_ID","PRIMARY_DIAGNOSIS","PRIMARY_SITE_PATIENT","PRIOR_MALIGNANCY","PRIOR_TREATMENT","PROJECT_ID","PROJECT_NAME","PROJECT_STATE","RACE","SAMPLE_COUNT","SAMPLE_TYPE","SAMPLE_TYPE_ID","SEX","TMB_NONSYNONYMOUS","VITAL_STATUS","YEAR_OF_DIAGNOSIS"],"molecularProfileIds":["thym_tcga_gdc_cna","thym_tcga_gdc_mrna_seq_fpkm","thym_tcga_gdc_mrna_seq_fpkm_Zscores","thym_tcga_gdc_mrna_seq_read_counts_Zscores","thym_tcga_gdc_mrna_seq_tpm","thym_tcga_gdc_mrna_seq_tpm_Zscores","thym_tcga_gdc_mutations","thym_tcga_gdc_rna_seq_mrna"],"heatmapProfileIds":["thym_tcga_gdc_mrna_seq_fpkm_Zscores","thym_tcga_gdc_mrna_seq_read_counts_Zscores","thym_tcga_gdc_mrna_seq_tpm_Zscores"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations","mrna"]}}]}} ═ answer (success) Perfect! Now let me create a comprehensive ranking table. Here are the **TCGA cancer studies ranked by median CD3 expression**: ## Top 20 TCGA Studies by Median CD3 Expression | Rank | Study | Cancer Type | Median CD3 | Sample Count | Profile Type | Q1–Q3 IQR | |------|-------|-------------|-----------|--------------|--------------|-----------| | 1 | [Thymoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=thym_tcga_gdc) | Thymoma | **17,330.5** | 120 | rna_seq_mrna | 2,893–33,383 | | 2 | [Thymoma (TCGA, Firehose Legacy)](https://www.cbioportal.org/study?id=thym_tcga) | Thymoma | **6,932.1** | 120 | rna_seq_v2_mrna | 1,249–14,308 | | 3 | [Thymoma (TCGA, PanCancer Atlas)](https://www.cbioportal.org/study?id=thym_tcga_pan_can_atlas_2018) | Thymoma | **6,846.5** | 119 | rna_seq_v2_mrna | 1,234–14,316 | | 4 | [Diffuse Large B-Cell Lymphoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=dlbclnos_tcga_gdc) | DLBC | **2,356** | 48 | rna_seq_mrna | 936–4,052 | | 5 | [Diffuse Large B-Cell Lymphoma (TCGA, PanCancer Atlas)](https://www.cbioportal.org/study?id=dlbc_tcga_pan_can_atlas_2018) | DLBC | **1,076** | 48 | rna_seq_v2_mrna | 449–1,939 | | 6 | [Non-Seminomatous Germ Cell Tumor (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=nsgct_tcga_gdc) | Germ Cell | **521** | 156 | rna_seq_mrna | 209–1,001 | | 7 | [Renal Clear Cell Carcinoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=ccrcc_tcga_gdc) | RCC | **423** | 534 | rna_seq_mrna | 233–786 | | 8 | [Stomach Adenocarcinoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=stad_tcga_gdc) | Gastric | **402** | 412 | rna_seq_mrna | 206–754 | | 9 | [Lung Adenocarcinoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=luad_tcga_gdc) | LUAD | **358** | 518 | rna_seq_mrna | 184–642 | | 10 | [Cervical Squamous Cell Carcinoma (TCGA GDC, 2025)](https://www.cbioportal.org/study?id=cesc_tcga_gdc) | Cervical | **350.5** | 306 | rna_seq_mrna | 163–743 | ## Key Findings **Hematologic and immune-rich tumors dominate the top ranks:** 1. **Thymoma studies** show extraordinarily high CD3 expression (6,800–17,300), reflecting the lymphoid nature of thymic tissue. The GDC 2025 version shows the highest median. 2. **Lymphoma (DLBC)** and **germ cell tumors** also rank high (1,000–2,300), consistent with their immune-rich microenvironments. 3. **Immune-infiltrated epithelial cancers** (stomach, cervical, head/neck, lung) cluster in the middle range (200–400), reflecting T cell infiltration associated with inflammation or immunogenicity. 4. **Prostate, glioma, and low-grade tumors** appear at the bottom of the full ranking (<50), likely indicating T cell-poor microenvironments. --- ## Notes on CD3 Expression Measurement - **CD3D** (queried here) is the CD3 delta chain, a robust pan-T cell marker (α, β, γδ T cells). - **Multiple profile types** are represented (rna_seq_mrna, rna_seq_v2_mrna, mrna_seq_tpm, mrna_seq_fpkm) — these use different normalization schemes and are **not directly comparable across studies**. Within-study comparisons are valid; cross-study correlations should use Z-scored profiles only. - **Median vs mean:** Median is more robust to outliers; note that Q1–Q3 ranges show wide variability in many studies, suggesting tumor-to-tumor heterogeneity in T cell infiltration. To explore CD3 expression in your top study of interest, visit: [**View Thymoma (TCGA GDC, 2025) in cBioPortal**](https://www.cbioportal.org/study?id=thym_tcga_gdc)