Q (sonnet-5.5): What fraction of patients were older than five when diagnosed according to the Pediatric Neuroblastoma study from TARGET? ▶ list_studies { "search": "TARGET neuroblastoma" } ◀ 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"}]} ▶ read_guide { "uri": "cbioportal://clinical-data-guide" } ◀ result # Clinical Data Query Guide ## Overview Clinical data in cBioPortal is stored at both patient and sample levels. Understanding the distinction is crucial for accurate analysis. ## Data Organization ### Patient-Level vs Sample-Level Data - **Patient-level**: Demographics, overall survival, disease stage (stored once per patient) - **Sample-level**: Sample type, sequencing platform, purity (can have multiple per patient) ### Key Tables - `clinical_patient`: Patient-level clinical attributes - `clinical_sample`: Sample-level clinical attributes - `clinical_data_derived`: Pre-joined view combining both levels - `clinical_attribute_meta`: Metadata about available clinical attributes ## Recommended Approach: Use clinical_data_derived The `clinical_data_derived` table is pre-joined and optimized for most queries: ```sql -- Get clinical data for specific attributes SELECT sample_unique_id, patient_unique_id, attribute_name, attribute_value FROM clinical_data_derived WHERE cancer_study_identifier = 'your_study_id' AND attribute_name IN ('CANCER_TYPE', 'SAMPLE_TYPE', 'TMB_NONSYNONYMOUS'); ``` ## Clinical Attribute Discovery ### Use clinical_attribute_meta for Discovering Available Attributes **Always start here** to see what clinical attributes are available for a specific study: ```sql -- Discover available clinical attributes for a study SELECT attr_id, description, patient_attribute, cancer_study_id FROM clinical_attribute_meta WHERE cancer_study_id = ( SELECT cancer_study_id FROM cancer_study WHERE cancer_study_identifier = 'your_study_id' ) ORDER BY patient_attribute, attr_id; ``` **Key Fields:** - **attr_id**: matches attr_id in clinical_sample/clinical_patient tables - **description**: human-readable description of the attribute - **patient_attribute**: true = patient attribute, false = sample attribute - **cancer_study_id**: links to cancer_study table (filter by study) ## Attribute Semantics and Matching ### Case-Insensitive Matching for Attribute Values Clinical values are free text across studies and may differ only by case. For example, a controlled-looking value such as germline mutation status may appear as `GERMLINE`, `Germline`, or another case variant. When filtering `clinical_data_derived.attribute_value`, use case-insensitive matching unless you have already profiled the exact values in the target study: ```sql -- Correct: case-insensitive clinical value filter SELECT DISTINCT sample_unique_id, patient_unique_id FROM clinical_data_derived WHERE cancer_study_identifier = 'your_study_id' AND attribute_name = 'MUTATION_STATUS' AND upper(attribute_value) = 'GERMLINE'; ``` Do not write `attribute_value = 'GERMLINE'` without first checking all distinct values for that attribute in the study. ### Query the Requested Attribute, Not a Proxy Do not infer one clinical attribute from a related subtype or marker. Query the actual requested attribute when it … (17073 more chars) ▶ clickhouse_run_select_query { "query": "SELECT attribute_name, count() n, uniq(patient_unique_id) p, min(toFloat64OrNull(attribute_value)) mn, max(toFloat64OrNull(attribute_value)) mx FROM clinical_data_derived WHERE cancer_study_identifier='nbl_target_2018_pub' AND (attribute_name ILIKE '%AGE%' OR attribute_name ILIKE '%BIRTH%' OR attribute_name ILIKE '%DIAG%') GROUP BY attribute_name" } ◀ result {"rows":[{"attribute_name":"AGE","n":1076,"p":1076,"mn":0,"mx":21},{"attribute_name":"PERCENTAGE_NECROSIS","n":1076,"p":1076,"mn":0,"mx":100},{"attribute_name":"INSS_STAGE","n":1076,"p":1076},{"attribute_name":"AGE_IN_DAYS","n":1076,"p":1076,"mn":0,"mx":7612},{"attribute_name":"DIAGNOSIS","n":1076,"p":1076},{"attribute_name":"PERCENTAGE_TUMOR_PURITY","n":1076,"p":1076,"mn":0,"mx":100},{"attribute_name":"YEAR_OF_DIAGNOSIS","n":1076,"p":1076,"mn":1986,"mx":2012}]} ▶ clickhouse_run_select_query { "query": "SELECT count() total, countIf(d>1826.25) over5_days, countIf(a>5) over5_agecol, countIf(a>=5) ge5_agecol, countIf(d IS NULL) missing FROM (SELECT patient_unique_id, anyIf(toFloat64OrNull(attribute_value), attribute_name='AGE_IN_DAYS') d, anyIf(toFloat64OrNull(attribute_value), attribute_name='AGE') a FROM clinical_data_derived WHERE cancer_study_identifier='nbl_target_2018_pub' AND attribute_name IN ('AGE','AGE_IN_DAYS') GROUP BY patient_unique_id)" } ◀ result {"rows":[{"total":1076,"over5_days":125,"over5_agecol":125,"ge5_agecol":251,"missing":0}]} ═ answer (success) In the Pediatric Neuroblastoma (TARGET, 2018) study, **125 of 1,076 patients (about 11.6%)** were older than 5 years at diagnosis. That is roughly 1 in 9. Every patient in the study has an age recorded. - **Age used:** Age at diagnosis in days, with "older than 5" meaning more than 1,826 days (5 × 365.25). The study's age-in-years column gives the same count. - **Exactly age 5:** A further 126 patients were recorded at exactly 5 years. If you count age 5 as "older than five", the number is 251 of 1,076 (about 23%). - **Which study:** Two other TARGET neuroblastoma datasets exist, "Neuroblastoma (TARGET GDC, 2025)" and the MSK neuroblastoma study. I used the 2018 study because its name matches yours. [View the study in cBioPortal](https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub)