czbenchmarks.datasets.single_cell
Attributes
Classes
Single cell dataset containing gene expression data and metadata. |
|
Single cell dataset with perturbation data, containing control and |
Module Contents
- czbenchmarks.datasets.single_cell.logger
- class czbenchmarks.datasets.single_cell.SingleCellDataset(path: str, organism: czbenchmarks.datasets.types.Organism)[source]
Bases:
czbenchmarks.datasets.base.BaseDataset
Single cell dataset containing gene expression data and metadata.
Handles loading and validation of AnnData objects with gene expression data and associated metadata for a specific organism.
- load_data() None [source]
Load the dataset into memory.
This method should be implemented by subclasses to load their specific data format. For example, SingleCellDataset loads an AnnData object from an h5ad file.
The loaded data should be stored as instance attributes that can be accessed by other methods.
- unload_data() None [source]
Unload the dataset from memory.
This method should be implemented by subclasses to free memory by clearing loaded data. For example, SingleCellDataset sets its AnnData object to None.
This is used to clear memory-intensive data before serialization, since serializing large raw data artifacts can be error-prone and inefficient.
Any instance attributes containing loaded data should be cleared or set to None.
- property organism: czbenchmarks.datasets.types.Organism
- property adata: anndata.AnnData
- class czbenchmarks.datasets.single_cell.PerturbationSingleCellDataset(path: str, organism: czbenchmarks.datasets.types.Organism, condition_key: str = 'condition', split_key: str = 'split')[source]
Bases:
SingleCellDataset
Single cell dataset with perturbation data, containing control and perturbed cells.
Input data requirements:
H5AD file containing single cell gene expression data
Must have a condition column in adata.obs specifying control (“ctrl”) and perturbed conditions.
Must have a split column in adata.obs to identify test samples
Condition format must be one of:
ctrl
for control samples{gene}+ctrl
for single gene perturbations{gene1}+{gene2}
for combinatorial perturbations
- load_data() None [source]
Load the dataset into memory.
This method should be implemented by subclasses to load their specific data format. For example, SingleCellDataset loads an AnnData object from an h5ad file.
The loaded data should be stored as instance attributes that can be accessed by other methods.
- unload_data() None [source]
Unload the dataset from memory.
This method should be implemented by subclasses to free memory by clearing loaded data. For example, SingleCellDataset sets its AnnData object to None.
This is used to clear memory-intensive data before serialization, since serializing large raw data artifacts can be error-prone and inefficient.
Any instance attributes containing loaded data should be cleared or set to None.
- property perturbation_truth: Dict[str, pandas.DataFrame]