mkt.databases.cbioportal.PanelData

class mkt.databases.cbioportal.PanelData(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, panel_id: str)[source]

Bases: cBioPortalQuery

Class to get gene panel information from a cBioPortal instance.

__init__(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, panel_id: str) None

Methods

__eq__(other)

Return self==value.

__init__([bool_prefix, list_col_explode, ...])

__post_init__()

Post-initialization to check study ID in instance and query API data.

_stamp_from_response(res)

Record query datetime + cache provenance from a requests-cache response.

_stamp_now()

Record current UTC datetime; cache provenance unknown.

check_entity_id()

Check if the panel ID is valid.

check_response(res)

Check the response status code for errors.

convert_api_query_to_dataframe()

Convert API to query to a dataframe.

get_cbioportal()

Get cBioPortal API object.

get_data()

Get cBioPortal data.

get_df()

Get DataFrame of cBioPortal data in dataframe.

get_entity_id()

Get cBioPortal panel ID.

get_instance()

Get cBioPortal instance.

get_url()

Get cBioPortal API URL.

load_from_csv([str_path])

Load DataFrame from CSV file.

maybe_get_token()

Get API token, if available.

query_api()

Query a Swagger API and return result.

query_sub_api()

Query a sub-API of cBioPortal and return result.

regenerate_dataframe()

Regenerate DataFrame from API query.

return_adjusted_colname(colname[, prefix])

Return adjusted column name based on bool_prefix.

set_api_key()

Set API key for cBioPortal API.

Attributes

__dataclass_fields__

__dataclass_params__

__match_args__

_cbioportal

cBioPortal API object (post-init).

_data

List of cBioPortal sub-API queries; None if ID not found (post-init).

_df

DataFrame of cBioPortal data; None if DataFrame could not be created (post-init).

bool_prefix

Add prefix to ABC column names if True; default is True.

from_cache

Whether the most recent response was served from requests-cache.

instance

cBioPortal instance.

list_col_explode

List of columns to explode in convert_api_query_to_dataframe; None if no columns to explode (post-init).

pathfile

Path to load dataframe from CSV file; if None, regenerate (post-init).

query_datetime

UTC datetime the underlying network query was made (cache creation time if served from cache).

url

cBioPortal API URL.

panel_id

cBioPortal panel ID.

__init__(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, panel_id: str) None
check_entity_id() bool[source]

Check if the panel ID is valid.

Returns:

True if the panel ID is valid, False otherwise

Return type:

bool

get_entity_id()[source]

Get cBioPortal panel ID.

panel_id: str

cBioPortal panel ID.