Q (haiku): In the Pediatric Neuroblastoma study from TARGET what is the survival difference and the corresponding statistical significance between patients who were older than four when diagnosed and the younger ones?
▶ read_guide
{
"uri": "cbioportal://statistical-tests-guide"
}
◀ 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)
▶ list_studies
{
"search": "TARGET neuroblastoma",
"verbose": "true"
}
✗ error
TARGET data is intended exclusively for biomedical research using pediatric data (i.e., the research objectives cannot be accomplished using data from adults) that focus on the development of more effective treatments, diagnostic tests, or prognostic markers for childhood cancers. Moreover, TARGET data can be used for research relevant to the biology, causes, treatment and late complications of treatment of pediatric cancers, but is not intended for the sole purposes of methods and/or tool development (please see Using TARGET Data section of the OCG website). If you are interested in using TARGET data for publication or other research purposes, you must follow the TARGET Publication Guidelines.
","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)","description":"Targeted sequencing of 223 pediatric neuroblastoma tumor/normal pairs via MSK-IMPACT.","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" } ▶ clickhouse_list_table_columns { "table": "clinical_event_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)."}]} ◀ result {"columns":[{"name":"clinical_event_id","type":"Int64"},{"name":"patient_id","type":"Nullable(Int64)"},{"name":"patient_stable_id","type":"String"},{"name":"start_date","type":"Nullable(Int64)"},{"name":"stop_date","type":"Nullable(Int64)"},{"name":"event_type","type":"LowCardinality(String)"},{"name":"cancer_study_identifier","type":"LowCardinality(String)"}]} ▶ clickhouse_run_select_query { "query": " SELECT patient_unique_id, attribute_name, attribute_value, cancer_study_identifier FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name IN ('OS_MONTHS', 'OS_STATUS', 'AGE', 'AGE_AT_DIAGNOSIS') AND type = 'patient' ORDER BY patient_unique_id, attribute_name LIMIT 50 ", "max_rows": 100 } ◀ result {"rows":[{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PAAPFA","attribute_name":"AGE","attribute_value":"5","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PAAPFA","attribute_name":"OS_MONTHS","attribute_value":"17.0","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PAAPFA","attribute_name":"OS_STATUS","attribute_value":"1:DECEASED","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACLJN","attribute_name":"AGE","attribute_value":"5","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACLJN","attribute_name":"OS_MONTHS","attribute_value":"183.0","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACLJN","attribute_name":"OS_STATUS","attribute_value":"0:LIVING","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACPJG","attribute_name":"AGE","attribute_value":"3","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACPJG","attribute_name":"OS_MONTHS","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACPJG","attribute_name":"OS_STATUS","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRYY","attribute_name":"AGE","attribute_value":"4","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRYY","attribute_name":"OS_MONTHS","attribute_value":"175.0","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRYY","attribute_name":"OS_STATUS","attribute_value":"0:LIVING","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRZM","attribute_name":"AGE","attribute_value":"11","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRZM","attribute_name":"OS_MONTHS","attribute_value":"31.0","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACRZM","attribute_name":"OS_STATUS","attribute_value":"1:DECEASED","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACSNL","attribute_name":"AGE","attribute_value":"6","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACSNL","attribute_name":"OS_MONTHS","attribute_value":"11.0","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACSNL","attribute_name":"OS_STATUS","attribute_value":"1:DECEASED","cancer_study_identifier":"nbl_target_2018_pub"},{"patient_unique_id":"nbl_target_2018_pub_TARGET-30-PACSSR","attribute_name":"AGE","attribute_value":"2","cancer_study_identifier":" … (5038 more chars) ▶ clickhouse_run_select_query { "query": " WITH patient_data AS ( SELECT patient_unique_id, arrayMap(k -> k.1, groupArray(Tuple(attribute_name, attribute_value))) as attr_names, arrayMap(k -> k.2, groupArray(Tuple(attribute_name, attribute_value))) as attr_values FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name IN ('OS_MONTHS', 'OS_STATUS', 'AGE') AND type = 'patient' GROUP BY patient_unique_id ) SELECT CASE WHEN toFloat64OrNull(attr_values[arrayFirstIndex(x -> x = 'AGE', attr_names)]) <= 4 THEN 'Age ≤ 4' ELSE 'Age > 4' END as age_group, COUNT(DISTINCT patient_unique_id) as total_patients, COUNT(DISTINCT CASE WHEN attr_values[arrayFirstIndex(x -> x = 'OS_STATUS', attr_names)] = '1:DECEASED' THEN patient_unique_id END) as events_deceased, COUNT(DISTINCT CASE WHEN attr_values[arrayFirstIndex(x -> x = 'OS_STATUS', attr_names)] = '0:LIVING' THEN patient_unique_id END) as events_censored FROM patient_data WHERE arrayFirstIndex(x -> x = 'AGE', attr_names) > 0 AND arrayFirstIndex(x -> x = 'OS_MONTHS', attr_names) > 0 AND arrayFirstIndex(x -> x = 'OS_STATUS', attr_names) > 0 GROUP BY age_group ", "max_rows": 100 } ◀ result {"error_message":"Query execution failed: HTTPDriver for https://dl96orhu96.us-east-1.aws.clickhouse.cloud:8443 received ClickHouse error code 46\n Code: 46. DB::Exception: Function with name `Tuple` does not exist. In scope patient_data. Maybe you meant: ['tuple','tumble']. (UNKNOWN_FUNCTION) (version 26.4.1.2359 (official build))\n"} ▶ clickhouse_run_select_query { "query": " WITH pivoted AS ( SELECT patient_unique_id, MAX(CASE WHEN attribute_name = 'AGE' THEN toFloat64OrNull(attribute_value) END) as age, MAX(CASE WHEN attribute_name = 'OS_MONTHS' THEN toFloat64OrNull(attribute_value) END) as os_months, MAX(CASE WHEN attribute_name = 'OS_STATUS' THEN attribute_value END) as os_status FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name IN ('OS_MONTHS', 'OS_STATUS', 'AGE') AND type = 'patient' GROUP BY patient_unique_id ) SELECT CASE WHEN age <= 4 THEN 'Age ≤ 4' WHEN age > 4 THEN 'Age > 4' ELSE 'Missing Age' END as age_group, COUNT(DISTINCT patient_unique_id) as total_patients, COUNT(DISTINCT CASE WHEN os_status = '1:DECEASED' THEN patient_unique_id END) as num_deceased, COUNT(DISTINCT CASE WHEN os_status = '0:LIVING' THEN patient_unique_id END) as num_censored, COUNT(DISTINCT CASE WHEN os_status IS NULL OR os_status = '' THEN patient_unique_id END) as num_missing_status FROM pivoted WHERE age IS NOT NULL AND os_months IS NOT NULL GROUP BY age_group ", "max_rows": 100 } ◀ result {"rows":[{"age_group":"Age > 4","total_patients":250,"num_deceased":121,"num_censored":129,"num_missing_status":0},{"age_group":"Age ≤ 4","total_patients":822,"num_deceased":276,"num_censored":546,"num_missing_status":0}]} ▶ clickhouse_run_select_query { "query": " WITH pivoted AS ( SELECT patient_unique_id, MAX(CASE WHEN attribute_name = 'AGE' THEN toFloat64OrNull(attribute_value) END) as age, MAX(CASE WHEN attribute_name = 'OS_MONTHS' THEN toFloat64OrNull(attribute_value) END) as os_months, MAX(CASE WHEN attribute_name = 'OS_STATUS' THEN attribute_value END) as os_status FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name IN ('OS_MONTHS', 'OS_STATUS', 'AGE') AND type = 'patient' GROUP BY patient_unique_id ) SELECT CASE WHEN age <= 4 THEN 'Age ≤ 4' WHEN age > 4 THEN 'Age > 4' END as age_group, COUNT(DISTINCT patient_unique_id) as total_patients, COUNT(DISTINCT CASE WHEN os_status = '1:DECEASED' THEN patient_unique_id END) as num_deceased, COUNT(DISTINCT CASE WHEN os_status = '0:LIVING' THEN patient_unique_id END) as num_censored, MIN(os_months) as min_followup_months, MAX(os_months) as max_followup_months, quantile(0.5)(os_months) as median_followup_months FROM pivoted WHERE age IS NOT NULL AND os_months IS NOT NULL GROUP BY age_group ", "max_rows": 100 } ◀ result {"rows":[{"age_group":"Age > 4","total_patients":250,"num_deceased":121,"num_censored":129,"min_followup_months":1,"max_followup_months":183,"median_followup_months":46.5},{"age_group":"Age ≤ 4","total_patients":822,"num_deceased":276,"num_censored":546,"min_followup_months":1,"max_followup_months":183,"median_followup_months":57}]} ▶ 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"]}}]}} ▶ get_studyviewfilter_options { "studyId": "nbl_target_2018_pub", "attributeIds": [ "AGE" ] } ◀ result {"success":true,"message":"Successfully retrieved StudyView filter options","data":{"studyId":"nbl_target_2018_pub","attributes":[{"attributeId":"AGE","displayName":"Diagnosis Age","description":"Age at which a condition or disease was first diagnosed.","datatype":"NUMBER","continuous":true,"bins":[{"end":2,"count":435},{"start":3,"end":3,"count":222},{"start":4,"end":4,"count":168},{"start":4,"count":251}]}]}} ▶ navigate_to_group_comparison { "studyIds": [ "nbl_target_2018_pub" ], "groups": [ { "name": "Age ≤ 4 years", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "AGE", "values": [ { "end": 4 } ] } ] } }, { "name": "Age > 4 years", "studyViewFilter": { "clinicalDataFilters": [ { "attributeId": "AGE", "values": [ { "start": 5 } ] } ] } } ], "tab": "survival" } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/comparison/survival?comparisonId=6ab5c0bde497aad53593c25a","url":"https://www.cbioportal.org/comparison/survival?comparisonId=6ab5c0bde497aad53593c25a","data":{"description":"Group comparison (2 custom groups)","studies":["nbl_target_2018_pub"],"totalGroups":2,"groups":[{"name":"Age ≤ 4 years","sampleCount":836},{"name":"Age > 4 years","sampleCount":126}],"studyViewUrl":"https://www.cbioportal.org/study?id=nbl_target_2018_pub","groupUrls":[{"groupName":"Age ≤ 4 years","url":"https://www.cbioportal.org/study?id=nbl_target_2018_pub#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22AGE%22%2C%22values%22%3A%5B%7B%22end%22%3A4%7D%5D%7D%5D%7D"},{"groupName":"Age > 4 years","url":"https://www.cbioportal.org/study?id=nbl_target_2018_pub#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22AGE%22%2C%22values%22%3A%5B%7B%22start%22%3A5%7D%5D%7D%5D%7D"}],"pageDescription":"Kaplan-Meier survival analysis comparing Age ≤ 4 years (836) vs Age > 4 years (126)."}} ═ answer (success) --- ## Summary ### Survival Data: Pediatric Neuroblastoma (TARGET, 2018) **Key Findings:** | Age Group | Total Patients | Deceased (Events) | Censored (Living) | Event Rate | |-----------|----------------|-------------------|-------------------|------------| | **Age ≤ 4 years** | 822 | 276 | 546 | 33.6% | | **Age > 4 years** | 250 | 121 | 129 | 48.4% | **Follow-up Duration:** - **Age ≤ 4:** Range 1–183 months; median 57 months - **Age > 4:** Range 1–183 months; median 46.5 months ### Statistical Analysis **Important:** ClickHouse cannot compute statistical tests directly. To determine whether the survival difference between age groups is statistically significant, you need to perform a **Kaplan-Meier survival analysis with log-rank test**. **[View the Group Comparison Survival Tab](https://www.cbioportal.org/comparison/survival?comparisonId=6ab5c0bde497aad53593c25a)** This cBioPortal page will display: - Kaplan-Meier curves for both age groups - Median overall survival (if reached in both groups) - Log-rank test p-value - Hazard ratio and 95% CI (from Cox regression) **Alternative:** You can also compute this in R or Python: ```r # R: survival package library(survival) fit <- survfit(Surv(OS_MONTHS, OS_STATUS=="1:DECEASED") ~ age_group, data=your_data) survdiff(Surv(OS_MONTHS, OS_STATUS=="1:DECEASED") ~ age_group, data=your_data) ``` The raw data shows that patients older than 4 years had a higher event rate (48.4% vs 33.6%), suggesting potentially worse outcomes in the older cohort, but statistical significance must be determined from the KM analysis.