Q (sonnet): What fraction of patients were older than five when diagnosed according to the Pediatric Neuroblastoma study from TARGET? ▶ read_guide { "uri": "cbioportal://clinical-data-guide" } ▶ list_studies { "search": "neuroblastoma TARGET" } ◀ 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) ◀ result {"result":[{"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_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_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_run_select_query { "query": "SELECT attr_id, description, patient_attribute FROM clinical_attribute_meta WHERE cancer_study_id = (SELECT cancer_study_id FROM cancer_study WHERE cancer_study_identifier = 'nbl_target_2018_pub') AND (upper(attr_id) LIKE '%AGE%' OR upper(attr_id) LIKE '%DAYS%')" } ◀ result {"rows":[{"attr_id":"AGE","description":"Age at which a condition or disease was first diagnosed.","patient_attribute":1},{"attr_id":"AGE_IN_DAYS","description":"Age at which a condition or disease was first diagnosed.","patient_attribute":1},{"attr_id":"INSS_STAGE","description":"Staging according to the International Neuroblastoma Staging System","patient_attribute":1},{"attr_id":"OS_DAYS","description":"Overall patient survival days","patient_attribute":1},{"attr_id":"PERCENTAGE_NECROSIS","description":"Percent necrosis.","patient_attribute":1},{"attr_id":"PERCENTAGE_TUMOR_PURITY","description":"Percent tumor purity.","patient_attribute":1}]} ▶ clickhouse_run_select_query { "query": " SELECT arrayMin(ages) AS min_age, arrayMax(ages) AS max_age, countEqual(ages, min_age) AS at_min, countEqual(ages, max_age) AS at_max, length(ages) AS patients FROM ( SELECT groupArray(toFloat64OrNull(attribute_value)) AS ages FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name = 'AGE_IN_DAYS' AND toFloat64OrNull(attribute_value) IS NOT NULL ) " } ◀ result {"rows":[{"min_age":0,"max_age":7612,"at_min":1,"at_max":1,"patients":1076}]} ▶ clickhouse_run_select_query { "query": " WITH ages AS ( SELECT patient_unique_id, toFloat64OrNull(attribute_value) AS age_days FROM clinical_data_derived WHERE cancer_study_identifier = 'nbl_target_2018_pub' AND attribute_name = 'AGE_IN_DAYS' AND toFloat64OrNull(attribute_value) IS NOT NULL ) SELECT count() AS total_patients, countIf(age_days > 1826.25) AS over_5, round(100.0 * countIf(age_days > 1826.25) / count(), 1) AS pct_over_5 FROM ages " } ◀ result {"rows":[{"total_patients":1076,"over_5":125,"pct_over_5":11.6}]} ▶ 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_study_view { "studyIds": [ "nbl_target_2018_pub" ], "filterJson": { "clinicalDataFilters": [ { "attributeId": "AGE_IN_DAYS", "values": [ { "start": 1826.25 } ] } ] } } ◀ result {"success":true,"message":"Navigating to https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22AGE_IN_DAYS%22%2C%22values%22%3A%5B%7B%22start%22%3A1826.25%7D%5D%7D%5D%7D","url":"https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22AGE_IN_DAYS%22%2C%22values%22%3A%5B%7B%22start%22%3A1826.25%7D%5D%7D%5D%7D","data":{"studyIds":["nbl_target_2018_pub"],"studies":[{"studyId":"nbl_target_2018_pub","name":"Pediatric Neuroblastoma (TARGET, 2018)","sampleCount":1089}],"tab":"summary","hasFilters":true,"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) ## Results In the **Pediatric Neuroblastoma (TARGET, 2018)** study (`nbl_target_2018_pub`), among the **1,076 patients** with recorded age at diagnosis (using the precise `AGE_IN_DAYS` attribute, since the rounded `AGE` field is typically less granular in pediatric cohorts): - **125 patients (11.6%)** were older than 5 years (>1,826.25 days) at diagnosis - The remaining **951 patients (88.4%)** were 5 years old or younger Note: There is also a separate, newer **Neuroblastoma (TARGET GDC, 2025)** study (`nbl_target_gdc`, 533 samples) in the database. I used the 2018 study since its name matches "Pediatric Neuroblastoma" exactly — let me know if you'd like the GDC cohort instead. [View age-filtered cohort (>5 years) in Study View](https://www.cbioportal.org/study/summary?id=nbl_target_2018_pub#filterJson=%7B%22clinicalDataFilters%22%3A%5B%7B%22attributeId%22%3A%22AGE_IN_DAYS%22%2C%22values%22%3A%5B%7B%22start%22%3A1826.25%7D%5D%7D%5D%7D)