Q (sonnet): What are the top 5 most frequently copy number altered genes in the Osteosarcoma study from TARGET? ▶ list_studies { "search": "osteosarcoma target" } ◀ result {"result":[{"cancer_study_identifier":"os_target_gdc","name":"Osteosarcoma (TARGET GDC, 2025)","type_of_cancer_id":"os","sample_count":159,"has_guide":true,"url":"https://www.cbioportal.org/study/summary?id=os_target_gdc"}]} ▶ get_study_guide { "study_id": "os_target_gdc" } ▶ clickhouse_list_table_columns { "table": "top_cna_genes_in_study" } ◀ result # Osteosarcoma (TARGET GDC, 2025) **Study ID:** `os_target_gdc` ## Overview Pediatric osteosarcoma study from the TARGET (Therapeutically Applicable Research to Generate Effective Treatments) initiative. Whole exome sequencing data. ## Gene Panel - **WES** (Whole Exome Sequencing): all coding genes profiled - **143 of the 160 samples are profiled for mutations.** Use 143 as the mutation-frequency denominator (`sample_to_gene_panel_derived`, `alteration_type = 'MUTATION_EXTENDED'`), not the study's sample count — e.g. TP53 is mutated in 32/143 = 22.4%. ## Patients vs Samples 383 patients have clinical data, but only 153 of them have a sample (159 samples). Patient-level questions (age, sex, survival) use all patients with a value; genomic questions use the 143 mutation-profiled samples. ## Clinical Attributes - Semantic Guide ### Patient Demographics | Attribute | Description | Notes | |-----------|-------------|-------| | `AGE` | Age at diagnosis, **floored at 18** | Every patient younger than 18 is recorded as 18 (241 of 293). **Don't use it for age statistics** — use `DAYS_TO_BIRTH` | | `DAYS_TO_BIRTH` | Days from birth to diagnosis, negative | Age at diagnosis in years = `-DAYS_TO_BIRTH / 365.25`. 293 patients have a value; 90 are empty | | `SEX` | Patient sex | Male 172, Female 133, 78 empty | | `RACE`, `ETHNICITY` | Race, ethnicity | | ### Disease Characteristics | Attribute | Description | Notes | |-----------|-------------|-------| | `CANCER_TYPE_DETAILED` | Cancer type | Osteosarcoma for every sample | | `PRIMARY_SITE_PATIENT` | Primary site | "Appendicular Skeleton" for every patient with a value — no finer location (femur, tibia) | No histological subtype, tumor necrosis / chemotherapy response, or event-free survival attributes exist in this study. ### Clinical Outcomes | Attribute | Description | Notes | |-----------|-------------|-------| | `OS_MONTHS` | Overall survival in months | Time from diagnosis | | `OS_STATUS` | Overall survival status | 0:LIVING 171, 1:DECEASED 105, 107 empty | ## Age at Diagnosis Compute age from `DAYS_TO_BIRTH`, not `AGE`. A median from `AGE` comes out as 18 because every child is recorded as 18; the real median is about 15 years. ```sql SELECT count() AS patients, round(median(-toFloat64OrNull(attribute_value) / 365.25), 1) AS median_age_years, round(min(-toFloat64OrNull(attribute_value) / 365.25), 1) AS min_age_years, round(max(-toFloat64OrNull(attribute_value) / 365.25), 1) AS max_age_years FROM clinical_data_derived WHERE cancer_study_identifier = 'os_target_gdc' AND attribute_name = 'DAYS_TO_BIRTH' AND toFloat64OrNull(attribute_value) IS NOT NULL; -- 293 patients, median 15.2, range 3.6-87.1 ``` When reporting, say the age comes from `DAYS_TO_BIRTH` and that `AGE` is floored at 18. ## Notes & Caveats - This is a pediatric cancer cohort; age distribution is younger than adult studies - WES coverage means no gene panel filtering needed for frequency calculations - Part … (66 more chars) ◀ result {"columns":[]} ▶ clickhouse_list_tables {} ▶ read_guide { "uri": "cbioportal://mutation-frequency-guide" } ◀ result {"tables":[{"name":"allele_specific_copy_number"},{"name":"alteration_driver_annotation"},{"name":"cancer_study"},{"name":"cancer_study_query_preferences"},{"name":"cancer_study_tags"},{"name":"cbioportal_sequence_state"},{"name":"clinical_attribute_counts"},{"name":"clinical_attribute_meta"},{"name":"clinical_data_derived"},{"name":"clinical_event"},{"name":"clinical_event_data"},{"name":"clinical_event_data_derived"},{"name":"clinical_event_derived"},{"name":"clinical_patient"},{"name":"clinical_sample"},{"name":"cna_event"},{"name":"cna_panel_gene_coverage"},{"name":"cna_wes_coverage"},{"name":"co_altered_genes_in_study"},{"name":"copy_number_seg"},{"name":"copy_number_seg_file"},{"name":"gene"},{"name":"gene_alias"},{"name":"gene_alteration_frequency_by_cancer_type"},{"name":"gene_cna_distribution_in_study"},{"name":"gene_mutation_frequency_by_cancer_type"},{"name":"gene_mutation_frequency_in_studies"},{"name":"gene_mutation_frequency_in_study"},{"name":"gene_mutation_variants_in_study"},{"name":"gene_pair_coexpression"},{"name":"gene_panel"},{"name":"gene_panel_list"},{"name":"gene_panel_to_gene_derived"},{"name":"generic_assay_data_derived"},{"name":"generic_assay_meta_derived"},{"name":"generic_assay_profile_entity_derived"},{"name":"generic_entity_properties"},{"name":"geneset"},{"name":"geneset_gene"},{"name":"geneset_hierarchy_leaf"},{"name":"geneset_hierarchy_node"},{"name":"genetic_alteration"},{"name":"genetic_alteration_derived"},{"name":"genetic_entity"},{"name":"genetic_profile"},{"name":"genetic_profile_link"},{"name":"genetic_profile_samples"},{"name":"genomic_event_derived"},{"name":"gistic"},{"name":"gistic_to_gene"},{"name":"info"},{"name":"mut_sig"},{"name":"mutation"},{"name":"mutation_count_by_keyword"},{"name":"mutation_derived"},{"name":"mutation_event"},{"name":"mutation_panel_gene_coverage"},{"name":"mutation_wes_coverage"},{"name":"patient"},{"name":"reference_genome"},{"name":"reference_genome_gene"},{"name":"resource_definition"},{"name":"resource_patient"},{"name":"resource_sample"},{"name":"resource_study"},{"name":"sample"},{"name":"sample_cna_event"},{"name":"sample_derived"},{"name":"sample_list"},{"name":"sample_list_list"},{"name":"sample_profile"},{"name":"sample_to_gene_panel_derived"},{"name":"structural_variant"},{"name":"sv_panel_gene_coverage"},{"name":"sv_wes_coverage"},{"name":"top_cna_genes_in_study"},{"name":"top_mutated_genes_in_cohort"},{"name":"top_mutated_genes_in_study"},{"name":"top_sv_genes_in_study"},{"name":"treatment_counts_in_study"},{"name":"treatment_regimens_in_study"},{"name":"type_of_cancer"}]} ◀ result # Mutation Frequency Analysis Guide ## IMPORTANT: Reporting Mutation Frequencies - **ALWAYS report frequencies as percentages**, not raw counts: `frequency = (altered_samples / total_profiled_samples) × 100` - For quick frequency lookups, **prefer the TCGA Pan-Cancer Atlas study first**, then offer to expand to other studies - When reporting across multiple studies, show **ranges** (e.g., "TP53 is mutated in 30–60% of samples") rather than a single average - **NEVER** sum mutation events across studies to compute an aggregate frequency — this can exceed 100% due to double-counting - Warn users that samples may overlap across cohorts (e.g., MSK studies may share patients) - **Choose and state the counting unit**: use patient-level frequencies for prevalence/rate questions unless the user explicitly asks for samples; use sample-level frequencies when the user asks about samples. - **For "across cancer types" questions**, jump to the [Cross-Cancer-Type Mutation Frequency](#cross-cancer-type-mutation-frequency) section below — there is one correct recipe and several common wrong ones. ## Counting Unit: Samples vs Patients Before answering any mutation count or frequency question, decide whether the unit is samples or patients and state that choice in the answer. | User wording | Counting unit | |--------------|---------------| | "prevalence", "rate", "fraction of patients", "patients with", "how common is" | Patient-level: `COUNT(DISTINCT patient_unique_id)` | | "samples", "specimens", "biopsies", sample-level cohort composition | Sample-level: `COUNT(DISTINCT sample_unique_id)` | | Ambiguous | Ask, or default to patient-level for prevalence/rate language and say so | ### Cross-study sample-count caveat When an answer touches more than one study and reports a sample count, prepend a one-line caveat: > Sample IDs are unique within cBioPortal study prefixes, not guaranteed biological-sample identifiers across studies; overlapping cohorts can count the same patient/sample more than once. Prefer one of these safer approaches: - Use a shipped `cancer_study_query_preferences` cohort such as `pan_cancer_tcga` or `all_studies_non_redundant`. - Restrict to one named study. - Aggregate by `patient_unique_id` when the biological question is patient prevalence. ## STOP rule: a frequency above 100% means your query is wrong If your query returns a frequency over 100%, **do not try to debug or explain the data inconsistency to the user**. The cause is always one of these query bugs: - Summing mutation events instead of `COUNT(DISTINCT sample_unique_id)` for the numerator - Using a study-wide sample count as the denominator instead of the gene-specific profiled count - Cross-study aggregation where the same biological sample appears under multiple `sample_unique_id` values (e.g., MSK-IMPACT and MSK-CHORD share patients) - **Joining the profiled CTE through `gene_panel` / `gene_panel_list` without a WES branch.** `gene_panel_id = 'WES'` is *not* a row in … (36467 more chars) ▶ clickhouse_run_select_query { "query": "SELECT * FROM top_cna_genes_in_study(study = 'os_target_gdc', top_n = 10)" } ◀ result {"rows":[{"hugo_gene_symbol":"LINC00901","cytoband":"3q13.31","cna_type":"HOMDEL","altered_samples":32,"profiled_samples":81,"frequency_pct":39.5},{"hugo_gene_symbol":"RN7SL442P","cytoband":"17p11.2","cna_type":"AMP","altered_samples":31,"profiled_samples":81,"frequency_pct":38.3},{"hugo_gene_symbol":"ALKBH5","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"ATPAF2","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"BRI3P3","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"CARS1P2","cytoband":"8q23.3","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"DRC3","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"DRG2","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"FLII","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"GID4","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37}]} ▶ clickhouse_run_select_query { "query": "SELECT * FROM top_cna_genes_in_study(study = 'os_target_gdc', top_n = 30)" } ◀ result {"rows":[{"hugo_gene_symbol":"LINC00901","cytoband":"3q13.31","cna_type":"HOMDEL","altered_samples":32,"profiled_samples":81,"frequency_pct":39.5},{"hugo_gene_symbol":"RN7SL442P","cytoband":"17p11.2","cna_type":"AMP","altered_samples":31,"profiled_samples":81,"frequency_pct":38.3},{"hugo_gene_symbol":"ALKBH5","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"ATPAF2","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"BRI3P3","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"CARS1P2","cytoband":"8q23.3","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"DRC3","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"DRG2","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"FLII","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"GID4","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"LLGL1","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"MIEF2","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"MYO15A","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"NCOR1","cytoband":"17p12-p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"RNU5E-8P","cytoband":"3q13.31","cna_type":"HOMDEL","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"RNU6-314P","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"RNU6-862P","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"RPL22P21","cytoband":"17p12","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"RPLP1P11","cytoband":"17p12","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"TRPS1-AS1","cytoband":"8q23.3","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"TTC19","cytoband":"17p12","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"UBB","cytoband":"17p11.2","cna_type":"AMP","altered_samples":30,"profiled_samples":81,"frequency_pct":37},{"hugo_gene_symbol":"CASC11","cytoband":"8q24.21","cna_type":"AMP","altered_samples":29,"profiled_samples":81,"frequen … (939 more chars) ═ answer (success) This confirms the exact ranking from the database. Note this list is dominated by co-amplified/co-deleted "passenger" genes within the same recurrent CNA segments (17p12-p11.2 amplicon, 3q13.31 and 8q24.21 regions) — many genes tie at identical counts because they sit in the same amplicon/deletion block and are altered together. ## Top 5 Most Frequently Copy-Number-Altered Genes — Osteosarcoma (TARGET GDC, 2025) **Study:** [Osteosarcoma (TARGET GDC, 2025)](https://www.cbioportal.org/study/summary?id=os_target_gdc) — 159 samples total; **81 samples** have discrete copy-number profiling (this is the denominator below). | Rank | Gene | Cytoband | CNA Type | Altered / Profiled | Frequency | |------|------|----------|----------|---------------------|-----------| | 1 | **LINC00901** | 3q13.31 | Homozygous deletion (HOMDEL) | 32/81 | 39.5% | | 2 | **RN7SL442P** | 17p11.2 | Amplification (AMP) | 31/81 | 38.3% | | 3 (tie) | **ALKBH5** | 17p11.2 | Amplification (AMP) | 30/81 | 37.0% | | 3 (tie) | **ATPAF2** | 17p11.2 | Amplification (AMP) | 30/81 | 37.0% | | 3 (tie) | **BRI3P3** | 17p11.2 | Amplification (AMP) | 30/81 | 37.0% | *(Several additional genes — DRC3, DRG2, FLII, GID4, LLGL1, MIEF2, MYO15A, NCOR1, TTC19, UBB, and more — tie at exactly 30/81 = 37.0%, all located in the same 17p12–17p11.2 amplicon or the 3q13.31/8q24.21 regions. This reflects large recurrent segmental copy-number events rather than single-gene-level selection.)* Frequencies are counted per sample (altered/profiled), profiled denominator = 81 (samples with discrete CNA data), not the full 159-sample cohort. Explore the full ranked table and amplicon structure directly: [View CNA Genes Table — Osteosarcoma TARGET GDC](https://www.cbioportal.org/study/summary?id=os_target_gdc&tab=cnSegments)