### Get All Sample Lists with Detailed Projection Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Retrieves all available sample lists with detailed information. The output is a pandas DataFrame. ```python df1 = sl.get_all_sample_lists(projection="DETAILED") df1 ``` -------------------------------- ### Info Source: https://pybioportal.readthedocs.io/en/latest/modules.html Function to get general information about the server. ```APIDOC ## get_info() ### Description Retrieves general information about the cBioPortal server. ### Method GET ### Endpoint /info ``` -------------------------------- ### Get All Molecular Profiles Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Retrieve all available molecular profiles. Displays the first 5 rows of the resulting DataFrame. ```python df1 = mf.get_all_molecular_profiles() df1.head(5) ``` -------------------------------- ### Get a Specific Sample List by ID Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Fetches a single sample list using its unique identifier. The result is a pandas DataFrame. ```python df2 = sl.get_sample_list(sample_list_id="brca_tcga_cna") df2 ``` -------------------------------- ### Get All Sample IDs in a Sample List Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Retrieves all sample IDs belonging to a specified sample list. The output is a pandas DataFrame. ```python df3 = sl.get_all_sample_ids_in_sample_list(sample_list_id="brca_tcga_cna") df3 ``` -------------------------------- ### Get All Sample Lists in a Study Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Fetches all sample lists associated with a specific study ID, including detailed information. The result is a pandas DataFrame. ```python df5 = sl.get_all_sample_lists_in_study(study_id="brca_tcga",projection="DETAILED") df5 ``` -------------------------------- ### Example Output of get_info() Source: https://pybioportal.readthedocs.io/en/latest/info.html This snippet shows the expected output format and content when calling get_info() and printing its columns. It includes details like portal version, database version, and git commit information. ```text portalVersion: 5.4.7-dirty-SNAPSHOT dbVersion: 2.13.1 gitBranch: d4b06559c81a99911d620107113b2acf0e40523e gitCommitId: d4b06559c81a99911d620107113b2acf0e40523e gitCommitIdDescribe: v5.4.7-dirty gitCommitIdDescribeShort: v5.4.7-dirty gitCommitMessageFull: Merge pull request #10453 from cBioPortal/front... gitCommitMessageShort: Merge pull request #10453 from cBioPortal/front... gitCommitMessageUserEmail: 15748980+dippindots@users.noreply.github.com gitCommitMessageUserName: Gaofei Zhao gitDirty: True ``` -------------------------------- ### Get All Samples in a Study Source: https://pybioportal.readthedocs.io/en/latest/samples.html Use `get_all_samples_in_study` to retrieve all samples belonging to a specific study. This is useful for a broad overview of all samples within a research study. ```python df4 = sp.get_all_samples_in_study(study_id="brca_tcga") df4 ``` -------------------------------- ### Get All Study IDs Source: https://pybioportal.readthedocs.io/en/latest/treatments.html Fetches all study IDs to be used in subsequent treatment queries. This is a prerequisite for most treatment-related API calls. ```python from pybioportal import studies as std studies = std.get_all_studies(projection="DETAILED") std_ids = studies["studyId"].to_list() print(f"First Study IDs of {len(std_ids)}: {std_ids[0:5]}") ``` -------------------------------- ### Get All Molecular Profiles in a Study with Custom Sorting Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Retrieve all molecular profiles within a specific study, sorted by their description. Displays the first 5 rows of the resulting DataFrame. ```python df4 = mf.get_all_molecular_profiles_in_study(study_id="brca_tcga", sortBy="description") df4.head(5) ``` -------------------------------- ### Get all gene panels Source: https://pybioportal.readthedocs.io/en/latest/gene_panels.html Retrieve a DataFrame containing all available gene panels. Use `.head(10)` to display the first 10 entries. ```python df1 = gp.get_all_gene_panels() df1.head(10) ``` -------------------------------- ### Get All Genes by Keyword Source: https://pybioportal.readthedocs.io/en/latest/genes.html Fetch all genes matching a specific keyword, such as a gene symbol. This is useful for searching for genes when you know part of their name. ```python df1a = gns.get_all_genes(keyword = "BRCA1") df1a ``` -------------------------------- ### Get cBioPortal Instance Information Source: https://pybioportal.readthedocs.io/en/latest/info.html Retrieves information about the running cBioPortal instance. This function is useful for understanding the environment and version details of the portal. ```python from pybioportal.info import get_info get_info() ``` -------------------------------- ### Get All Samples for a Patient in a Study Source: https://pybioportal.readthedocs.io/en/latest/samples.html Use `get_all_samples_of_patient_in_study` to retrieve all samples associated with a specific patient within a given study. This helps in analyzing all data points for a single patient. ```python df3 = sp.get_all_samples_of_patient_in_study(study_id="brca_tcga", patient_id="TCGA-AR-A1AR") df3 ``` -------------------------------- ### Get Generic Assay Metadata by Molecular Profile ID Source: https://pybioportal.readthedocs.io/en/latest/generic_assays.html Retrieves all generic assay metadata for a single molecular profile ID. The output includes stableId, entityType, gene symbol, and phosphosite. ```python df2 = ga.get_generic_assay_meta_by_molecular_profile_id("brca_tcga_phosphoprotein_quantification") df2 ``` -------------------------------- ### Get All Molecular Data in a Profile for a Sample List Source: https://pybioportal.readthedocs.io/en/latest/molecular_data.html Retrieve all molecular data within a specific molecular profile for a given sample list and Entrez gene ID. This is useful for comprehensive analysis within a defined subset of data. ```python df2 = md.get_all_molecular_data_in_molecular_profile(molecular_profile_id="brca_tcga_rppa", sample_list_id="brca_tcga_all", entrez_gene_id="675") df2 ``` -------------------------------- ### Get All Patient Clinical Data for a Study Source: https://pybioportal.readthedocs.io/en/latest/clinical_data.html Fetches all available patient-level clinical data for a given study ID. This is useful for exploring all data points associated with patients in a specific cohort. ```python df2a = cd.get_all_clinical_data_in_study("acc_tcga", clinical_data_type="PATIENT") df2a ``` -------------------------------- ### Get a Specific Sample in a Study Source: https://pybioportal.readthedocs.io/en/latest/samples.html Use `get_sample_in_study` to retrieve details for a single, specific sample within a study, identified by its `sample_id`. This is useful for detailed inspection of individual samples. ```python df5 = sp.get_sample_in_study(study_id="brca_tcga",sample_id="TCGA-AR-A1AR-01") df5 ``` -------------------------------- ### Fetch All Patients in a Specific Study with Detailed Projection Source: https://pybioportal.readthedocs.io/en/latest/patients.html Get all patients belonging to a particular study, such as 'brca_tcga', with a 'DETAILED' projection. This provides extensive metadata for each patient within the study. ```python df3 = pts.get_all_patients_in_study(study_id="brca_tcga", projection="DETAILED") df3 ``` -------------------------------- ### Get Clinical Data for a Specific Sample in a Study Source: https://pybioportal.readthedocs.io/en/latest/clinical_data.html Fetches all clinical data points for a specific sample within a given study. This is useful for detailed analysis of an individual sample's clinical profile. ```python df5 = cd.get_all_clinical_data_of_sample_in_study(study_id="msk_met_2021", sample_id="P-0000004-T01-IM3") df5 ``` -------------------------------- ### Get Generic Assay Data in Molecular Profile Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Retrieves generic assay data for a specific molecular profile and assay. Use this when you need to filter data by both a molecular profile and a specific assay identifier. ```python import pandas as pd import bioportal.generic_assay_data as gad df3 = gad.get_generic_assay_data_in_molecular_profile(molecular_profile_id = "brca_tcga_phosphoprotein_quantification", generic_assay_stable_id = "TULP4_pS563") df3 ``` -------------------------------- ### Fetch Molecular Data by Gene and Profile IDs Source: https://pybioportal.readthedocs.io/en/latest/molecular_data.html Retrieve molecular data for specified Entrez gene IDs and molecular profile IDs. This is useful for getting a broad overview of gene expression across different profiles. ```python from pybioportal import molecular_data as md df1a = md.fetch_molecular_data(entrez_gene_ids=["672","675"], molecular_profile_ids=["brca_tcga_mrna", "acc_tcga_rna_seq_v2_mrna"]) df1a ``` -------------------------------- ### Get Generic Assay Metadata by Assay ID Source: https://pybioportal.readthedocs.io/en/latest/generic_assays.html Fetches metadata for a single generic assay using its unique stable ID. The returned data includes stableId, entityType, gene symbol, and phosphosite. ```python df3 = ga.get_generic_assay_meta_by_id("TULP4_pS563") df3 ``` -------------------------------- ### Get Generic Assay Data in Molecular Profile Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Retrieves specific generic assay data for a given molecular profile and a single generic assay stable ID. The 'projection' parameter determines the detail level of the returned data. ```python pybioportal.generic_assay_data.get_generic_assay_data_in_molecular_profile(_molecular_profile_id_ , _generic_assay_stable_id_ , _projection ='SUMMARY'_) ``` -------------------------------- ### Get Specific Cancer Type Source: https://pybioportal.readthedocs.io/en/latest/cancer_types.html Retrieves a DataFrame with detailed information for a specific cancer type, identified by its cancer_type_id. Use this to get in-depth data about a particular cancer. ```python df2 = ct.get_cancer_type(cancer_type_id="brca") df2 ``` -------------------------------- ### Get Gene Information by Symbol or ID Source: https://pybioportal.readthedocs.io/en/latest/genes.html Fetch detailed information for a specific gene using its Hugo Gene Symbol or Entrez Gene ID. This is the primary way to get data for a single known gene. ```python df2 = gns.get_gene("BRCA1") df2 ``` -------------------------------- ### Sample Lists Source: https://pybioportal.readthedocs.io/en/latest/modules.html Functions for fetching and retrieving sample list information. ```APIDOC ## fetch_sample_lists() ### Description Fetches sample lists. ### Method POST ### Endpoint /sample_lists/fetch ## get_all_sample_ids_in_sample_list() ### Description Retrieves all sample IDs within a specific sample list. ### Method GET ### Endpoint /sample_lists/{sample_list_id}/samples ## get_all_sample_lists() ### Description Retrieves all available sample lists. ### Method GET ### Endpoint /sample_lists ## get_all_sample_lists_in_study() ### Description Retrieves all sample lists within a specific study. ### Method GET ### Endpoint /studies/{study_id}/sample_lists ## get_sample_list() ### Description Retrieves a specific sample list by its identifier. ### Method GET ### Endpoint /sample_lists/{sample_list_id} ``` -------------------------------- ### Samples Source: https://pybioportal.readthedocs.io/en/latest/modules.html Functions for fetching and retrieving sample information. ```APIDOC ## fetch_samples() ### Description Fetches sample information. ### Method POST ### Endpoint /samples/fetch ## get_all_samples_in_study() ### Description Retrieves all samples within a specific study. ### Method GET ### Endpoint /studies/{study_id}/samples ## get_all_samples_of_patient_in_study() ### Description Retrieves all samples belonging to a specific patient within a study. ### Method GET ### Endpoint /studies/{study_id}/patients/{patient_id}/samples ## get_sample_in_study() ### Description Retrieves a specific sample within a study by its ID. ### Method GET ### Endpoint /studies/{study_id}/samples/{sample_id} ## get_samples_by_keyword() ### Description Retrieves samples matching a keyword search. ### Method GET ### Endpoint /samples/search ``` -------------------------------- ### Server running status Source: https://pybioportal.readthedocs.io/en/latest/modules.html Function to get the server's running status. ```APIDOC ## get_server_status() ### Description Retrieves the current running status of the server. ### Method GET ### Endpoint /status ``` -------------------------------- ### Import Sample Lists Module Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Imports the sample_lists module from the pybioportal library. ```python from pybioportal import sample_lists as sl ``` -------------------------------- ### Fetch Samples by Unique Keys Source: https://pybioportal.readthedocs.io/en/latest/samples.html Use `fetch_samples` to retrieve specific samples using their unique keys. This is useful when you know the exact identifiers of the samples you need. ```python df2c = sp.fetch_samples(unique_sample_keys=["VENHQS1BUi1BMUFSLTAxOmJyY2FfdGNnYQ", "VENHQS1CNi1BMElRLTAxOmJyY2FfdGNnYV9wdWI", "VENHQS1CSC1BMUZELTAxOmJyY2FfdGNnYQ"]) df2c ``` -------------------------------- ### Get all clinical attributes Source: https://pybioportal.readthedocs.io/en/latest/clinical_attributes.html Fetch all available clinical attributes across all studies. This can be useful for an overview of the data available. ```python df1 = ca.get_all_clinical_attributes() df1 ``` -------------------------------- ### Fetch Multiple Sample Lists by IDs Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Retrieves multiple sample lists by providing a list of their IDs and a projection. The output is a pandas DataFrame. ```python df4 = sl.fetch_sample_lists(sample_list_ids=["brca_tcga_cna", "brca_tcga_mrna"], projection="DETAILED") df4 ``` -------------------------------- ### Get Tags for a Study Source: https://pybioportal.readthedocs.io/en/latest/studies.html Retrieves tags associated with a given study ID. The output is a pandas DataFrame containing the tags. ```python df3 = std.get_tags_of_study(study_id="bowel_colitis_msk_2022") df3 ``` -------------------------------- ### Get Single Study by ID Source: https://pybioportal.readthedocs.io/en/latest/studies.html Fetches detailed information for a specific study identified by its 'study_id'. The result is a pandas DataFrame. ```python df2 = std.get_study(study_id="brca_tcga") df2 ``` -------------------------------- ### Fetch Molecular Data by Profile, Gene, and Sample Source: https://pybioportal.readthedocs.io/en/latest/molecular_data.html Fetches molecular data for specified molecular profiles, entrez gene IDs, and sample IDs. Useful for targeted data retrieval. ```python df3 = md.fetch_all_molecular_data_in_molecular_profile(molecular_profile_id = "brca_tcga_rppa", entrez_gene_ids = ["672","675"], sample_ids = ["TCGA-AR-A1AR-01","TCGA-BH-A1EO-01"]) df3 ``` -------------------------------- ### Import PyBioPortal Samples Module Source: https://pybioportal.readthedocs.io/en/latest/samples.html Imports the samples module from the PyBioPortal library. This is a prerequisite for using any sample-related functions. ```python from pybioportal import samples as sp ``` -------------------------------- ### Get Specific Cancer Type Source: https://pybioportal.readthedocs.io/en/latest/cancer_types.html Retrieves detailed information for a single, specific cancer type using its unique ID. ```APIDOC ## GET /cancer_types/{cancer_type_id} ### Description Retrieves detailed information about a specific cancer type from cBioPortal using its ID. ### Method GET ### Endpoint /cancer_types/{cancer_type_id} ### Parameters #### Path Parameters - **cancer_type_id** (string) - Required - Cancer Type ID (e.g., “brca”). ### Response #### Success Response (200) - **DataFrame** - A pandas DataFrame containing information about the specific cancer type, including 'name', 'dedicatedColor', 'shortName', 'parent', and 'cancerTypeId'. ### Response Example ```json { "example": "[DataFrame with specific cancer type information]" } ``` ``` -------------------------------- ### pybioportal.sample_lists.get_all_sample_lists Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Retrieves all available sample lists with options for projection, sorting, and pagination. ```APIDOC ## get_all_sample_lists ### Description Retrieves all sample lists available in the system. Supports filtering and sorting. ### Method Not applicable (Python function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **projection** (_str_) – Optional - Level of detail of the response. Possible values: "DETAILED", "ID", "META", "SUMMARY" (default). * **direction** (_str_) – Optional - Direction of the sort. Possible values: "ASC" (default), "DESC". * **pageNumber** (_int_) – Optional - Page number of the result list. Minimum value is 0. * **pageSize** (_int_) – Optional - Page size of the result list. Minimum value is 1, maximum value is 10000000. * **sortBy** (_str_) – Optional - 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 ``` -------------------------------- ### Get All Cancer Types Source: https://pybioportal.readthedocs.io/en/latest/cancer_types.html Retrieves a list of all cancer types available in cBioPortal. Supports filtering and sorting through various parameters. ```APIDOC ## GET /cancer_types ### Description Retrieves a list of all cancer types from cBioPortal. This function allows for sorting and pagination of the results. ### Method GET ### Endpoint /cancer_types ### Parameters #### Query Parameters - **direction** (string) - Optional - Direction of the sort. Possible values: "ASC", "DESC". Defaults to "ASC". - **pageNumber** (integer) - Optional - Page number of the result list. Minimum value is 0. Defaults to 0. - **pageSize** (integer) - Optional - Page size of the result list. Minimum value is 1, maximum value is 10000000. Defaults to 10000000. - **projection** (string) - Optional - Level of detail of the response. Possible values: "DETAILED", "ID", "META", "SUMMARY". Defaults to "SUMMARY". - **sortBy** (string) - Optional - Name of the property that the result list is sorted by. ### Response #### Success Response (200) - **DataFrame** - A pandas DataFrame containing the list of cancer types with columns like 'name', 'dedicatedColor', 'shortName', 'parent', and 'cancerTypeId'. ### Response Example ```json { "example": "[DataFrame with cancer type information]" } ``` ``` -------------------------------- ### Fetch Samples by Sample List IDs Source: https://pybioportal.readthedocs.io/en/latest/samples.html Retrieves samples using a list of pre-defined sample list IDs. This is a convenient way to fetch related sets of samples from different data types or studies. ```python df2b = sp.fetch_samples(sample_list_ids=["brca_tcga_cna", "brca_tcga_mrna", "brca_tcga_pub_cna"]) df2b ``` -------------------------------- ### Import Server Running Status Module Source: https://pybioportal.readthedocs.io/en/latest/server_running_status.html Import the server_running_status module from the pybioportal library. This is a prerequisite for using its functions. ```python from pybioportal import server_running_status as srs ``` -------------------------------- ### Get metadata clinical attributes for a study Source: https://pybioportal.readthedocs.io/en/latest/clinical_attributes.html Retrieve metadata-level clinical attributes for a specific study. The 'META' projection is used for this purpose. ```python df3b = ca.get_all_clinical_attributes_in_study(study_id="brca_tcga", projection="META") df3b ``` -------------------------------- ### Get Specific Molecular Profile by ID Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Fetch a single molecular profile using its unique ID. Displays the entire resulting DataFrame. ```python df2 = mf.get_molecular_profile("gbm_tcga_pan_can_atlas_2018_armlevel_cna") df2 ``` -------------------------------- ### Get detailed clinical attributes for a study Source: https://pybioportal.readthedocs.io/en/latest/clinical_attributes.html Fetch detailed clinical attributes for a specific study. The 'DETAILED' projection provides more comprehensive information. ```python df3a = ca.get_all_clinical_attributes_in_study(study_id="brca_tcga", projection="DETAILED") df3a ``` -------------------------------- ### Import PyBioPortal Treatments Module Source: https://pybioportal.readthedocs.io/en/latest/treatments.html Import the treatments module from the pybioportal library. ```python from pybioportal import treatments as trt ``` -------------------------------- ### Fetch Samples by Keyword Source: https://pybioportal.readthedocs.io/en/latest/samples.html Retrieves a DataFrame of samples associated with a specific keyword. This is useful for broad searches across studies. ```python df1 = sp.get_samples_by_keyword(keyword="TCGA") df1 ``` -------------------------------- ### Get All Genes by Alias Source: https://pybioportal.readthedocs.io/en/latest/genes.html Retrieve all genes associated with a given alias. This function helps find genes when you only know one of their alternative names. ```python df1b = gns.get_all_genes(alias = "FANCS") df1b ``` -------------------------------- ### pybioportal.samples.get_samples_by_keyword Source: https://pybioportal.readthedocs.io/en/latest/samples.html Retrieves all samples that match a given keyword. Supports sorting, pagination, and projection options. ```APIDOC ## get_samples_by_keyword ### Description Retrieves all samples matching a keyword. The keyword applies to the study ID. Supports sorting, pagination, and projection options. ### Method `pybioportal.samples.get_samples_by_keyword` ### Parameters #### Path Parameters None #### Query Parameters * **keyword** (str) - Optional - Search keyword that applies to the study ID. * **direction** (str) - Optional - Direction of the sort. Possible values: `"ASC"` (default), `"DESC"`. * **pageNumber** (int) - Optional - Page number of the result list. Minimum value is 0. * **pageSize** (int) - Optional - Page size of the result list. Minimum value is 1, maximum value is 10000000. * **projection** (str) - Optional - Level of detail of the response. Possible values: `"DETAILED"`, `"ID"`, `"META"`, `"SUMMARY"` (default). * **sortBy** (str) - Optional - Name of the property that the result list is sorted by. Possible values: `"sampleId"`, `"sampleType"`. ### Request Example ```python samples = pybioportal.samples.get_samples_by_keyword( keyword="brca_tcga", sortBy="sampleId" ) ``` ### Response #### Success Response (200) Returns a pandas.DataFrame containing samples matching the keyword. #### Response Example ``` # DataFrame structure depends on the projection used. # Example for SUMMARY projection: # SAMPLE_ID PATIENT_ID STUDY_ID # 0 TCGA-AR-A1AR-01 TCGA-AR-A1AR brca_tcga ``` ``` -------------------------------- ### Fetch Generic Assay Data by Sample IDs Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Fetches generic assay data for specified molecular profile, assay IDs, and sample IDs. This is useful for retrieving data for a targeted set of samples. ```python df1a = gad.fetch_generic_assay_data_in_molecular_profile(molecular_profile_id="brca_tcga_phosphoprotein_quantification", generic_assay_stable_ids = ["TULP4_pS563", "TEP1_pS397"], sample_ids = ["TCGA-C8-A130-01", "TCGA-C8-A134-01"]) df1a ``` -------------------------------- ### Fetch Sample Level Treatments by Treatment Time and Name Source: https://pybioportal.readthedocs.io/en/latest/treatments.html Fetches sample-level treatment data filtered by treatment time ('Pre' or 'Post') and treatment name for a specific study. The output is a pandas DataFrame. ```python filter2b = {"sampleTreatmentFilters": { "filters": [ { "filters": [ { "time": "Pre", "treatment": "Palbociclib" }, { "time": "Post", "treatment": "Palbociclib" } ] } ] }, "studyIds": ["brca_tcga"]} df2b = trt.fetch_all_sample_level_treatments(study_view_filter=filter2b) df2b ``` -------------------------------- ### Get All Studies with Keyword Projection Source: https://pybioportal.readthedocs.io/en/latest/studies.html Retrieves a detailed list of all studies matching the keyword 'TCGA'. The output is a pandas DataFrame containing study metadata. ```python df1 = std.get_all_studies(keyword="TCGA", projection="DETAILED") df1 ``` -------------------------------- ### Fetch Generic Assay Data by Sample List ID Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Fetches generic assay data for a specified molecular profile and assay IDs using a predefined sample list ID. This is useful for retrieving data for a broader set of samples defined by a list. ```python df1b = gad.fetch_generic_assay_data_in_molecular_profile(molecular_profile_id="brca_tcga_phosphoprotein_quantification", generic_assay_stable_ids = ["TULP4_pS563", "TEP1_pS397"], sample_list_id = "brca_tcga_all") df1b ``` -------------------------------- ### Fetch Samples by Specific Identifiers Source: https://pybioportal.readthedocs.io/en/latest/samples.html Fetches samples using a list of sample IDs, grouped by study ID. This method allows for precise data retrieval from multiple studies simultaneously. ```python df2a = sp.fetch_samples(sample_identifiers=[ {"sample_ids": ["TCGA-AR-A1AR-01","TCGA-BH-A1EO-01","TCGA-BH-A1ES-01"], "study_id": "brca_tcga"}, {"sample_ids": ["TCGA-A2-A0T2-01","TCGA-A2-A04P-01"], "study_id": "brca_tcga_pub"} ]) df2a ``` -------------------------------- ### Get All Clinical Data for a Study Source: https://pybioportal.readthedocs.io/en/latest/clinical_data.html Retrieves all clinical data associated with a given study ID. This is useful for a comprehensive overview of the clinical attributes within a study. ```python df1 = cd.get_all_clinical_data_of_study(study_id="brca_tcga") df1 ``` -------------------------------- ### Fetch Generic Assay Data Across Multiple Molecular Profiles Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Fetches generic assay data for specified assay IDs across multiple molecular profiles. This is useful for comparative analysis across different datasets. ```python df2a = gad.fetch_generic_assay_data(generic_assay_stable_ids=["TULP4_pS563", "TEP1_pS397", "ALAD_214_215_1_1_S215"], molecular_profile_ids=["brca_tcga_phosphoprotein_quantification","brain_cptac_2020_phosphoprotein"]) df2a ``` -------------------------------- ### Get Patient in Study Source: https://pybioportal.readthedocs.io/en/latest/patients.html Retrieves a specific patient's data within a given study. This is useful for accessing detailed information about an individual patient's records. ```python df4 = pts.get_patient_in_study(patient_id="TCGA-3C-AAAU", study_id="brca_tcga") df4 ``` -------------------------------- ### Fetch Generic Assay Metadata by Stable IDs Source: https://pybioportal.readthedocs.io/en/latest/generic_assays.html Fetches metadata for generic assays using a list of stable IDs. The output includes stableId, entityType, and associated metadata properties. ```python df1a = ga.fetch_generic_assay_meta(generic_assay_stable_ids=["TULP4_pS563", "TEP1_pS397", "ALAD_214_215_1_1_S215"]) df1a ``` -------------------------------- ### Fetch Sample Clinical Data (Wide Format) Source: https://pybioportal.readthedocs.io/en/latest/clinical_data.html Retrieves sample-level clinical data for specified attributes and entities across studies. Returns data in a wide format, where attributes are columns. ```python df1b = cd.fetch_clinical_data(attribute_ids=["ORGAN_SYSTEM", "SUBTYPE", "CANCER_TYPE", "MUTATION_COUNT"], entity_study_ids=[ {"entity_ids": ["P-0000004-T01-IM3", "P-0000950-T01-IM3"], "study": "msk_met_2021"}, {"entity_ids": ["TCGA-5T-A9QA-01", "TCGA-A1-A0SB-01"], "study": "brca_tcga"} ], clinical_data_type="SAMPLE", ret_format="WIDE") df1b ``` -------------------------------- ### Get Server Status Source: https://pybioportal.readthedocs.io/en/latest/server_running_status.html Call the get_server_status() function to retrieve the running status of the server. The function returns a pandas DataFrame indicating the server's operational state. ```python srs.get_server_status() ``` -------------------------------- ### Get Copy Number Segments for a Specific Sample in a Study Source: https://pybioportal.readthedocs.io/en/latest/copy_number_segment.html Retrieves copy number segments for a single sample within a specified study. The output is a pandas DataFrame. ```python df2 = cns.get_copy_number_segments_in_sample_in_study(study_id="msk_met_2021", sample_id="P-0000950-T01-IM3") df2.head(10) ``` -------------------------------- ### Get All Cancer Types Source: https://pybioportal.readthedocs.io/en/latest/cancer_types.html Retrieves a DataFrame containing a summary of all cancer types available in cBioPortal. This function is useful for exploring the available cancer types and their basic properties. ```python df1 = ct.get_all_cancer_types() df1 ``` -------------------------------- ### Fetch Mutations in Molecular Profile for Multiple Genes and Samples Source: https://pybioportal.readthedocs.io/en/latest/mutations.html Fetch mutations from a specified molecular profile for a list of Entrez gene IDs and a list of sample IDs. This is useful for comparative mutation analysis across different genes and samples. ```python df2a = mts.fetch_muts_in_mol_prof(molecular_profile_id="brca_tcga_mutations", entrez_gene_ids=["1005", "1020"], sample_ids = ["TCGA-AR-A1AR-01","TCGA-BH-A1EO-01"]) df2a ``` -------------------------------- ### Import Generic Assays Module Source: https://pybioportal.readthedocs.io/en/latest/generic_assays.html Imports the generic_assays module from the pybioportal library. ```python from pybioportal import generic_assays as ga ``` -------------------------------- ### pybioportal.samples.fetch_samples Source: https://pybioportal.readthedocs.io/en/latest/samples.html Fetches samples based on provided identifiers, sample list IDs, or unique sample keys. Allows specifying the projection for the level of detail in the returned data. ```APIDOC ## fetch_samples ### Description Fetches samples by ID, sample list IDs, or unique sample keys. Allows specifying the projection for the level of detail in the returned data. ### Method `pybioportal.samples.fetch_samples` ### Parameters #### Path Parameters None #### Query Parameters * **sample_identifiers** (list of dict) - Required - List of Sample ID / Study ID pairs. Each dict should have the following format: `[{'sample_ids': ['TCGA-AR-A1AR-01', ...], 'study_id': 'brca_tcga'}, ...]` * **sample_list_ids** (list of str) - Optional - List of Sample List IDs (e.g., `['brca_tcga_cna', 'brca_tcga_mrna', 'brca_tcga_pub_cna']`). * **unique_sample_keys** (list of str) - Optional - List of Unique Sample Keys, e.g. `['VENHQS1BUi1BMUFSLTAxOmJyY2FfdGNnYQ', ...]` * **projection** (str) - Optional - Level of detail of the response. Possible values: `"DETAILED"`, `"ID"`, `"META"`, `"SUMMARY"` (default). ### Request Example ```python # Example for sample_identifiers samples = pybioportal.samples.fetch_samples( sample_identifiers=[ {"sample_ids": ["TCGA-AR-A1AR-01", "TCGA-BH-A1EO-01", "TCGA-BH-A1ES-01"], "study_id": "brca_tcga"}, {"sample_ids": ["TCGA-A2-A0T2-01", "TCGA-A2-A04P-01"], "study_id": "brca_tcga_pub"} ] ) # Example for sample_list_ids samples = pybioportal.samples.fetch_samples( sample_list_ids=["brca_tcga_cna", "brca_tcga_mrna"] ) # Example for unique_sample_keys samples = pybioportal.samples.fetch_samples( unique_sample_keys=["VENHQS1BUi1BMUFSLTAxOmJyY2FfdGNnYQ", ...] ) ``` ### Response #### Success Response (200) Returns a pandas.DataFrame containing samples by ID. #### Response Example ``` # DataFrame structure depends on the projection used. # Example for SUMMARY projection: # SAMPLE_ID PATIENT_ID STUDY_ID # 0 TCGA-AR-A1AR-01 TCGA-AR-A1AR brca_tcga # 1 TCGA-BH-A1EO-01 TCGA-BH-A1EO brca_tcga ``` ``` -------------------------------- ### Fetch Molecular Profiles by IDs Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Retrieve molecular profiles by specifying a list of molecular profile IDs. Displays the entire resulting DataFrame. ```python df3a = mf.fetch_molecular_profiles(molecular_profile_ids=["brca_tcga_mrna", "acc_tcga_rna_seq_v2_mrna"]) df3a ``` -------------------------------- ### pybioportal.sample_lists.fetch_sample_lists Source: https://pybioportal.readthedocs.io/en/latest/sample_lists.html Fetches sample lists by their IDs with a specified projection level. ```APIDOC ## fetch_sample_lists ### Description Fetches sample lists by ID. Allows specifying the level of detail for the returned information. ### Method Not applicable (Python function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **sample_list_ids** (_list of str_) – Required - List of sample list IDs. * **projection** (_str_) – Optional - Level of detail of the response. Possible values: "DETAILED", "ID", "META", "SUMMARY" (default). ### Returns A DataFrame containing sample lists. ### Return Type pandas.DataFrame ``` -------------------------------- ### Import pybioportal gene_panel_data module Source: https://pybioportal.readthedocs.io/en/latest/gene_panel_data.html Imports the necessary module for fetching gene panel data. ```python from pybioportal import gene_panel_data as gpd ``` -------------------------------- ### Get a specific clinical attribute in a study Source: https://pybioportal.readthedocs.io/en/latest/clinical_attributes.html Retrieve a single, specific clinical attribute for a given study ID and clinical attribute ID. Useful for targeted data retrieval. ```python df4 = ca.get_clinical_attribute_in_study(study_id="brca_tcga", clinical_attribute_id="AGE") df4 ``` -------------------------------- ### Fetch gene panel data by molecular profile IDs Source: https://pybioportal.readthedocs.io/en/latest/gene_panel_data.html Fetches gene panel data for a list of specified molecular profile IDs. The output includes sample and patient information. ```python df1a = gpd.fetch_gene_panel_data(molecular_profile_ids=["brca_tcga_gistic", "acc_tcga_gistic", "brca_tcga_mutations"]) df1a ``` -------------------------------- ### Get a specific gene panel by ID Source: https://pybioportal.readthedocs.io/en/latest/gene_panels.html Fetch a gene panel using its unique identifier. Use `.head(10)` to display the first 10 rows of the resulting DataFrame. ```python df2 = gp.get_gene_panel("NSCLC_UNITO_2016_PANEL") df2.head(10) ``` -------------------------------- ### Get All Clinical Data for a Specific Patient Source: https://pybioportal.readthedocs.io/en/latest/clinical_data.html Retrieves all available clinical data for a single patient within a given study. This provides a detailed view of a patient's clinical information. ```python df4 = cd.get_all_clinical_data_of_patient_in_study(study_id="brca_tcga", patient_id="TCGA-5T-A9QA") df4 ``` -------------------------------- ### Fetch Molecular Profiles by Study IDs Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Retrieve molecular profiles by specifying a list of study IDs. Displays the first 5 rows of the resulting DataFrame. ```python df3b = mf.fetch_molecular_profiles(study_ids=["brca_tcga", "acc_tcga"]) df3b.head(5) ``` -------------------------------- ### Import PyBioPortal Mutations Module Source: https://pybioportal.readthedocs.io/en/latest/mutations.html Import the necessary mutations module from the PyBioPortal library. ```python from pybioportal import mutations as mts ``` -------------------------------- ### Import Molecular Profiles Module Source: https://pybioportal.readthedocs.io/en/latest/molecular_profiles.html Import the molecular_profiles module from the pybioportal library. ```python from pybioportal import molecular_profiles as mf ``` -------------------------------- ### Get Aliases of a Gene Source: https://pybioportal.readthedocs.io/en/latest/genes.html Retrieve all known aliases for a given gene, identified by its Hugo Gene Symbol or Entrez Gene ID. This is useful for discovering alternative names a gene might be known by. ```python df3 = gns.get_aliases_of_gene("BRCA2") df3 ``` -------------------------------- ### Import pybioportal gene_panels module Source: https://pybioportal.readthedocs.io/en/latest/gene_panels.html Import the necessary module for gene panel operations. ```python from pybioportal import gene_panels as gp ``` -------------------------------- ### Fetch Generic Assay Data Source: https://pybioportal.readthedocs.io/en/latest/generic_assay_data.html Fetches generic assay data from multiple molecular profiles. Can filter by assay IDs, molecular profile IDs, or sample-molecular identifier pairs. Use 'SUMMARY' projection for default detail level. ```python pybioportal.generic_assay_data.fetch_generic_assay_data(_generic_assay_stable_ids =None_, _molecular_profile_ids =None_, _sample_molecular_identifiers =None_, _projection ='SUMMARY'_) ``` -------------------------------- ### Fetch Generic Assay Metadata by Molecular Profile IDs Source: https://pybioportal.readthedocs.io/en/latest/generic_assays.html Fetches metadata for generic assays associated with specific molecular profile IDs. The results contain stableId, entityType, and gene symbol/phosphosite information. ```python df1b = ga.fetch_generic_assay_meta(molecular_profile_ids=["brca_tcga_phosphoprotein_quantification", "brain_cptac_2020_phosphoprotein"]) df1b ``` -------------------------------- ### Treatments Source: https://pybioportal.readthedocs.io/en/latest/modules.html Functions for fetching treatment data at patient and sample levels. ```APIDOC ## fetch_all_patient_level_treatments() ### Description Fetches all patient-level treatment data. ### Method POST ### Endpoint /patient_level_treatments/fetch ## fetch_all_sample_level_treatments() ### Description Fetches all sample-level treatment data. ### Method POST ### Endpoint /sample_level_treatments/fetch ## fetch_status_display_patient_trts() ### Description Fetches patient treatments for status display. ### Method POST ### Endpoint /patient_treatments/status_display/fetch ## fetch_status_display_sample_trts() ### Description Fetches sample treatments for status display. ### Method POST ### Endpoint /sample_treatments/status_display/fetch ```