Q (sonnet): Which cBioPortal studies include lung adenocarcinoma samples with mutation and copy-number data? ▶ list_guides {} ▶ search_oncotree { "search_term": "lung adenocarcinoma" } ◀ result {"result":[{"uri":"cbioportal://mutation-frequency-guide","description":"Comprehensive guide for calculating gene mutation frequencies with gene-specific profiling denominators"},{"uri":"cbioportal://clinical-data-guide","description":"Guide for querying clinical data including patient vs sample level considerations"},{"uri":"cbioportal://sample-filtering-guide","description":"Guide for filtering samples and studies in cBioPortal queries"},{"uri":"cbioportal://common-pitfalls","description":"Guide to avoid common mistakes when querying cBioPortal data. If you already know which numbered pitfall applies, fetch just that section via read_guide(\"cbioportal://common-pitfalls#\") (e.g. #16) instead of the full guide"},{"uri":"cbioportal://treatment-guide","description":"Guide for querying treatment/clinical event data including drug agents, timelines, and linking to genomic data"},{"uri":"cbioportal://faq-guide","description":"General cBioPortal FAQ: history, how to cite, data types, reference genome, abbreviations, GISTIC thresholds, API access"},{"uri":"cbioportal://statistical-tests-guide","description":"Statistical test selection guide — decision matrix for choosing Fisher's exact, Wilcoxon, chi-squared, t-test, ANOVA, etc. based on data type and group count"},{"uri":"cbioportal://gene-expression-guide","description":"Gene expression / copy-number / methylation analysis. Covers genetic_alteration_derived, profile_type discovery, and the gene_pair_coexpression view for Spearman correlation between two genes"},{"uri":"cbioportal://external-resources-guide","description":"Guide for finding external linked resources such as imaging, pathology, Minerva, HTAN, or other resource_* table links before declaring data unavailable"},{"uri":"cbioportal://gene-resolution-guide","description":"Guide for resolving ambiguous gene symbols, aliases, gene families, and shorthand such as CD3 before querying expression or alteration data"},{"uri":"cbioportal://study-resolution-guide","description":"Guide for resolving requested studies, avoiding silent substitute cohorts, and redirecting to known external cBioPortal instances when data is not in this deployment"},{"uri":"cbioportal://germline-guide","description":"Guide for querying germline variant data — storage columns, study discovery, query patterns, and somatic vs germline considerations"},{"uri":"cbioportal://study-guide/{study_id}","description":"Dynamic study-specific guide - use get_study_guide(study_id) tool to generate"}]} ◀ result {"result":[{"code":"LUAD","name":"Lung Adenocarcinoma","score":80,"mainType":"Non-Small Cell Lung Cancer","tissue":"Lung","hierarchy":"LUNG > NSCLC > LUAD"},{"code":"LAIS","name":"Lung Adenocarcinoma In Situ","score":60,"mainType":"Non-Small Cell Lung Cancer","tissue":"Lung","hierarchy":"LUNG > LAIS"}]} ▶ read_guide { "uri": "cbioportal://sample-filtering-guide" } ▶ clickhouse_list_tables {} ◀ result # Sample and Study Filtering Guide ## Overview Proper filtering is essential for meaningful cBioPortal analysis. This guide covers filtering by studies, sample types, and other criteria. ## Study-Level Filtering ### 1. Always Filter by Study Every query should specify a study to ensure consistent results: ```sql -- Always include study filtering SELECT * FROM your_table WHERE cancer_study_identifier = 'your_study_id' -- Additional filters... ``` ### 2. Find Available Studies ```sql -- Discover available studies SELECT cancer_study_identifier, name, description, type_of_cancer_id FROM cancer_study ORDER BY cancer_study_identifier; ``` ### 3. Study Information ```sql -- Get detailed study information SELECT cs.cancer_study_identifier, cs.name as study_name, cs.description, cs.sample_count, COUNT(DISTINCT p.internal_id) as patient_count FROM cancer_study cs LEFT JOIN patient p ON cs.cancer_study_id = p.cancer_study_id WHERE cs.cancer_study_identifier = 'your_study_id' GROUP BY cs.cancer_study_identifier, cs.name, cs.description, cs.sample_count; ``` ### 4. Find Studies by Available Data Types Use this when the user asks *"which studies have mutation and copy-number data for X"*, *"studies with expression for Y"*, *"is there any imaging data"*, or any *"studies with Z data"* question. `cancer_study` has one precomputed sample count per data type — filter on them. No join and no schema exploration needed. These are the same counts as the portal's study list and its "Data type" filter. **Canonical query — studies with ALL requested data types for a cancer type:** ```sql SELECT cancer_study_identifier, name, sample_count, mutation_sample_count, cna_sample_count FROM cancer_study WHERE type_of_cancer_id = 'luad' -- ← OncoTree code from search_oncotree AND mutation_sample_count > 0 -- ← one condition per required data type AND cna_sample_count > 0 ORDER BY sample_count DESC; ``` **Data type → column** (a count of 0 means the study doesn't have that data): | Data type in the user's question | Column (portal "Data type" filter label) | |---|---| | samples in the study | `sample_count` | | mutation / mutations | `mutation_sample_count` ("Mutations") | | copy-number / CNA / amplification / deletion | `cna_sample_count` ("CNA") | | structural variant / fusion | `structural_variant_sample_count` | | RNA / mRNA / gene expression (any platform) | `mrna_expression_sample_count` — use this for "which studies have expression data" | | specifically the portal's "RNA-Seq" filter | `rna_seq_sample_count` ("RNA-Seq") — counts only the `_rna_seq_v2_mrna` list; 0 for many GDC and iAtlas studies that do have RNA-Seq | | specifically the portal's "RNA (microarray)" filter | `mrna_microarray_sample_count` ("RNA (microarray)") — counts only the `_mrna` list | | microRNA | `mirna_sample_count` ("miRNA") | | protein / RPPA | `rppa_sample_count` ("RPPA") | | mas … (7083 more chars) ◀ result {"tables":[{"name":"allele_specific_copy_number"},{"name":"alteration_driver_annotation"},{"name":"cancer_study"},{"name":"cancer_study_query_preferences"},{"name":"cancer_study_tags"},{"name":"cbioportal_sequence_state"},{"name":"clinical_attribute_counts"},{"name":"clinical_attribute_meta"},{"name":"clinical_data_derived"},{"name":"clinical_event"},{"name":"clinical_event_data"},{"name":"clinical_event_data_derived"},{"name":"clinical_event_derived"},{"name":"clinical_patient"},{"name":"clinical_sample"},{"name":"cna_event"},{"name":"cna_panel_gene_coverage"},{"name":"cna_wes_coverage"},{"name":"co_altered_genes_in_study"},{"name":"copy_number_seg"},{"name":"copy_number_seg_file"},{"name":"gene"},{"name":"gene_alias"},{"name":"gene_alteration_frequency_by_cancer_type"},{"name":"gene_cna_distribution_in_study"},{"name":"gene_mutation_frequency_by_cancer_type"},{"name":"gene_mutation_frequency_in_studies"},{"name":"gene_mutation_frequency_in_study"},{"name":"gene_mutation_variants_in_study"},{"name":"gene_pair_coexpression"},{"name":"gene_panel"},{"name":"gene_panel_list"},{"name":"gene_panel_to_gene_derived"},{"name":"generic_assay_data_derived"},{"name":"generic_assay_meta_derived"},{"name":"generic_assay_profile_entity_derived"},{"name":"generic_entity_properties"},{"name":"geneset"},{"name":"geneset_gene"},{"name":"geneset_hierarchy_leaf"},{"name":"geneset_hierarchy_node"},{"name":"genetic_alteration"},{"name":"genetic_alteration_derived"},{"name":"genetic_entity"},{"name":"genetic_profile"},{"name":"genetic_profile_link"},{"name":"genetic_profile_samples"},{"name":"genomic_event_derived"},{"name":"gistic"},{"name":"gistic_to_gene"},{"name":"info"},{"name":"mut_sig"},{"name":"mutation"},{"name":"mutation_count_by_keyword"},{"name":"mutation_derived"},{"name":"mutation_event"},{"name":"mutation_panel_gene_coverage"},{"name":"mutation_wes_coverage"},{"name":"patient"},{"name":"reference_genome"},{"name":"reference_genome_gene"},{"name":"resource_definition"},{"name":"resource_patient"},{"name":"resource_sample"},{"name":"resource_study"},{"name":"sample"},{"name":"sample_cna_event"},{"name":"sample_derived"},{"name":"sample_list"},{"name":"sample_list_list"},{"name":"sample_profile"},{"name":"sample_to_gene_panel_derived"},{"name":"structural_variant"},{"name":"sv_panel_gene_coverage"},{"name":"sv_wes_coverage"},{"name":"top_cna_genes_in_study"},{"name":"top_mutated_genes_in_cohort"},{"name":"top_mutated_genes_in_study"},{"name":"top_sv_genes_in_study"},{"name":"treatment_counts_in_study"},{"name":"treatment_regimens_in_study"},{"name":"type_of_cancer"}]} ▶ clickhouse_run_select_query { "query": "SELECT cancer_study_identifier, name, sample_count, mutation_sample_count, cna_sample_count FROM cancer_study WHERE type_of_cancer_id = 'luad' AND mutation_sample_count > 0 AND cna_sample_count > 0 ORDER BY sample_count DESC", "max_rows": 100 } ◀ result {"rows":[{"cancer_study_identifier":"luad_mskcc_2023_met_organotropism","name":"Lung Adenocarcinoma Met Organotropism (MSK, Cancer Cell 2023)","sample_count":2653,"mutation_sample_count":2653,"cna_sample_count":2422},{"cancer_study_identifier":"lung_msk_2017","name":"Non-Small Cell Cancer (MSK, Cancer Discov 2017)","sample_count":915,"mutation_sample_count":915,"cna_sample_count":915},{"cancer_study_identifier":"luad_mskcc_2020","name":"Lung Adenocarcinoma (MSK, J Thorac Oncol 2020)","sample_count":604,"mutation_sample_count":604,"cna_sample_count":604},{"cancer_study_identifier":"luad_tcga","name":"Lung Adenocarcinoma (TCGA, Firehose Legacy)","sample_count":586,"mutation_sample_count":230,"cna_sample_count":516},{"cancer_study_identifier":"luad_tcga_gdc","name":"Lung Adenocarcinoma (TCGA GDC, 2025)","sample_count":571,"mutation_sample_count":559,"cna_sample_count":508},{"cancer_study_identifier":"luad_tcga_pan_can_atlas_2018","name":"Lung Adenocarcinoma (TCGA, PanCancer Atlas)","sample_count":566,"mutation_sample_count":566,"cna_sample_count":511},{"cancer_study_identifier":"luad_msk_npjpo_2021","name":"Lung Adenocarcinoma (MSK, NPJ Precision Oncology 2021)","sample_count":426,"mutation_sample_count":426,"cna_sample_count":426},{"cancer_study_identifier":"luad_oncosg_2020","name":"Lung Adenocarcinoma (OncoSG, Nat Genet 2020)","sample_count":305,"mutation_sample_count":302,"cna_sample_count":302},{"cancer_study_identifier":"luad_cptac_gdc","name":"Lung Adenocarcinoma (CPTAC GDC, 2025)","sample_count":241,"mutation_sample_count":236,"cna_sample_count":232},{"cancer_study_identifier":"luad_tcga_pub","name":"Lung Adenocarcinoma (TCGA, Nature 2014)","sample_count":230,"mutation_sample_count":230,"cna_sample_count":230},{"cancer_study_identifier":"luad_mskimpact_2021","name":"Lung Adenocarcinoma (MSK, 2021)","sample_count":186,"mutation_sample_count":186,"cna_sample_count":186},{"cancer_study_identifier":"luad_broad","name":"Lung Adenocarcinoma (Broad, Cell 2012)","sample_count":183,"mutation_sample_count":183,"cna_sample_count":183},{"cancer_study_identifier":"luad_cptac_2020","name":"Lung Adenocarcinoma (CPTAC, Cell 2020)","sample_count":110,"mutation_sample_count":110,"cna_sample_count":110}]} ▶ resolve_and_route { "studyIds": [ "luad_mskcc_2023_met_organotropism", "lung_msk_2017", "luad_mskcc_2020", "luad_tcga", "luad_tcga_gdc", "luad_tcga_pan_can_atlas_2018", "luad_msk_npjpo_2021", "luad_oncosg_2020", "luad_cptac_gdc", "luad_tcga_pub", "luad_mskimpact_2021", "luad_broad", "luad_cptac_2020" ] } ◀ result {"success":true,"message":"Found 13 matching studies. Pick the best match (prefer TCGA → prefer PanCancer Atlas), use its metadata to call the appropriate navigation tool(s) and generate URLs immediately. Present other studies as alternatives.","data":{"totalCount":13,"studiesWithMetadata":[{"studyId":"luad_mskcc_2023_met_organotropism","name":"Lung Adenocarcinoma Met Organotropism (MSK, Cancer Cell 2023)","sampleCount":2653,"studyViewUrl":"https://www.cbioportal.org/study?id=luad_mskcc_2023_met_organotropism","metadata":{"clinicalAttributeIds":["ADJUVANT","ADJUVANT_CHEMOTHERAPY","ADJUVANT_IMMUNOTHERAPY","ADJUVANT_TARGETED","ADJUVANT_THERAPY","ADJUVANT_XRT","ADRENAL_MONTHS","ADRENAL_STATUS","AGE_AT_DOS_BX","BONE_MONTHS","BONE_STATUS","CANCER_TYPE","CANCER_TYPE_DETAILED","CELL_CYCLE","CIGARETTE_HX","CNS_MONTHS","CNS_STATUS","CSTAGE","DEATH","EVER_MET_SITE_ADRENAL","EVER_MET_SITE_BONE","EVER_MET_SITE_CNS","EVER_MET_SITE_LIVER_BILIARY_TRACT","EVER_MET_SITE_LN","EVER_MET_SITE_LUNG","EVER_MET_SITE_PLEURA","FGA","FRACTION_GENOME_ALTERED","FU_2YRS","GENE_PANEL","GROUP_NO","HAD_SURGERY","HIPPO","IMPACT_METASTATIC_LESION","IMPACT_PRIMARY_GROUP","INSTITUTE","IN_MATCHED","IS_WGD","LIVER_MONTHS","LIVER_STATUS","LN_MONTHS","LN_STATUS","LUNG_MONTHS","LUNG_STATUS","METASTATIC_BURDEN","METASTATIC_SITE","MONTHS_FROM_MATCHED_PRIM","MSI_SCORE","MSI_TYPE","MUTATION_COUNT","MYC_PATH","NEOADJUVANT","NEOADJUVANT_CHEMOTHERAPY","NEOADJUVANT_IMMUNOTHERAPY","NEOADJUVANT_TARGETED","NEOADJUVANT_XRT","NOTCH","NRF2","ONCOTREE_CODE","OS_MONTHS","OS_STATUS","PI3K","PLEURA_MONTHS","PLEURA_STATUS","PLOIDY","POST_SAMPLE_CHEMOTHERAPY","POST_SAMPLE_IMMUNOTHERAPY","POST_SAMPLE_TARGETED","POST_SAMPLE_TX","POST_SAMPLE_XRT","PREDOM_HISTO_SUBTYPE","PRE_SAMPLE_CHEMOTHERAPY","PRE_SAMPLE_IMMUNOTHERAPY","PRE_SAMPLE_TARGETED","PRE_SAMPLE_TX","PRE_SAMPLE_XRT","PRIMARY_SITE","PSTAGE","PURITY","RACE","RTK_RAS","SAMPLE_CLASS","SAMPLE_COUNT","SAMPLE_COVERAGE","SAMPLE_TYPE","SEX","SOMATIC_STATUS","TGF_BETA","TMB_NONSYNONYMOUS","TP53_PATH","WNT"],"molecularProfileIds":["luad_mskcc_2023_met_organotropism_cna","luad_mskcc_2023_met_organotropism_mutations","luad_mskcc_2023_met_organotropism_structural_variants"],"availableComparisonTabs":["overlap","clinical","survival","alterations","mutations"]}},{"studyId":"lung_msk_2017","name":"Non-Small Cell Cancer (MSK, Cancer Discov 2017)","sampleCount":915,"studyViewUrl":"https://www.cbioportal.org/study?id=lung_msk_2017","metadata":{"clinicalAttributeIds":["AGE","CANCER_TYPE","CANCER_TYPE_DETAILED","CLINICAL_TRIAL","DRIVER_MUTATIONS","DURABLE_CLINICAL_BENEFIT","FRACTION_GENOME_ALTERED","GENE_PANEL","IMMUNE_TREATMENT","INSTITUTE","LINES_OF_TX_PRIOR_IMPACT","METASTATIC_SITE","MUTATION_COUNT","ONCOTREE_CODE","OVERALL_PATIENT_HISTOLOGY","PRIMARY_SITE","RECURRENT_METASTATIC_DISEASE","SAMPLE_CLASS","SAMPLE_COUNT","SAMPLE_COVERAGE","SAMPLE_PRE_LUNG_THERAPY","SAMPLE_TYPE","SEX","SMOKING_HISTORY","SOMATIC_STATUS","STAGE_AT_DIAGNOSIS","TARGET_THERAPY","TMB_NONSYNONYMOUS … (17604 more chars) ═ answer (success) All 13 studies are resolved. Here is the study overview link for the recommended reference cohort (TCGA PanCancer Atlas), which has curated clinical and mutation/CNA/mRNA/RPPA/methylation data: **[TCGA Lung Adenocarcinoma – PanCancer Atlas: StudyView](https://www.cbioportal.org/study?id=luad_tcga_pan_can_atlas_2018)** — 566 samples, 566 mutation-profiled, 511 CNA-profiled. For a larger, more contemporary cohort (2,653 samples): **[MSK Met Organotropism (Cancer Cell 2023): StudyView](https://www.cbioportal.org/study?id=luad_mskcc_2023_met_organotropism)** All 13 qualifying studies (from the table above) are available individually via `https://www.cbioportal.org/study?id=` — substitute any `cancer_study_identifier` from the table (e.g., `lung_msk_2017`, `luad_tcga_gdc`, `luad_oncosg_2020`, `luad_cptac_2020`, etc.).