mkt.databases.cbioportal.ClinicalSample
- class mkt.databases.cbioportal.ClinicalSample(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, study_id: str)[source]
Bases:
ClinicalClass to get sample-level clinical information from a cBioPortal study.
- __init__(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, study_id: str) None
Methods
__eq__(other)Return self==value.
__init__([bool_prefix, list_col_explode, ...])__post_init__()Post-initialization to get clinical info from cBioPortal.
_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 study 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 study 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()Get clinical info cBioPortal data.
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___cbioportalcBioPortal API object (post-init).
_dataList of cBioPortal sub-API queries; None if ID not found (post-init).
_dfDataFrame of cBioPortal data; None if DataFrame could not be created (post-init).
bool_prefixAdd prefix to ABC column names if True; default is True.
If True, return sample-level clinical data; if False, return patient-level clinical data
from_cacheWhether the most recent response was served from requests-cache.
instancecBioPortal instance.
list_col_explodeList of columns to explode in convert_api_query_to_dataframe; None if no columns to explode (post-init).
pathfilePath to load dataframe from CSV file; if None, regenerate (post-init).
query_datetimeUTC datetime the underlying network query was made (cache creation time if served from cache).
urlcBioPortal API URL.
cBioPortal study ID.
- __init__(bool_prefix: bool = True, list_col_explode: list[str] | None = None, pathfile: str | None = None, *, study_id: str) None
- bool_sample: bool = True
If True, return sample-level clinical data; if False, return patient-level clinical data
- study_id: str
cBioPortal study ID.