Sample Lists#
The module sample_lists provides functions related to Sample Lists section of
cBioPortal Web Public API.
- pybioportal.sample_lists.fetch_sample_lists(sample_list_ids, projection='SUMMARY')#
Fetch sample lists by ID.
- Parameters:
sample_list_ids (list of str) – List of sample list IDs.
projection (str) –
Level of detail of the response.
Possible values:
”DETAILED”: Detailed information.
”ID”: Information with only IDs.
”META”: Metadata information.
”SUMMARY”: Summary information (default).
- Returns:
A DataFrame containing sample lists.
- Return type:
pandas.DataFrame
- pybioportal.sample_lists.get_all_sample_ids_in_sample_list(sample_list_id)#
Get all sample IDs in a sample list.
- Parameters:
sample_list_id (str) – Sample List ID (e.g., “acc_tcga_all”).
- Returns:
A DataFrame containing sample IDs in the sample list.
- Return type:
pandas.DataFrame
- pybioportal.sample_lists.get_all_sample_lists(projection='SUMMARY', direction='ASC', pageNumber=0, pageSize=10000000, sortBy=None)#
Get all sample lists.
- Parameters:
projection (str) –
Level of detail of the response.
Possible values:
”DETAILED”: Detailed information.
”ID”: Information with only IDs.
”META”: Metadata information.
”SUMMARY”: Summary information (default).
direction (str) –
Direction of the sort.
Possible values:
”ASC”: Ascending (default).
”DESC”: Descending.
pageNumber (int) –
Page number of the result list.
Minimum value is 0.
pageSize (int) –
Page size of the result list.
Minimum value is 1, maximum value is 10000000.
sortBy (str) –
Name of the property that the result list is sorted by.
Possible values:
”category”
”description”
”name”
”sampleListId”
”studyId”
- Returns:
A DataFrame containing sample lists.
- Return type:
pandas.DataFrame
- pybioportal.sample_lists.get_all_sample_lists_in_study(study_id, direction='ASC', pageNumber=0, pageSize=10000000, projection='SUMMARY', sortBy=None)#
Get all sample lists in a study.
- Parameters:
study_id (str) – Study ID (e.g., “acc_tcga”).
direction (str) –
Direction of the sort.
Possible values:
”ASC”: Ascending (default).
”DESC”: Descending.
pageNumber (int) –
Page number of the result list.
Minimum value is 0.
pageSize (int) –
Page size of the result list.
Minimum value is 1, maximum value is 10000000.
projection (str) –
Level of detail of the response.
Possible values:
”DETAILED”: Detailed information.
”ID”: Information with only IDs.
”META”: Metadata information.
”SUMMARY”: Summary information (default).
sortBy (str) –
Name of the property that the result list is sorted by.
Possible values:
”category”: Sort by category.
”description”: Sort by description.
”name”: Sort by name.
”sampleListId”: Sort by sample list ID.
”studyId”: Sort by study ID.
- Returns:
A DataFrame containing sample lists in the specified study.
- Return type:
pandas.DataFrame
- pybioportal.sample_lists.get_sample_list(sample_list_id)#
Get sample list.
- Parameters:
sample_list_id (str) – Sample List ID (e.g., “acc_tcga_all”).
- Returns:
A DataFrame containing sample list details.
- Return type:
pandas.DataFrame
Examples#
from pybioportal import sample_lists as sl
df1 = sl.get_all_sample_lists(projection="DETAILED")
df1
| category | name | description | sampleCount | sampleIds | sampleListId | studyId | |
|---|---|---|---|---|---|---|---|
| 0 | all_cases_with_mrna_rnaseq_data | Samples with mRNA data (RNA Seq V2) | Samples with mRNA expression data (79 samples) | 79 | [TCGA-OR-A5J1-01, TCGA-OR-A5J2-01, TCGA-OR-A5J... | acc_tcga_rna_seq_v2_mrna | acc_tcga |
| 1 | all_cases_in_study | All samples | All samples (92 samples) | 92 | [TCGA-OR-A5J1-01, TCGA-OR-A5J2-01, TCGA-OR-A5J... | acc_tcga_all | acc_tcga |
| 2 | all_cases_with_cna_data | Samples with CNA data | Samples with CNA data (90 samples) | 90 | [TCGA-OR-A5J1-01, TCGA-OR-A5J2-01, TCGA-OR-A5J... | acc_tcga_cna | acc_tcga |
| 3 | all_cases_with_mutation_and_cna_data | Samples with mutation and CNA data | Samples with mutation and CNA data (88 samples) | 88 | [TCGA-OR-A5J1-01, TCGA-OR-A5J2-01, TCGA-OR-A5J... | acc_tcga_cnaseq | acc_tcga |
| 4 | all_cases_with_mutation_and_cna_and_mrna_data | Complete samples | Samples with mutation, CNA and expression data... | 75 | [TCGA-OR-A5J1-01, TCGA-OR-A5J2-01, TCGA-OR-A5J... | acc_tcga_3way_complete | acc_tcga |
| ... | ... | ... | ... | ... | ... | ... | ... |
| 2225 | all_cases_with_mutation_and_cna_data | Samples with mutation and CNA data | Samples with mutation and CNA data (322 samples) | 322 | [P-0000463-T01-IM3, P-0000583-T01-IM3, P-00006... | bm_nsclc_mskcc_2023_cnaseq | bm_nsclc_mskcc_2023 |
| 2226 | all_cases_with_mutation_data | Samples with mutation data | Samples with mutation data (322 samples) | 322 | [P-0000463-T01-IM3, P-0000583-T01-IM3, P-00006... | bm_nsclc_mskcc_2023_sequenced | bm_nsclc_mskcc_2023 |
| 2227 | all_cases_with_sv_data | Samples with SV data | Samples with SV data | 322 | [P-0000463-T01-IM3, P-0000583-T01-IM3, P-00006... | bm_nsclc_mskcc_2023_sv | bm_nsclc_mskcc_2023 |
| 2228 | all_cases_in_study | All samples | All samples (19 samples) | 19 | [2-001_Plexiform_Neurofibroma, 2-004_Plexiform... | nst_nfosi_ntap_all | nst_nfosi_ntap |
| 2229 | all_cases_with_mutation_data | Samples with mutation data | Samples with mutation data (19 samples) | 19 | [2-001_Plexiform_Neurofibroma, 2-004_Plexiform... | nst_nfosi_ntap_sequenced | nst_nfosi_ntap |
2230 rows × 7 columns
df2 = sl.get_sample_list(sample_list_id="brca_tcga_cna")
df2
| category | name | description | sampleCount | sampleIds | sampleListId | studyId | |
|---|---|---|---|---|---|---|---|
| 0 | all_cases_with_cna_data | Samples with CNA data | Samples with CNA data (1080 samples) | 1080 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_cna | brca_tcga |
df3 = sl.get_all_sample_ids_in_sample_list(sample_list_id="brca_tcga_cna")
df3
| 0 | |
|---|---|
| 0 | TCGA-AR-A1AR-01 |
| 1 | TCGA-BH-A1EO-01 |
| 2 | TCGA-BH-A1ES-01 |
| 3 | TCGA-BH-A1ET-01 |
| 4 | TCGA-BH-A1EU-01 |
| ... | ... |
| 1075 | TCGA-E2-A1B4-01 |
| 1076 | TCGA-E2-A1B5-01 |
| 1077 | TCGA-E2-A1B6-01 |
| 1078 | TCGA-E2-A1BC-01 |
| 1079 | TCGA-E2-A1BD-01 |
1080 rows × 1 columns
df4 = sl.fetch_sample_lists(sample_list_ids=["brca_tcga_cna", "brca_tcga_mrna"], projection="DETAILED")
df4
| category | name | description | sampleCount | sampleIds | sampleListId | studyId | |
|---|---|---|---|---|---|---|---|
| 0 | all_cases_with_cna_data | Samples with CNA data | Samples with CNA data (1080 samples) | 1080 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_cna | brca_tcga |
| 1 | all_cases_with_mrna_array_data | Samples with mRNA data (Agilent microarray) | Samples with mRNA expression data (529 samples) | 529 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_mrna | brca_tcga |
df5 = sl.get_all_sample_lists_in_study(study_id="brca_tcga",projection="DETAILED")
df5
| category | name | description | sampleCount | sampleIds | sampleListId | studyId | |
|---|---|---|---|---|---|---|---|
| 0 | all_cases_with_mrna_rnaseq_data | Samples with mRNA data (RNA Seq V2) | Samples with mRNA expression data (1100 samples) | 1100 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_rna_seq_v2_mrna | brca_tcga |
| 1 | all_cases_in_study | All samples | All samples (1108 samples) | 1108 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_all | brca_tcga |
| 2 | all_cases_with_cna_data | Samples with CNA data | Samples with CNA data (1080 samples) | 1080 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_cna | brca_tcga |
| 3 | all_cases_with_mutation_and_cna_data | Samples with mutation and CNA data | Samples with mutation and CNA data (963 samples) | 963 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_cnaseq | brca_tcga |
| 4 | all_cases_with_mutation_and_cna_and_mrna_data | Complete samples | Samples with mutation, CNA and expression data... | 960 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_3way_complete | brca_tcga |
| 5 | all_cases_with_mrna_array_data | Samples with mRNA data (Agilent microarray) | Samples with mRNA expression data (529 samples) | 529 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_mrna | brca_tcga |
| 6 | all_cases_with_methylation_data | Samples with methylation data | Samples with methylation data (788 samples) | 788 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_methylation_all | brca_tcga |
| 7 | all_cases_with_methylation_data | Samples with methylation data (HM27) | Samples with methylation data (HM27) (343 samp... | 316 | [TCGA-A2-A0CX-01, TCGA-A2-A0D0-01, TCGA-A2-A0D... | brca_tcga_methylation_hm27 | brca_tcga |
| 8 | all_cases_with_methylation_data | Samples with methylation data (HM450) | Samples with methylation data (HM450) (885 sam... | 788 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_methylation_hm450 | brca_tcga |
| 9 | other | Samples with phosphoprotein quantification dat... | Tumor samples with phosphoprotein quantificati... | 74 | [TCGA-A7-A0CE-01, TCGA-A7-A0CJ-01, TCGA-A8-A06... | brca_tcga_phosphoprotein_quantification | brca_tcga |
| 10 | other | Samples with protein data (Mass Spec) | Samples with protein data (Mass Spec) (74 samp... | 74 | [TCGA-A7-A0CE-01, TCGA-A7-A0CJ-01, TCGA-A8-A06... | brca_tcga_protein_quantification | brca_tcga |
| 11 | all_cases_with_rppa_data | Samples with protein data (RPPA) | Samples protein data (RPPA) (892 samples) | 892 | [TCGA-BH-A1EO-01, TCGA-BH-A1ES-01, TCGA-BH-A1E... | brca_tcga_rppa | brca_tcga |
| 12 | all_cases_with_mutation_data | Samples with mutation data | Samples with mutation data (982 samples) | 982 | [TCGA-AR-A1AR-01, TCGA-BH-A1EO-01, TCGA-BH-A1E... | brca_tcga_sequenced | brca_tcga |