Cancer Types#

The module cancer_types provides functions related to Cancer Types section of cBioPortal Web Public API.

pybioportal.cancer_types.get_all_cancer_types(direction='ASC', pageNumber=0, pageSize=10000000, projection='SUMMARY', sortBy=None)#

Get all cancer types from cBioPortal.

Parameters:
  • 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 – Name of the property that the result list is sorted by.

Returns:

A DataFrame containing the list of cancer types.

Return type:

pandas.DataFrame

pybioportal.cancer_types.get_cancer_type(cancer_type_id)#

Get a specific cancer type from cBioPortal.

Parameters:

cancer_type_id (str) – Cancer Type ID (e.g., “acc”).

Returns:

A DataFrame containing information about the specific cancer type.

Return type:

pandas.DataFrame


Examples#

from pybioportal import cancer_types as ct
df1 = ct.get_all_cancer_types()
df1
name dedicatedColor shortName parent cancerTypeId
0 Aggressive Angiomyxoma LightYellow AA soft_tissue aa
1 Anaplastic Astrocytoma Gray AASTR difg aastr
2 Activated B-cell Type LimeGreen ABC dlbclnos abc
3 Acute Basophilic Leukemia LightSalmon ABL amlnos abl
4 Adrenocortical Adenoma Purple ACA adrenal_gland aca
... ... ... ... ... ...
880 Well-Differentiated Liposarcoma LightYellow WDLS lipo wdls
881 Well-Differentiated Thyroid Cancer Teal WDTC thyroid wdtc
882 Waldenstrom Macroglobulinemia LimeGreen WM lpl wm
883 Warty Penile Squamous Cell Carcinoma Blue WPSCC pscc wpscc
884 Wilms' Tumor Orange WT kidney wt

885 rows × 5 columns

df2 = ct.get_cancer_type(cancer_type_id="brca")
df2
name dedicatedColor shortName parent cancerTypeId
0 Invasive Breast Carcinoma HotPink BRCA breast brca