Q (sonnet): How many samples are there that have any of these mutations in SEPHS1: p.Arg371Trp, p.Arg371Gln, p.Arg371Gly? ▶ read_guide { "uri": "cbioportal://mutation-frequency-guide" } ▶ read_guide { "uri": "cbioportal://gene-resolution-guide" } ◀ 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) ◀ result # Gene Resolution Guide Use this guide before querying gene expression, mutation, copy-number, methylation, or structural-variant data when the user's gene term may be ambiguous. ## Routing Triggers Read this guide when the user mentions: - a gene family shorthand: `CD3`, `HLA`, `KRT`, `MUC`, `MT-`, `IGH`, `IGK`, `IGL` - a marker name that may refer to multiple genes or proteins - a gene alias, old symbol, or informal name - a wildcard-like term such as "all CD3 genes" These examples are not exhaustive. Apply this guide to any gene term that may resolve to multiple symbols, aliases, paralogs, family members, or marker genes. ## Core Rule Do not silently aggregate multiple genes when the user names an ambiguous symbol. Either ask for clarification or choose a clearly standard marker and state the choice. For example, "CD3 expression" can refer to `CD3D`, `CD3E`, or `CD3G`; in many immune-marker contexts `CD3E` is the standard marker, but the agent must not average all CD3 genes unless the user asks for a combined signature. ## Gene Discovery Query After validating the gene table exists, search exact symbols first, then prefix/alias-like matches: ```sql SELECT hugo_gene_symbol, entrez_gene_id FROM gene WHERE upper(hugo_gene_symbol) = upper('CD3') OR upper(hugo_gene_symbol) LIKE upper('CD3%') ORDER BY hugo_gene_symbol LIMIT 50; ``` If aliases are available in this deployment, inspect the relevant alias table before assuming no match. If no alias table exists, state that alias resolution is limited to available gene symbols. ## Answer Pattern If multiple plausible genes are found: > "CD3" is ambiguous in cBioPortal gene-symbol terms. I found `CD3D`, `CD3E`, and `CD3G`. Did you mean `CD3E` as a T-cell marker, or should I analyze all three separately? If the user clearly asks for a combined family/signature: - report each gene separately by default - only compute an average/signature if the user explicitly requests it - state exactly how the combined value was calculated ## Do Not - Do not average multiple genes into one expression value without explicit permission. - Do not rewrite an ambiguous symbol to a single gene without telling the user. - Do not treat a prefix match as a validated gene symbol. ▶ clickhouse_list_table_columns { "table": "genomic_event_derived" } ◀ 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 mutation_variant, count(DISTINCT sample_unique_id) AS samples FROM genomic_event_derived WHERE variant_type = 'mutation' AND hugo_gene_symbol = 'SEPHS1' AND mutation_status != 'UNCALLED' AND mutation_variant IN ('p.Arg371Trp','p.Arg371Gln','p.Arg371Gly','p.R371W','p.R371Q','p.R371G') GROUP BY mutation_variant ORDER BY samples DESC" } ◀ result {"rows":[]} ▶ clickhouse_run_select_query { "query": "SELECT mutation_variant, count(DISTINCT sample_unique_id) AS samples FROM genomic_event_derived WHERE variant_type = 'mutation' AND hugo_gene_symbol = 'SEPHS1' AND mutation_status != 'UNCALLED' GROUP BY mutation_variant ORDER BY samples DESC LIMIT 50" } ◀ result {"rows":[{"mutation_variant":"E13K","samples":13},{"mutation_variant":"A245V","samples":12},{"mutation_variant":"A262T","samples":11},{"mutation_variant":"R362H","samples":11},{"mutation_variant":"R371Q","samples":9},{"mutation_variant":"C104Y","samples":8},{"mutation_variant":"R19Q","samples":8},{"mutation_variant":"V196M","samples":7},{"mutation_variant":"V302M","samples":6},{"mutation_variant":"P34L","samples":6},{"mutation_variant":"Q39*","samples":6},{"mutation_variant":"Q51*","samples":6},{"mutation_variant":"E339K","samples":6},{"mutation_variant":"T29I","samples":6},{"mutation_variant":"X218_splice","samples":6},{"mutation_variant":"D134N","samples":5},{"mutation_variant":"G389R","samples":5},{"mutation_variant":"X217_splice","samples":5},{"mutation_variant":"M309I","samples":5},{"mutation_variant":"A103V","samples":5},{"mutation_variant":"P318L","samples":5},{"mutation_variant":"E219D","samples":5},{"mutation_variant":"A275V","samples":5},{"mutation_variant":"G78D","samples":5},{"mutation_variant":"X100_splice","samples":5},{"mutation_variant":"M99T","samples":5},{"mutation_variant":"X99_splice","samples":5},{"mutation_variant":"E339Q","samples":5},{"mutation_variant":"R137K","samples":5},{"mutation_variant":"S158Y","samples":5},{"mutation_variant":"K40E","samples":4},{"mutation_variant":"N167T","samples":4},{"mutation_variant":"S6C","samples":4},{"mutation_variant":"T3M","samples":4},{"mutation_variant":"V93I","samples":4},{"mutation_variant":"T177A","samples":4},{"mutation_variant":"P388S","samples":4},{"mutation_variant":"L312V","samples":4},{"mutation_variant":"T133A","samples":4},{"mutation_variant":"P202L","samples":4},{"mutation_variant":"E54D","samples":4},{"mutation_variant":"G147C","samples":4},{"mutation_variant":"T320S","samples":4},{"mutation_variant":"E153Q","samples":4},{"mutation_variant":"X322_splice","samples":4},{"mutation_variant":"A208T","samples":4},{"mutation_variant":"H77R","samples":4},{"mutation_variant":"Q35Pfs*20","samples":3},{"mutation_variant":"S342F","samples":3},{"mutation_variant":"H256Y","samples":3}]} ▶ clickhouse_run_select_query { "query": "SELECT mutation_variant, count(DISTINCT sample_unique_id) AS samples FROM genomic_event_derived WHERE variant_type = 'mutation' AND hugo_gene_symbol = 'SEPHS1' AND mutation_status != 'UNCALLED' AND mutation_variant IN ('R371W','R371Q','R371G') GROUP BY mutation_variant" } ◀ result {"rows":[{"mutation_variant":"R371W","samples":2},{"mutation_variant":"R371Q","samples":9}]} ▶ clickhouse_run_select_query { "query": "SELECT count(DISTINCT sample_unique_id) AS total_samples, count(DISTINCT patient_unique_id) AS total_patients FROM genomic_event_derived WHERE variant_type = 'mutation' AND hugo_gene_symbol = 'SEPHS1' AND mutation_status != 'UNCALLED' AND mutation_variant IN ('R371W','R371Q','R371G')" } ◀ result {"rows":[{"total_samples":11,"total_patients":11}]} ▶ clickhouse_run_select_query { "query": "SELECT DISTINCT cancer_study_identifier, mutation_variant, sample_unique_id FROM genomic_event_derived WHERE variant_type = 'mutation' AND hugo_gene_symbol = 'SEPHS1' AND mutation_status != 'UNCALLED' AND mutation_variant IN ('R371W','R371Q','R371G') ORDER BY cancer_study_identifier" } ◀ result {"rows":[{"cancer_study_identifier":"coad_cptac_gdc","mutation_variant":"R371Q","sample_unique_id":"coad_cptac_gdc_be2d5946-3452-4003-880a-e0372e"},{"cancer_study_identifier":"coad_tcga_gdc","mutation_variant":"R371Q","sample_unique_id":"coad_tcga_gdc_TCGA-AA-A01S-01"},{"cancer_study_identifier":"coadread_tcga","mutation_variant":"R371Q","sample_unique_id":"coadread_tcga_TCGA-AA-A01S-01"},{"cancer_study_identifier":"coadread_tcga","mutation_variant":"R371Q","sample_unique_id":"coadread_tcga_TCGA-AG-3608-01"},{"cancer_study_identifier":"coadread_tcga_pan_can_atlas_2018","mutation_variant":"R371Q","sample_unique_id":"coadread_tcga_pan_can_atlas_2018_TCGA-AA-A01S-01"},{"cancer_study_identifier":"coadread_tcga_pub","mutation_variant":"R371Q","sample_unique_id":"coadread_tcga_pub_TCGA-AA-A01S-01"},{"cancer_study_identifier":"coadread_tcga_pub","mutation_variant":"R371Q","sample_unique_id":"coadread_tcga_pub_TCGA-AG-3608-01"},{"cancer_study_identifier":"mel_dfci_2019","mutation_variant":"R371W","sample_unique_id":"mel_dfci_2019_Sample96"},{"cancer_study_identifier":"mel_iatlas_liu_2019","mutation_variant":"R371W","sample_unique_id":"mel_iatlas_liu_2019_Liu_Sample96"},{"cancer_study_identifier":"ohnca_cptac_gdc","mutation_variant":"R371Q","sample_unique_id":"ohnca_cptac_gdc_C3N-03012-01"},{"cancer_study_identifier":"pancan_pcawg_2020","mutation_variant":"R371Q","sample_unique_id":"pancan_pcawg_2020_SP19750"}]} ═ answer (success) These 11 samples span many overlapping cohorts (e.g., TCGA colorectal appears in `coad_tcga_gdc`, `coadread_tcga`, `coadread_tcga_pan_can_atlas_2018`, and `coadread_tcga_pub` — likely the same underlying patient TCGA-AA-A01S counted multiple times across redundant study versions), so I'll flag that overlap caveat. ## Results Across all cBioPortal studies, **11 samples** (11 distinct patients) carry one of the requested SEPHS1 missense variants: | Protein change | Samples | |---|---| | p.Arg371Gln (R371Q) | 9 | | p.Arg371Trp (R371W) | 2 | | p.Arg371Gly (R371G) | **0 — not found in the database** | **Note on Arg371Gly:** This specific variant does not appear anywhere in the database for SEPHS1. Only R371Q and R371W were found. **Study overlap caveat:** These 11 samples are not from 11 independent cohorts. Several are the *same* underlying TCGA patient (e.g., TCGA-AA-A01S-01) appearing redundantly across `coad_tcga_gdc`, `coadread_tcga`, `coadread_tcga_pan_can_atlas_2018`, and `coadread_tcga_pub` — different versions/portals of the same TCGA colorectal cohort. The truly distinct biological cases are closer to **6–7**, spanning colorectal cancer (TCGA, CPTAC), melanoma (DFCI 2019, iAtlas/Liu 2019), head & neck cancer (CPTAC), and the PCAWG pan-cancer cohort. Since these samples are scattered across many small, largely redundant studies, a single unified navigation link isn't meaningful here. If you'd like, I can open the **Results View** for one specific cohort (e.g., the TCGA PanCancer Atlas colorectal study) filtered to this SEPHS1 variant — let me know which cohort you'd like to focus on.