Q (sonnet): What is the median survival time in the Pediatric Neuroblastoma study from TARGET? ▶ read_guide { "uri": "cbioportal://statistical-tests-guide" } ▶ list_studies { "search": "TARGET neuroblastoma" } ◀ result Statistical Test Selection Guide ================================ Purpose ------- This guide ensures the correct statistical test is selected before performing any group comparison, matching cBioPortal's own Group Comparison defaults. HARD RULES — NEVER FABRICATE A STATISTIC ---------------------------------------- ClickHouse cannot run statistical tests. The agent therefore must NEVER produce a derived statistic that is not a literal column value from a SQL result. Specifically: 1. **Never invent a p-value.** Not "p < 0.001", not "p ≈ 0.05", not any p-value. If the user asks "what is the p-value?", the answer is *"I can't compute that — here is the 2x2 contingency table (or group statistics). Run it in cBioPortal's Group Comparison tab, in R with `fisher.test(...)` / `wilcox.test(...)`, or in Python with `scipy.stats.fisher_exact(...)` / `mannwhitneyu(...)`."* 2. **Never claim mutual exclusivity (or co-occurrence) from a contingency table alone.** A 2x2 table is not a test. The shape "altered/not altered × group A/group B" needs Fisher's exact + a defined direction (odds ratio < 1 with significant p). Without that test, the agent presents the table and stops. Descriptive phrasing is also a claim: "largely/mostly mutually exclusive", "rarely co-occur", "tend to co-occur" are forbidden without the test — point to cBioPortal's Mutual Exclusivity tab instead. 3. **Never report a "median" that came from `AVG(...)` or any non-median aggregate.** "Median" and "mean" are different statistics; for skewed clinical distributions (especially survival) they differ substantially. Use ClickHouse's `quantile(0.5)(...)` for actual median, and label arithmetic averages as "mean", never "median". 4. **Never report a hazard ratio, odds ratio, risk ratio, or relative risk** that wasn't computed by an external tool. These require regression / model fitting that ClickHouse does not do. 5. **Never report median overall survival from `AVG(OS_MONTHS)` or even `quantile(0.5)(OS_MONTHS)`.** Median OS requires Kaplan-Meier estimation, which handles censoring (`OS_STATUS = 0:LIVING` means the event hasn't happened yet). Naive medians/means over `OS_MONTHS` ignore censoring and are systematically wrong. The correct handoff: return the raw `(OS_MONTHS, OS_STATUS)` pairs (or descriptive counts: N events, N censored, follow-up range) and tell the user to run KM in R (`survival::survfit`) or Python (`lifelines.KaplanMeierFitter`), or use cBioPortal's Survival comparison. If asked to do any of (1)–(5), respond with the appropriate handoff template from the "Approved Response Templates" section below — do not produce the number. Ambiguous-Term Clarification (before any analysis) -------------------------------------------------- If the user's question uses an ambiguous term, ask before computing anything. Examples: - **"aggressive"** → could mean shorter overall survival, higher metastasis rate, higher grade/stage, higher TMB, or specific molecular features. Ask which definit … (9984 more chars) ◀ result {"result":[{"cancer_study_identifier":"nbl_target_gdc","name":"Neuroblastoma (TARGET GDC, 2025)","type_of_cancer_id":"nbl","sample_count":533,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=nbl_target_gdc"},{"cancer_study_identifier":"nbl_target_2018_pub","name":"Pediatric Neuroblastoma (TARGET, 2018)","type_of_cancer_id":"nbl","sample_count":1089,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub"},{"cancer_study_identifier":"nbl_msk_2023","name":"Pediatric Neuroblastoma (MSK, Nat Genet 2023)","type_of_cancer_id":"nbl","sample_count":223,"has_guide":false,"url":"https://www.cbioportal.org/study/summary?id=nbl_msk_2023"}]} ▶ clickhouse_list_table_columns { "table": "clinical_data_derived" } ◀ result {"columns":[{"name":"internal_id","type":"Int32"},{"name":"sample_unique_id","type":"String","comment":"Globally unique sample ID: cancer_study_identifier + \"_\" + sample.stable_id. Empty for patient-level attributes. Use this for sample filtering and joins."},{"name":"patient_unique_id","type":"String","comment":"Globally unique patient ID: cancer_study_identifier + \"_\" + patient.stable_id. Present for both sample and patient-level attributes."},{"name":"attribute_name","type":"LowCardinality(String)","comment":"Clinical attribute name (e.g., SAMPLE_TYPE, CANCER_TYPE, AGE, OS_MONTHS). Use with attribute_value for filtering. AGE may be floored or capped for de-identification (e.g. all children recorded as 18, or everyone 89+ recorded as 89 or 90): before age statistics check for a pile-up at the min/max, and if present compute age from DAYS_TO_BIRTH (-days / 365.25)."},{"name":"attribute_value","type":"String","comment":"Value of the clinical attribute (String). For SAMPLE_TYPE: Primary, Metastasis, Local Recurrence, Unknown. Missing values are empty strings, so use toFloat64OrNull(attribute_value) for numeric comparisons — CAST fails on them."},{"name":"cancer_study_identifier","type":"LowCardinality(String)"},{"name":"type","type":"LowCardinality(String)","comment":"Data level: \"sample\" for sample-level attributes (e.g., SAMPLE_TYPE), \"patient\" for patient-level attributes (e.g., AGE, OS_MONTHS)."}]} ▶ clickhouse_run_select_query { "query": " SELECT attribute_name, attribute_value, count() AS n FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name IN ('OS_STATUS', 'OS_MONTHS') GROUP BY attribute_name, attribute_value ORDER BY attribute_name, attribute_value LIMIT 50 " } ◀ result {"rows":[{"attribute_name":"OS_MONTHS","n":4},{"attribute_name":"OS_MONTHS","attribute_value":"1.0","n":12},{"attribute_name":"OS_MONTHS","attribute_value":"10.0","n":9},{"attribute_name":"OS_MONTHS","attribute_value":"101.0","n":4},{"attribute_name":"OS_MONTHS","attribute_value":"102.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"103.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"104.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"105.0","n":4},{"attribute_name":"OS_MONTHS","attribute_value":"106.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"107.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"108.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"11.0","n":17},{"attribute_name":"OS_MONTHS","attribute_value":"110.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"111.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"113.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"114.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"115.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"116.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"118.0","n":5},{"attribute_name":"OS_MONTHS","attribute_value":"12.0","n":10},{"attribute_name":"OS_MONTHS","attribute_value":"120.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"121.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"122.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"123.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"124.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"125.0","n":4},{"attribute_name":"OS_MONTHS","attribute_value":"126.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"127.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"128.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"129.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"13.0","n":5},{"attribute_name":"OS_MONTHS","attribute_value":"130.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"131.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"132.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"133.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"134.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"135.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"136.0","n":3},{"attribute_name":"OS_MONTHS","attribute_value":"137.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"138.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"139.0","n":1},{"attribute_name":"OS_MONTHS","attribute_value":"14.0","n":19},{"attribute_name":"OS_MONTHS","attribute_value":"141.0","n":4},{"attribute_name":"OS_MONTHS","attribute_value":"142.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"144.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"145.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"146.0","n":2},{"attribute_name":"OS_MONTHS","attribute_value":"147.0","n" … (131 more chars) ▶ clickhouse_run_select_query { "query": " SELECT os.attribute_value AS os_status, count() AS n_patients, min(toFloat64OrNull(mo.attribute_value)) AS min_os_months, max(toFloat64OrNull(mo.attribute_value)) AS max_os_months FROM (SELECT patient_unique_id, attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name = 'OS_STATUS') os JOIN (SELECT patient_unique_id, attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name = 'OS_MONTHS') mo ON os.patient_unique_id = mo.patient_unique_id WHERE os.attribute_value != '' GROUP BY os_status " } ◀ result {"rows":[{"os_status":"0:LIVING","n_patients":675,"min_os_months":1,"max_os_months":183},{"os_status":"1:DECEASED","n_patients":397,"min_os_months":1,"max_os_months":125}]} ▶ resolve_and_route { "studyIds": [ "nbl_target_2018_pub" ] } ◀ result {"success":true,"message":"Found 1 study. Use the metadata to call the appropriate navigation tool(s).","data":{"totalCount":1,"studiesWithMetadata":[{"studyId":"nbl_target_2018_pub","name":"Pediatric Neuroblastoma (TARGET, 2018)","sampleCount":1089,"studyViewUrl":"https://www.cbioportal.org/study?id=nbl_target_2018_pub","metadata":{"clinicalAttributeIds":["AGE","AGE_IN_DAYS","ANALYSIS_COHORT","CANCER_TYPE","CANCER_TYPE_DETAILED","CNS_SITE_OF_RELAPSE","DIAGNOSIS","EFSCENS","EFS_TIME","ETHNICITY","FIRST_EVENT","FRACTION_GENOME_ALTERED","GRADE","ICDO","ICDO_SNOMED_DESCRIPTION","INSS_STAGE","LAST_FOLLOWUP_YEAR","MKI","MUTATION_COUNT","MYCN","ONCOTREE_CODE","OS_DAYS","OS_MONTHS","OS_STATUS","PERCENTAGE_NECROSIS","PERCENTAGE_TUMOR_PURITY","PERCENT_TUMOR_CELLS_RELAPSE","PERCENT_TUMOR_VS_STROMA","PLOIDY","PROTOCOL","RACE","RELAPSE_PERCENT_NECROSIS","RELAPSE_PERCENT_STROMA","RISK_GROUP","SAMPLE_COUNT","SCENS","SEX","SNOMED","SOMATIC_STATUS","STIME","TMB_NONSYNONYMOUS","TUMOR_PLOIDY","TUMOR_SAMPLE_HISTOLOGY","TUMOR_TISSUE_SITE","YEAR_OF_DIAGNOSIS"],"molecularProfileIds":["nbl_target_2018_pub_gistic","nbl_target_2018_pub_mrna","nbl_target_2018_pub_mrna_median_Zscores","nbl_target_2018_pub_mrna_median_all_sample_Zscores","nbl_target_2018_pub_mutations","nbl_target_2018_pub_rna_seq_mrna","nbl_target_2018_pub_rna_seq_mrna_median_Zscores","nbl_target_2018_pub_rna_seq_mrna_median_all_sample_Zscores"],"heatmapProfileIds":["nbl_target_2018_pub_mrna_median_Zscores","nbl_target_2018_pub_mrna_median_all_sample_Zscores","nbl_target_2018_pub_rna_seq_mrna_median_Zscores","nbl_target_2018_pub_rna_seq_mrna_median_all_sample_Zscores"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations","mrna"]}}]}} ▶ navigate_to_group_comparison { "studyIds": [ "nbl_target_2018_pub" ], "tab": "survival", "groups": [ { "name": "All patients", "studyViewFilter": {} } ] } ✗ error MCP error -32602: Input validation error: Invalid arguments for tool navigate_to_group_comparison: [ { "origin": "array", "code": "too_small", "minimum": 2, "inclusive": true, "path": [ "groups" ], "message": "Too small: expected array to have >=2 items" } ] ▶ navigate_to_study_view { "studyIds": [ "nbl_target_2018_pub" ] } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub","url":"https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub","data":{"studyIds":["nbl_target_2018_pub"],"studies":[{"studyId":"nbl_target_2018_pub","name":"Pediatric Neuroblastoma (TARGET, 2018)","sampleCount":1089}],"tab":"summary","hasFilters":false,"hasPlotsConfig":false,"pageDescription":"Overview of all study data displayed as interactive charts summarizing available clinical and genomic data. Click within a chart to filter. Additional charts may be available in the Charts menu."}} ═ answer (success) [Pediatric Neuroblastoma (TARGET, 2018) — Study View](https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub) Overview of all study data displayed as interactive charts summarizing available clinical and genomic data (1,089 samples). In this view, scroll to the **Overall Survival** chart, which renders the Kaplan-Meier curve with the actual median OS annotated — that's the correct way to get the true median (log-rank/KM-adjusted for censoring), which I cannot compute directly from raw SQL aggregates.