Q (sonnet-5.5): In TCGA lower grade glioma, show me samples with EGFR gains. ▶ read_guide { "uri": "cbioportal://gene-expression-guide" } ▶ resolve_and_route { "studyKeywords": [ "TCGA", "lower grade glioma" ] } ◀ 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 {"success":true,"message":"Found 2 matching studies. Pick the best match (prefer TCGA → prefer PanCancer Atlas), use its metadata to call the appropriate navigation tool(s) and generate URLs immediately. Present other studies as alternatives.","data":{"totalCount":2,"studiesWithMetadata":[{"studyId":"lgg_tcga","name":"Brain Lower Grade Glioma (TCGA, Firehose Legacy)","sampleCount":530,"studyViewUrl":"https://www.cbioportal.org/study?id=lgg_tcga","metadata":{"clinicalAttributeIds":["AGE","ANIMAL_INSECT_ALLERGY_AGE","ANIMAL_INSECT_ALLERGY_HIST","ASTHMA_ECZEMA_ALLERGY_FIRST_DIAGNOSIS","ASTHMA_HISTORY","CANCER_TYPE","CANCER_TYPE_DETAILED","DAYS_TO_COLLECTION","DAYS_TO_INITIAL_PATHOLOGIC_DIAGNOSIS","DAYS_TO_SPECIMEN_COLLECTION","DFS_MONTHS","DFS_STATUS","DISEASE_CODE","ECOG_SCORE","ECZEMA_HISTORY","ETHNICITY","FAMILY_HISTORY_OF_CANCER","FAMILY_HISTORY_OF_PRIMARY_BRAIN_TUMOR","FIRST_SYMPTOM_LONGEST_DURATION","FOOD_ALLERGY_AGE","FOOD_ALLERGY_HISTORY","FOOD_ALLERGY_TYPES","FORM_COMPLETION_DATE","FRACTION_GENOME_ALTERED","GRADE","HAY_FEVER_HISTORY","HEADACHE_HISTORY","HISTOLOGICAL_DIAGNOSIS","HISTORY_IONIZING_RT_TO_HEAD","HISTORY_NEOADJUVANT_MEDICATION","HISTORY_NEOADJUVANT_STEROID_TX","HISTORY_NEOADJUVANT_TRTYN","HISTORY_OTHER_MALIGNANCY","ICD_10","ICD_O_3_HISTOLOGY","ICD_O_3_SITE","IDH1_MUTATION","IDH1_MUTATION_TEST_INDICATOR","IDH1_MUTATION_TEST_METHOD","INFORMED_CONSENT_VERIFIED","INHERITED_GENETIC_SYNDROME_INDICATOR","INHERITED_GENETIC_SYNDROME_SPECIFIED","INITIAL_PATHOLOGIC_DX_YEAR","IS_FFPE","KARNOFSKY_PERFORMANCE_SCORE","LATERALITY","LONGEST_DIMENSION","METHOD_OF_SAMPLE_PROCUREMENT","MOLD_OR_DUST_ALLERGY_HISTORY","MUTATION_COUNT","NEW_TUMOR_EVENT_AFTER_INITIAL_TREATMENT","OCT_EMBEDDED","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","OTHER_METHOD_OF_SAMPLE_PROCUREMENT","OTHER_PATIENT_ID","OTHER_SAMPLE_ID","PATHOLOGY_REPORT_FILE_NAME","PATHOLOGY_REPORT_UUID","PERFORMANCE_STATUS_DAYS_TO","PERFORMANCE_STATUS_TIMING","PROJECT_CODE","PROSPECTIVE_COLLECTION","RACE","RADIATION_TREATMENT_ADJUVANT","RELATED_SYMPTOM_FIRST_PRESENT","RETROSPECTIVE_COLLECTION","SAMPLE_COUNT","SAMPLE_INITIAL_WEIGHT","SAMPLE_TYPE","SAMPLE_TYPE_ID","SEIZURE_HISTORY","SEX","SHORTEST_DIMENSION","SITE_OF_TUMOR_TISSUE","SOMATIC_STATUS","SPECIMEN_CURRENT_WEIGHT","SPECIMEN_FREEZING_METHOD","SPECIMEN_SECOND_LONGEST_DIMENSION","SUPRATENTORIAL_LOCALIZATION","SYMP_CHANGES_MENTAL_STATUS","SYMP_CHANGES_MOTOR_MOVEMENT","SYMP_CHANGES_SENSORY","SYMP_CHANGES_VISUAL","TARGETED_MOLECULAR_THERAPY","TIME_BETWEEN_CLAMPING_AND_FREEZING","TIME_BETWEEN_EXCISION_AND_FREEZING","TISSUE_SOURCE_SITE","TMB_NONSYNONYMOUS","TREATMENT_OUTCOME_FIRST_COURSE","TUMOR_SITE","TUMOR_STATUS","VIAL_NUMBER"],"molecularProfileIds":["lgg_tcga_gistic","lgg_tcga_linear_CNA","lgg_tcga_methylation_hm450","lgg_tcga_mrna","lgg_tcga_mrna_median_Zscores","lgg_tcga_mrna_median_all_sample_Zscores","lgg_tcga_mutations","lgg_tcga_rna_seq_v2_mrna","lgg_tcga_rna_seq_v2_mrna_median_Zscores","lgg_tcga_rna_seq_v2_mrna_median_all_sample_Zscores","lg … (2867 more chars) ═ answer (success) "TCGA lower grade glioma" matches two studies in cBioPortal: 1. **Brain Lower Grade Glioma (TCGA, PanCancer Atlas)** (`lgg_tcga_pan_can_atlas_2018`): 514 samples. 2. **Brain Lower Grade Glioma (TCGA, Firehose Legacy)** (`lgg_tcga`): 530 samples. Which one do you want, or should I use both? I also need to know what you mean by "gains". In GISTIC copy-number calls there are two levels: - **Gain (+1):** a low-level copy gain. - **Amplification (+2):** a high-level amplification. Do you want gains only, or gains plus amplifications? If you don't say, I'll use both (+1 and +2) and list the two levels separately.