iggytop.adapters.cedar_adapter.CEDARAdapter#
- class iggytop.adapters.cedar_adapter.CEDARAdapter(bc, cache_dir=None, receptors_to_include=('TCR', 'BCR'), test=False, filter_10x=False)#
BioCypher adapter for the Cancer Epitope Database and Analysis Resource CEDAR.
- __init__(bc, cache_dir=None, receptors_to_include=('TCR', 'BCR'), test=False, filter_10x=False)#
Initializes the BaseAdapter instance.
- Parameters:
bc (
BioCypher) – An instance of the BioCypher class.cache_dir (
str|None) – Directory to cache data. Defaults to None.receptors_to_include (
Optional[Sequence[Literal['TCR','BCR']]]) – Receptors to include. Defaults to (“TCR”, “BCR”).test (
bool) – Whether to run in test mode. Defaults to False.filter_10x (
bool) – Whether to filter out 10X Genomics datasets. Defaults to False.
Methods
__init__(bc[, cache_dir, ...])Initializes the BaseAdapter instance.
create_anndata()Creates an Anndata object from the AIRR cell data and saves it to a file in the cache directory.
Abstract method to generate BioCypher edges from the data.
Retrieves the latest release of the CEDAR database.
Abstract method to generate BioCypher nodes from the data.
read_table(bc, table_path, receptors[, ...])Reads and processes the CEDAR table from the downloaded database file.
set_metadata([version, source_url, ...])Sets the metadata for the adapter.
Attributes
File name of the BCR data in CEDAR.
Directory name for the downloaded database.
Name of the database.
URL to download the CEDAR database.
File name of the TCR data in CEDAR.
airr_cellsProperty to get the list of AIRR cells.
Receptor types available in CEDAR.
cache_dirProperty to get the cache directory.
db_nameProperty to get the database name.
metadataProperty to get the adapter metadata.
receptorsProperty to get the available receptor types.
tableProperty to get the data table.
- get_edges()#
Abstract method to generate BioCypher edges from the data.
This method is intended to call _generate_edges_from_table with the right parameters for each edge type. This requires parameters depending on the adapter used.
- Yields:
tuple – A BioCypher edge (id, source, target, type, properties).
- get_latest_release(bc)#
Retrieves the latest release of the CEDAR database.
- get_nodes()#
Abstract method to generate BioCypher nodes from the data.
This method is intended to use _generate_nodes_from_table with the right parameters for each edge type. This requires parameters depending on the adapter used.
- Yields:
tuple – A BioCypher node (id, type, properties).
- read_table(bc, table_path, receptors, test=False, prefer_calculated=True)#
Reads and processes the CEDAR table from the downloaded database file.
- Parameters:
bc (
BioCypher) – An instance of the BioCypher class.table_path (
tuple[str,str]) – Paths to the TCR and BCR table files.receptors (
list[str]) – List of receptor types to include in the table.test (
bool) – IfTrue, loads only a subset of the data for testing (default is False).prefer_calculated (
bool) – IfTrue, calculated values are preferred over curated values. Defaults to True.
- Return type:
- Returns:
A DataFrame containing the processed table data.
- Raises:
FileNotFoundError – If the table file cannot be found.
- BCR_FNAME = 'bcr_full_v3.csv'#
File name of the BCR data in CEDAR.
- DB_DIR = 'cedar_latest'#
Directory name for the downloaded database.
- DB_NAME: str = 'CEDAR'#
Name of the database.
- DB_URL = 'https://cedar.iedb.org/downloader.php?file_name=doc/receptor_full_v3.zip'#
URL to download the CEDAR database.
- TCR_FNAME = 'tcr_full_v3.csv'#
File name of the TCR data in CEDAR.
- _abc_impl = <_abc._abc_data object>#
- available_receptors: list[str] = ['TCR', 'BCR']#
Receptor types available in CEDAR.